Unable to get the unique Presentation ID of a powerpoint document

Sandhya Sriram 20 Reputation points
2026-01-27T07:17:51.6933333+00:00

The below code always logs "presentation" for both saved and unsaved powerpoints. How do I get the unique ID of presentation?

await PowerPoint.run(async (context) => {

const presentation = context.presentation;

presentation.load("id");

await context.sync();

console.log(`Presentation ID: ${presentation.id}`);

});

Microsoft 365 and Office | PowerPoint | For business | MacOS
0 comments No comments
{count} votes

Answer accepted by question author
  1. Gabriel-N 13,035 Reputation points Microsoft External Staff Moderator
    2026-01-27T11:03:06.3266667+00:00

    Dear Sandhya Sriram

    Thank you for reaching out to the Microsoft Q&A forum.

    According to Microsoft’s official documentation, the presentation.id property is simply described as “Gets the ID of the presentation.” However, there is no indication that this value is a GUID or a globally unique identifier.

    User's image

    From what I’ve researched, the common method to assign a unique identifier to a PowerPoint file is to use custom tags. This approach allows you to embed a key-value pair (e.g., "MY_ID": "") into the file’s metadata. This value is stored within the file itself and persists across sessions, saves, and even when the file is copied or moved. Any device or session that opens the file (with your add-in) can read the tag you assigned.

    If you are using PowerPoint API 1.7 or later, you can use presentation.properties.customProperties.add(key, value) to create or update a custom property. This method stores the data in the same metadata area as tags and is consistent with the Word/Excel object model. However, this API is only available in newer versions of Office (Windows, Mac, Web). If your add-in needs to support older Office versions, consider using tags instead.

    Another option is to use the file path or URL as an identifier. If the file has been saved, you can retrieve its path or URL using Office.context.document.url or getFilePropertiesAsync. However, this is not a stable identifier since users can rename or move the file, which changes the path. For local files, the path is only unique on a specific machine. This method is suitable for identifying files during the current session, but it does not guarantee long-term uniqueness across sessions or devices. Also, for unsaved files, there is no path to retrieve.

    If your file is stored on OneDrive or SharePoint, each document has a globally unique DriveItem ID. You can retrieve this ID using Microsoft Graph API. This ID is system-generated, globally unique, and remains stable even if the file is renamed or moved within the same folder. However, Office.js does not expose this ID directly, you must implement Graph API calls, which require user authentication and permissions. This method is best suited for cloud-based workflows or when integrating with external systems.

    For local-only scenarios, using tags remains the most practical approach.

    Reference sources:

    I hope this information is helpful.


    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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