In office.js identifiers are mutable .They always changes if email changed its location(from Draft to Sent e.tc ).I want to use for my add-in identifiers what are immutable.
In graph.api you can use immutable identifiers link to allow them "work" need to add header to REST calls (header is Prefer: IdType="ImmutableId"
)
Can I set same header(Prefer: IdType="ImmutableId"
) to office.js ?Using for that Office.InternetHeaders.setAsync()
method to make identifiers immutable?
No. internetHeaders.SetAsync(). is used to set the internetHeaders of the Outgoing mail.
The instructions you referenced to add Prefer: IdType="ImmutableId"
is referring to the headers when you make a REST call, and does not releate to office.js apis.
Immutable IDs do not work with any office.js apis. The only itemID available is the EWSId via Office.context.mailbox.item.itemId. However, as you noted the EWSId will change if the item switches folders.
You may be able to use Graph/REST to translate the EWSId into immutable: https://learn.microsoft.com/en-us/graph/api/user-translateexchangeids?view=graph-rest-1.0&tabs=http
But Office.js inputs/outputs are always EWSId's in the function.