0
我創建了一個聯繫人組,並且當我將聯繫人組的名稱作爲EWS中的收件人發送時,它會給出以下異常「一個或多個收件人無效」。.Net EWS將郵件發送到ContactGroup
我一直在尋找答案,並沒有很多的EWS聯繫人組的用法。
任何線索?
我創建了一個聯繫人組,並且當我將聯繫人組的名稱作爲EWS中的收件人發送時,它會給出以下異常「一個或多個收件人無效」。.Net EWS將郵件發送到ContactGroup
我一直在尋找答案,並沒有很多的EWS聯繫人組的用法。
任何線索?
我做了一些研究,找到了我的答案。這是任何需要它的人的解決方案。
//Setup ContactGroup EmailAddress EmailAddress emailAddress = new EmailAddress(); emailAddress.MailboxType = MailboxType.ContactGroup; emailAddress.Id = ItemID; message.ToRecipients.Add(emailAddress); //You can get the ItemID with the following code. // Instantiate the item view with the number of items to retrieve from the Contacts folder. ItemView view = new ItemView(9999); // Request the items in the Contacts folder that have the properties that you selected. FindItemsResults contactItems = ExchangeService.FindItems(WellKnownFolderName.Contacts, view); // Loop through all contacts foreach (Item item in contactItems) { //Check to see if ContactGroup if (item is ContactGroup) { //Get the contact group ContactGroup contactGroup = item as ContactGroup; } }