exportAsText works for some paths but returns GeneralError for others
Hello,
I am trying to make a stamp that will save the users input as a .txt file.
I am using the exportAsText function within a trusted function and it mostly works until I try and save the output to different folders.
With the following code the output saves correctly however I don't want to save the result within the DC folder. I have changed my username to [username] in the code snippets for privacy reasons.
exportDataTotxt = app.trustedFunction( function(filename){
app.beginPriv();
savepath = "C:\\Users\\[username]\\AppData\\Roaming\\Adobe\\Acrobat\\DC\\"+filename;
this.exportAsText(false,null,savepath);
app.endPriv();
});When I change the savepath variable to the folllowing:
savepath = "C:\\Users\\[usermane]\\"+filename;I get this error:
GeneralError: Operation failed.
Doc.exportAsText:5:App Script:Calculate
I have tried with a number of different folder locations including in different drives but it only works within the DC folder.
For context the filename variable is defined in the stamp's code as follows:
filename = util.printd("ddmmyyyyHHMMss", new Date()) + "_Data.txt";
