2013-10-23 83 views

回答

0

您可以使用ExchangeService的「createItems()」方法,傳遞你想創建

0

這是我做的一個聯繫人列表。

Collection<Item> items = new ArrayList<Item>(); 
try 
    { 
     for (ContactDTO contactDTO : contactDTOList) { 



      Contact contact= new Contact(service); 


      contact.setFileAs(contactDTO.getFirstName()+" FileAs"); 
      contact.setBusinessHomePage(contactDTO.getHomePageUrl()); 

      contact.setGivenName(contactDTO.getFirstName()); 
      contact.setSurname(contactDTO.getLastName()); 
      contact.setJobTitle(contactDTO.getTitle()); 
      contact.getEmailAddresses().setEmailAddress(EmailAddressKey.EmailAddress1, new EmailAddress(contactDTO.getEmailId())); 
      contact.getPhoneNumbers().setPhoneNumber(PhoneNumberKey.MobilePhone, contactDTO.getMobile()); 

      contact.getPhoneNumbers().setPhoneNumber(PhoneNumberKey.BusinessPhone, contactDTO.getOfficePhoneNumber()); 

      items.add(contact); 

     } 
     MessageDisposition messageDispositon = MessageDisposition.SaveOnly ; 
     SendInvitationsMode sendInvitationMode = SendInvitationsMode.SendToNone; 
     service.createItems(items,FolderId.getFolderIdFromWellKnownFolderName(WellKnownFolderName.Contacts), messageDispositon, sendInvitationMode); 
相關問題