Microsoft-365 outlook email message templates list via microsoft graph api

145 Views Asked by At

I'm looking for the program way of retrieving of Outlook email message templates (templates list and template's inside content) in Microsoft 365. I've already spent some time with Microsoft Graph API investigation but can't find any suitable method there. Could anybody advise me the way to solve my task (any not deprecated method/API).

Sorry for so straightforward question but time is already come and I still have no any solution.

1

There are 1 best solutions below

0
Dmitry Streblechenko On

The templates are stored as a hidden (associated) message in the Inbox folder in the mailbox. The message class of that message is "IPM.Configuration.ClientExtension.a216ceed77914635a7525a4ac0a5eb93". You can access it through the Outlook Object Model

set folder = Application.Sesssion.GetDefaultFolder(olFolderInbox)
set msg = folder.GetStorage("IPM.Configuration.ClientExtension.a216ceed77914635a7525a4ac0a5eb93", olIdentifyByMessageClass)
templateXml = msg.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x7C070102") 'PR_ROAMING_DICTIONARY

I don't think you can access associated folder messages in Graph, but you can in EWS.

As a debugging hint, you can figure out where things are stored using OutlookSpy (I am its author) - click IMsgStore button, go to the Advise tab, modify the setting (template in your case), look at the notification in OutlookSpy. Select the message entry id, right click, select IMAPISession::OpenEntry. From there, you can figure out what the parent folder is (PR_PARENT_ENTRYID, right click and select IMAPISession::OpenEntry to open it) and where the data is stored (PR_ROAMING_DICTIONARY).

enter image description here