0

I develop a Javascript Office add-in which can run on Word, Excel and PowerPoint.

One of the features of the add-in is to suggest user to upload current file to our server if the file have changed and/or saved since the last successful upload.

I had some luck with document.properties.lastSaveTime for Word application: https://dev.office.com/reference/add-ins/word/documentproperties?product=word But this API is Word-specific and is not available for other hosts.

Is there a way to get the date of last file change (document, workbook and presentation accordingly to the host application) using shared API, that is, API available for all three hosts?

If such shared API functionality doesn't exist, even some clue of how to get last changed date of individual hosts' files would be helpful.

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
John.W.Harding
  • 521
  • 4
  • 4
  • If the user is uploading the file via your add-in, why wouldn't you use the add-in to record this information in the file? All three support Custom XML Parts and it appears this is part of the Shared API: https://dev.office.com/reference/add-ins/shared/document.customxmlparts - a Custom XML Part would be an ideal storage for such information as you can access via the API, via VBA/COM Add-ins and through the Office Open XML on the closed file. – Cindy Meister Feb 20 '18 at 17:01
  • I can store information of the last upload date, but I can't track information of when user has changed a file. Moreover, user may update a file when the add-in is not even running. And I need both those dates to calculate a condition to suggest upload updated version. – John.W.Harding Feb 21 '18 at 07:29
  • All Office applications support document properties, such as you mention. I believe the Office JS API supports reading those properties. See for example: https://learn.microsoft.com/en-us/office/dev/add-ins/develop/understanding-the-javascript-api-for-office (search term: "document property"; https://stackoverflow.com/questions/41802181/is-it-possible-to-set-a-word-documents-custom-properties; https://stackoverflow.com/questions/30374549/how-can-i-read-excel-custom-properties-in-office-javascript-api – Cindy Meister Feb 21 '18 at 18:05

0 Answers0