I'm creating a C# .Net Core 2.0 console application to read a specific user's email. I successfully got this sample console application working. So authentication is working. I added permissions to Read all User's email. I looked at the API docs and I can't see examples of reading a user's email. Plenty of send examples. Any help appreciated.
Thanks for posting. I got this to work if I comment out the Filter:
GraphServiceClient client = GetAuthenticatedClient();
string subject = "RE: ACTION NEEDED:";
string dt = "2018-10-5T00:00:00";
IUserMessagesCollectionPage msgs = client.Users["[email protected]"].Messages.Request()
//.Filter($"receivedDateTime ge '{dt}'") // Invalid filter
.Filter($"startswith(subject, '{subject}') and receivedDateTime gt {dt}")
.Select(m => new { m.Subject, m.ReceivedDateTime, m.From, m.Body })
.Top(100)
.GetAsync().Result;
int msgCnt = msgs.Count;
I posted something about getting filter to work. startswith works but the date filter fails.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With