Delete generated file after execute template is over

Once mail merge template has been executed output file would be stored. Then I’ve to download it using the file name I got from JSON response. But the file stays in the storage and to conserve space it should be deleted is it correct? .NET SDK cannot do it, it just do GET but not delete?

Hi Denis,

Yes, you are right. You can use DeleteFile method of the Folder class to delete a file from storage as you can see at

You can pass name of the file if file in the root folder or you can pass complete path e.g. ‘Folder1/File1.docx’ if file is in a specific folder.

Best Regards,
Muhammad Ijaz
Support Developer, Saaspose Sialkot Team
http://www.saaspose.com

Thanks Muhammad!

The problem is - ExecuteMailMerge does not return the name of a temporary file created. So I've no way of knowing the actual file name to delete.

Best
Denis

Hi Denis,

Thanks a lot for you feedback. We will update these methods and support a new boolean parameter to let the users choose if they want to remove these files from storage, and let you know once it is done. In the meantime, you can call DeleteFile method in the ExecuteMailMerge method to delete downloaded files from Saaspose storage.

Best Regards,
Muhammad Ijaz
Support Developer, Saaspose Sialkot Team
http://www.saaspose.com

Hi Denis,

Now you can pass bool value to all the methods of MailMerge class; please download the latest version of .NET SDK from GitHub - aspose-words-cloud/aspose-words-cloud-dotnet: .NET library for communicating with the Aspose.Words Cloud API and use the following code for this purpose:

mailMerge.ExecuteMailMerege(fileName, xml, SaveFormat.Docx, "c:\\SimpleOut.docx", "folder1", true);

Best Regards,
Muhammad Ijaz
Support Developer, Saaspose Sialkot Team
http://www.saaspose.com