2013-10-28 3 views
0

연락처 그룹을 만들었으며 EWS에서 수신자로 연락처 그룹의 이름을 보내면 "하나 이상의 수신자가 유효하지 않습니다."라는 예외가 발생합니다..Net EWS가 ContactsGroup에 메일을 보냅니다.

나는 대답을 찾고 있었고 거기에는 EWS 접촉 그룹 사용에 대한 많은 정보가 없다.

실마리가 있습니까?

답변

1

나는 약간의 조사를했고 나의 대답을 발견했다. 여기에 필요한 솔루션입니다.

 
//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; 
    } 
} 
관련 문제