I have an Office Task Pane App written with Office Javascript API (Office.js) that calls Office.context.document.getFilePropertiesAsync and places the returned URL in an angular variable:
$scope.getDocumentUrl = function () {
Office.context.document.getFilePropertiesAsync(function (asyncResult) {
$scope.url = asyncResult.value.url;
});
};
I then have a button that calls this. This works file the first time, but when I press the button a second time, it never enters the callback and displays this error:
TypeError: Object expected at verifyAndExtractCall (https://localhost:44304/scripts/office/1.1/o15apptofilemappingtable.js:11:54588) at Anonymous function (https://localhost:44304/scripts/office/1.1/o15apptofilemappingtable.js:11:83048) at Anonymous function (https://localhost:44304/scripts/office/1.1/o15apptofilemappingtable.js:11:86071) at $scope.getDocumentUrl (https://localhost:44304/AngularJs/controllers/sandpit.controller.js:130:6) at $parseFunctionCall (https://localhost:44304/AngularJs/bower_components/angular/angular.js:12403:7) at callback (https://localhost:44304/AngularJs/bower_components/angular/angular.js:21566:17) at Scope.prototype.$eval (https://localhost:44304/AngularJs/bower_components/angular/angular.js:14466:9) at Scope.prototype.$apply (https://localhost:44304/AngularJs/bower_components/angular/angular.js:14565:11) at Anonymous function (https://localhost:44304/AngularJs/bower_components/angular/angular.js:21571:17) at jQuery.event.dispatch (https://localhos
This is a simplified version of another situation that creates the same error. It also happens with getFileAsync. I know I need $scope.$apply to display the change. I know you can get the URL in other ways. I need to know the cause of the error.
I test your scenario in my local machine. I could not repro your issue.
My simple test app has two files: AngularTest.html and AngularTest.js.
Content in AngularTest.html:
Content in AngularTest.js:
You can obtain the URL by clicking the button "Get Url". I tested it in Excel 2013 SP 1.