Office.context.document.getFileAsync giving problem in Microsoft office in Mac RRS feed

  • Question

  • Hi,

    I am developing an add-in for office 365. Before few days everything was working perfectly in all environment including office 2013, 2016 for windows desktop and office for Mac desktop client as well. Abruptly I start getting the problem in the loading of add-in with the office in Mac. It is behaving very strange. When I debug this using vorlon.js it was identified that problem is with an async call as depicted below. Add-in doesn't load initially but when we reload the client using Vorlon, then it loads normally but add-in default re-load doesn't work. To assure that this call is the problem I tried with commenting this call and then load the add-in and it worked. The error message I am getting in Vorlon is: "undefined is not an object" and below is the code which is causing the problem:

    Office.context.document.getFileAsync("pdf", { sliceSize: 65536 }, function (fileResult) {
                        function isErrorResult(officeFile, result) {
                            if (result.status !== Office.AsyncResultStatusSucceeded) {
                                if (officeFile) officeFile.closeAsync();
                                return true;
                            return false;

                        if (isErrorResult(undefined, fileResult)) return;

                        var resultPdfBytes = [];

                        function readAndAppendNextSlice(officeFile, sliceIndex) {
                            officeFile.getSliceAsync(sliceIndex, function (sliceResult) {
                                if (isErrorResult(officeFile, sliceResult)) return;
                                resultPdfBytes = resultPdfBytes.concat(;
                                if (sliceIndex + 1 >= officeFile.sliceCount) {
                                    if (success) {
                                } else {
                                    readAndAppendNextSlice(officeFile, sliceIndex + 1);

                        readAndAppendNextSlice(fileResult.value, 0);

    office version I am using in Mac: 15.41 (171205)


    Friday, January 5, 2018 6:12 AM