Get word document ID from JavaScript API

Budhitha Lakshan 5 Reputation points
2023-04-18T12:08:35.43+00:00

Hello,

I'm working on currently creating an MS Office 365 add-in project. So I need a generic way to get Word or PowerPoint Document ID to Add-in. Here need be access in an organizational account or Personal account as well.
I tried this API call but result give us URL but it's doesn't contained the proper document ID as well.
https://learn.microsoft.com/en-us/javascript/api/office/office.document?view=common-js-preview#office-office-document-getfilepropertiesasync-member(2)

  • For Organizational account -> https://####-my.sharepoint.com/personal/<company name>/Documents/Document6tes.docx
  • For Personal account -> https://d.docs.live.net/<ID>/Document%205.docx
    ** Even <ID> also doesn't have any connection with Onedrive document id.

Can someone help me to get the Document ID using Javascript API?

JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
1,007 questions
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.