office365 - Office.context.document.url still empty after saving the file -
i'm developing office task pane add-in microsoft project , bumped serious limitation.
after creating new project file, load task pane app, has subfunction, reads office.context.document.url property, should have full path file.
obviously, @ first, it's empty, because it's unsaved project, after save project, , fire subfunction again, url still empty.
i suppose, document object not reloaded @ point during saving. how can manually? if it's possible...
here's subfunction returns project path:
function getprojectpath() { var documenturl = office.context.document.url; if (documenturl == null || documenturl == "") { return ""; } else { return documenturl; } }
this question project, not support method, have dynamic access file url word, excel , ppt, recommend use getfilepropertiesasync method.
here sample on how use it:
function getfileurl() { //get url of current file. office.context.document.getfilepropertiesasync(function (asyncresult) { var fileurl = asyncresult.value.url; if (fileurl == "") { showmessage("the file hasn't been saved yet. save file , try again"); } else { showmessage(fileurl); } }); }
Comments
Post a Comment