Edit in GitHubLog an issue

Use Document Metadata

Through the Add-on UI SDK Document object, you can retrieve some information about the current document. Currently, there are asynchronous methods that allow you to retrieve the id(), title() and the document link(). Also, associated events allow you to listen for when the values are available or have changed, via the documentIdAvailable, documentTitleChange, documentLinkAvailable, and documentPublishedLinkAvailable events, with the addOnUISdk.app.on() method.

Example

Copied to your clipboard
import addOnUISdk from "https://express.adobe.com/static/add-on-sdk/sdk.js";
addOnUISdk.ready.then(() => {
// Get the document ID
const docId = await addOnUISdk.app.document.id();
// urn:aaid:sc:VA6C2:679a7c92-33ce-4320-a610-f58ccaf56aa8
// Get the document title
const docTitle = await addOnUISdk.app.document.title();
// Get the document Link
const docLink = await addOnUISdk.app.document.link("document"); // or "published"
console.log(`Document ID: ${docId}; Document Title: ${docTitle}; Document Link: ${docLink}`);
// Listen for document ID change
addOnUISdk.app.on("documentIdAvailable", data => {
console.log(`Document ID is available. ID value: ${data.documentId}`);
});
// Listen for document title change
addOnUISdk.app.on("documentTitleChange", data => {
console.log(`Document title changed to: ${data.documentTitle}`);
});
// Listen for document link availability change
addOnUISdk.app.on("documentLinkAvailable", data => {
console.log(`Document link availability changed. Link value: ${data.documentLink}`);
});
// Listen for published document link availability change (for instance, via the "Publish to Web" option in Adobe Express).
addOnUISdk.app.on("documentPublishedLinkAvailable", data => {
console.log(`Published document link availability changed. Link value: ${data.documentPublishedLink}`);
});
});

FAQs

Q: How do I get the document ID?

A: Call await addOnUISdk.app.document.id() to retrieve the document ID.

Q: How do I get the document title?

A: Call await addOnUISdk.app.document.title() to retrieve the document title.

A: Call await addOnUISdk.app.document.link("document") or link("published") for different link types. The link() method is currently an experimental method and requires the experimentalApis flag to be enabled in the manifest.

Q: How do I listen for document ID changes?

A: Use addOnUISdk.app.on("documentIdAvailable", callback) to listen for ID changes.

Q: How do I listen for title changes?

A: Use addOnUISdk.app.on("documentTitleChange", callback) to listen for title changes.

A: You can get the "document" link or "published" document link via the experimental link() method. Note, this method currently requires theexperimentalApis flag to be enabled in the manifest.

A: Use documentLinkAvailable or documentPublishedLinkAvailable events with addOnUISdk.app.on().

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2025 Adobe. All rights reserved.