I need assistance with integrating our backend service (built with Java Spring Boot) with a Microsoft Word add-in (built with Angular).
Current Setup:
-
Our backend service creates a
DriveItem
for a Word document
programmatically using the Microsoft Graph SDK for Java and uploads it to user’s OneDrive. -
The user is then redirected to a URL (
webUrl
) that opens the Word
document in a new tab.
Requirement:
Our Office add-in, integrated into Microsoft Word, needs to send some type of information or an ID back to our backend service so that the backend can identify or reconstruct the associated DriveItem
.
Thoughts and Attempts:
1. Query Parameter Approach:
-
The backend service adds a query parameter like
DocumentId
to the
webUrl
. -
The add-in in Microsoft Word reads that query parameter and sends it
back to the backend. -
Issue:
Office.context.document.url
doesn’t return the query string associated with the URL.
2. Custom Properties Approach:
-
The backend service adds the
DocumentId
to additional data
(FieldsValueSet
) of theListItem
. -
The add-in reads the
DocumentId
from the document properties. -
Concern: I’m not sure if these custom properties can be read via
Office.context.document.properties
.
Question:
Am I missing another useful approach? How can I achieve this? Are there any other methods or best practices to send information from the Office add-in to the backend service for identifying the associated DriveItem
?
This is urgent, so any help will be greatly appreciated.
Thank you!