How does one get the count of Outlook emails sent to self via the Microsoft Graph API Get request?
Among other things, here's what I've tried:
f"{BASE_URL}/users/{email}/messages?$filter=from/emailAddress/address eq '{email}'&$search=\\"cc:{email}\\""
f"{BASE_URL}/users/{email}/messages?$search=\\"cc:{email}\\"&$count=true"
f"{BASE_URL}/users/{email}/messages?$filter=toRecipients/any(e:e/emailAddress/address eq '{email}')"
I wish to avoid pulling the email details and wrangle upstream as the data contains thousands of emails...
You should be able to use the pidtagmessagerecipientme extended property https://learn.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtagmessagerecipientme-canonical-property which would give you email where your address is in the To or CC line and then also include a from filter to filter to just email that was sent from a particular address eg
https://graph.microsoft.com/v1.0/me/messages?$filter=singleValueExtendedProperties/any(ep:ep/id eq 'Boolean 0x0059' and cast(ep/value, Edm.Boolean) eq true) and from/emailAddress/address eq 'address@dom.com'&$count=true