I wanted to write a class library to watch over an inbox for new mails with a particular subject and download the attachment. The end goal is to publish the library in Azure as a WebJob / API with the ability to use this library to host it on-premise. We are also planning to integrate this with a workflow functionality that we have already developed. I have found the following stuff online but have some limitations with each.
Please help me with the what would be the best approach and if there is a library built in for this which I'm not able to find.
Thanks a lot in advance.
The Microsoft Graph API would be a pretty good place for getting user emails.
Here is the operation you are looking for: https://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/user_list_messages
So you will need to make a request to something like:
https://graph.microsoft.com/v1.0/users/user@company.com/messages
And you can do this with a service principal. You will need the Mail.Read app-only permission (Read mail in all mailboxes). This will require you to be an Azure AD admin to consent. You can find details on the permission scopes here: https://graph.microsoft.io/en-us/docs/authorization/permission_scopes .
Oh, and there are SDKs so you don't need to write all the stuff yourself: https://graph.microsoft.io/en-us/code-samples-and-sdks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.