我正在尝试使用EWS获取CC电子邮件地址的列表。我可以看到DisplayCc中有一个值,但是CcRecipients为空。 (请参阅链接图像以查看值。)我在做什么错了?
Dim eItem As EmailMessage = DirectCast(mItem, EmailMessage)
Dim eas As String = eItem.DisplayCc
Dim accRecipients As EmailAddressCollection = eItem.CcRecipients
For Each eccrecipient In accRecipients
Dim ea As String = eccrecipient.ToString
Next
答案 0 :(得分:0)
这是一个DUH!我要做的就是在尝试获取eItem.CcRecipients之前先加载电子邮件。现在我的代码可以正常工作了。
Dim eItem As EmailMessage = DirectCast(mItem, EmailMessage)
**eItem.load**
Dim eas As String = eItem.DisplayCc
Dim accRecipients As EmailAddressCollection = eItem.CcRecipients
For Each eccrecipient In accRecipients
Dim ea As String = eccrecipient.ToString
Next