
good,
Currently I generate a template by code, this template generates a URL for me, that URL only lasts for a certain time, so if the user takes a long time to open, he will not be able to download the file.
This is why I need that the file that is downloaded from the temporary URL can be uploaded to SharePoint and is available for as long as necessary.
It can be done in a native and "functional" way, I need to do it by code.
const str templateName = "XXXXservicio"; //template uploaded in the system
DocuTemplate template = DocuTemplate::findTemplate(OfficeAppApplicationType::Word, "XXXXservicio");
// Ensure the template was present
if (template && template.TemplateID == templateName)
{
Map filtersToApply = new Map(Types::String, Types::Class);
ExportToExcelFilterTreeBuilder filterBuilder = new ExportToExcelFilterTreeBuilder(tablestr(XXXXWorkerEmployeeEntity));
FilterCollectionNode filterString = filterBuilder.and(filterBuilder.companyFilter(),filterBuilder.areEqual(fieldstr(XXXXWorkerEmployeeEntity, PersonnelNumber), "000713"));
filtersToApply.insert(tablestr(XXXXWorkerEmployeeEntity), filterString);
// Generate the workbook using the template and filters
DocuTemplateRender renderer = new DocuTemplateRender();
str documentUrl = renderer.renderTemplateToStorage(template, filtersToApply);//TEMPORARY url that I get
// Pass the workbook to the user
if (documentUrl)
{
info(strformt("url %1",documentUrl));
}
else
{
error(strFmt("@ApplicationFoundation:DocuTemplateGenerationFailed", templateName));
}
}
else
{
warning(strFmt("@ApplicationFoundation:DocuTemplateNotFound", templateName));
}
natively it is possible to do so:


once saved it gives me another URL, this one is long-lasting.

i need the last url. thanks
If you look into code, you'll see it tries to update files to SharePoint and it uses blob storage only if the attempt with SharePoint fails. This happens in ExportToExcelStorageHelper::uploadExportStream(), which is called from DocuTemplateRender.renderTemplateToStorage(). You can see that there is setup that would have to be in place, therefore one of your options is simple do the setup.
Alternatively you could use renderTemplateToStream() instead of renderTemplateToStorage() and deal with the upload by yourself (using different parameters).