I am using Outlook REST API V2 (https://msdn.microsoft.com/en-us/office/office365/api/mail-rest-operations)
Is there a way to determine the root parent folder of a message without making subsequent requests to get the parent of the parent of the parent, etc.. of the message folder? In my case I would like to know if a message is "deleted", by finding out if the message is anywhere under the DeletedItems hierarchy.
Related to this - Is there a way to get all messages under a folder regardless of where in the sub-folders of the folder the message is, without making separate requests to traverse the sub-folders hierarchy?
Thanks for your time to anyone willing to help :)
No, there isn't any direct way by just looking at the message entities. You could sync the mail folder hierarchy down locally to your client, then essentially construct a list of IDs for the Deleted Items and any folders under it, then compare IDs in your message list. You'd have to be sure to keep the folder hierarchy table on your client in sync.
No, there is no deep traversal. If you get the /messages
collection from a folder, it's only immediate children. If you get /me/messages
, it's messages from all folders in the mailbox (which is more than what you're asking I think).