0

Using the Microsoft Graph API, I am fetching all the emails in a certain shared mailbox.

I cannot use specific FolderID as that is constantly changing/evolving.

How can I differentiate emails that are received versus sent?

I originally subtracted all the emails in the 'SentItems' WellKnownFolderId but the issue with that is that users are able to move emails from the 'SentItems' folder into a sub-folder (under Inbox or Sent Items).

There is also the issues of accounting for the emails in the deleted items and other places we do not want to account for, but that is not as important.

What can I do?

Thanks,

Yanoflies
  • 31
  • 1
  • 1
  • 4

2 Answers2

0

Using extended properties you can read message flags bitmask.

See Microsoft Graph API mail office 365: Is any option create inbox message NOT as Draft? for more information.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
0

Received message will have ReceivedByXYZ (OOM) and PR_RECEIVED_BY_XYZ (MAPI) properties. Sent message will not have those properties.

I don't think these properties are explicitly exposed in Graph, but you should be able to access the raw MAPI properties - see https://learn.microsoft.com/en-us/graph/api/resources/extended-properties-overview?view=graph-rest-1.0

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78