Hello there,
I am using ApplicationXtender 16's REST API to export jobs. I am having an issue when I make concurrent requests to the same endpoint/file. I get the following error:
{"ErrorCode":9999,"Message":"Save page files: Encountered a sharing violation while accessing C:\\Users\\AX758D~1.IMP\\AppData\\Local\\Temp\\docx_560130.docx. Job failed! Unknown error","InnerException":null}
This is my post request to export the file:
let req = {
method: 'post',
url: `/AXDocExportJobs/${appId}`,
headers: {
'Accept': 'application/vnd.emc.ax+json',
'Content-Type': 'application/vnd.emc.ax+json; charset=utf-8',
},
data: {
"ExportColdFormOverlay": 1,
"IsExportCold": false,
"HideAnnotation": false,
"Documents": [{
"AppID": appId,
"DocID": docId
}],
"pageRange": pageRange,
"pageNum": 0,
"pageVersionNum": 0,
"subPageRange": null,
"UsePDFFormat": isPDF,
"ExportIndex": false,
"ExportImage": false,
"IsOpenDocument": true,
"queryContextId": null,
"idxes": null
}
};
Once the job has started, I use the following to check on the status:
return {
headers: {
'Accept': 'application/vnd.emc.ax+json',
},
method: 'get',
responseType: 'arraybuffer',
url: `/AXDocExportResults/${jobToken}`,
};
The code above works most of the time, but it fails when multiple requests are made at the same time for the same file (docId).
I believe Windows throws this error when you try to access a file that's already in use. What am I missing here? Is there a way to check out this file before exporting it, or perhaps check if a file is already being exported before initiating a new export job?
Any help that points me in the right direction is much appreciated. Thanks.