0

I use "Yo Office" to create an add-in for word 2016 which is working fine. And then I use "Yo Office" to create add-in for Excel 2016, when it execute this line "Office.context.document.getFileAsync" it return error with 7000 Permission Denied

function getDocumentAsCompressed() {
  console.log("CompressedFile status: " + Office.context.requirements.isSetSupported("CompressedFile")); // false
  console.log("PdfFile status: " + Office.context.requirements.isSetSupported("PdfFile")); // false
  console.log("TextFile status: " + Office.context.requirements.isSetSupported("TextFile")); // false
  Office.context.document.getFileAsync(Office.FileType.Compressed, { sliceSize: 65536 /*64 KB*/ }, 
      function (result) {
          if (result.status == "succeeded") {
              // If the getFileAsync call succeeded, then
              // result.value will return a valid File Object.
              const myFile = result.value;
              const sliceCount = myFile.sliceCount;
              const docdataSlices = [];
              let slicesReceived = 0, gotAllSlices = true;
              console.log("File size:" + myFile.size + " #Slices: " + sliceCount)


          }
          else {
            console.log("err: " + result.error.message + result.error.code)
          }
  });
}

I tried the same code run in word 2016 and it working fine.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45

1 Answers1

0

This issue was posted to the Office JavaScript API (OfficeJS) repo at https://github.com/OfficeDev/office-js/issues/757 . Looks like it has been fixed some years ago. But if you still can reproduce it you may post it there.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45