使用 Microsoft Graph 从 Office 365 邮箱中获取退回的电子邮件电子邮件、邮箱、Graph、Microsoft

2023-09-06 17:59:38 作者:早已删除你ら

我有一个 SSIS 包,它使用 Outlook 自动发现 (Microsoft.Exchange.WebServices.dll) 从邮箱中提取未读电子邮件.我们的组织现在已经迁移到 Office 365,现在一切都在云上.我现在正在重写我的包以使用 Microsoft Graph.

I had a SSIS package that was fetching unread emails from a mailbox using Outlook Autodiscovery(Microsoft.Exchange.WebServices.dll). Our organization had now moved to Office 365 and everything is on cloud now. I am now rewriting my package to use Microsoft Graph.

我必须获取所有未读退回的电子邮件并对它们采取后续操作.以前,我可以通过检查 ItemClass 来检查退回的电子邮件:

I have to fetch all the unread bounced emails and take subsequent actions on them. Previously, I was able to check for bounced email by checking on the ItemClass:

// Check if its bounced mail
if (message.ItemClass == "REPORT.IPM.Note.NDR")

MS Graph 中是否有任何类似的属性或任何替代方法来获取退回的电子邮件?

Is there any similar property in MS Graph or any alternate approach to get bounced emails?

目前,我为此使用From"属性:

Currently, I am using the "From" attribute for this:

https://graph.microsoft.com/v1.0/me/mailFolders('Inbox')/messages?$search="from:MAILER-DAEMON@mg1.dhs.state.gov"

但我不想依赖发件人电子邮件地址(它可能会改变).更喜欢更健壮的方式.

But I don't want to rely on the from-email-address (it might change). Would prefer a more robust way.

推荐答案

如果要访问 ItemClass 属性,可以通过展开 SingleValueExtendedProperty 来实现:String 0x001A (0x001A001F).

If you want to access ItemClass property, you can do that by expanding SingleValueExtendedProperty: String 0x001A (0x001A001F).

GetMessageWithExtendedProperty