2013-07-30 76 views
0

我試圖獲得超過1000個聯繫人,而我有超過10000個,而微軟EWS只讓我獲得1000個項目(聯繫人)。 ContactsFolder contactsFolder = ContactsFolder.Bind(this.service,WellKnownFolderName.Contacts,new PropertySet(BasePropertySet.IdOnly,FolderSchema.TotalCount));交換網絡服務器超過1000個項目

  ItemView view = new ItemView(contactsFolder.TotalCount); 

      //ItemView view = new ItemView(1000,0,OffsetBasePoint.Beginning+1); 

      service.TraceEnabled = false; 
      FindItemsResults<Item> fiResults = null; 
      do 
      { 
       fiResults = service.FindItems(WellKnownFolderName.Contacts, view); 
       PropertySet itItemPropSet = new PropertySet(BasePropertySet.IdOnly, 
       ContactSchema.GivenName, 
       ContactSchema.Surname, 
       ContactSchema.AssistantPhone, 
       ContactSchema.BusinessPhone, 
       ContactSchema.BusinessPhone2, 
       ContactSchema.CarPhone, 
       ContactSchema.CompanyMainPhone, 
       ContactSchema.HomePhone, 
       ContactSchema.HomePhone2, 
       ContactSchema.MobilePhone, 
       ContactSchema.OtherTelephone, 
       ContactSchema.Pager, 
       ContactSchema.PrimaryPhone, 
       ContactSchema.CompanyName, 
       ContactSchema.BusinessFax, 
       ContactSchema.Id); 

       view.Offset += fiResults.Items.Count; 
      } while (fiResults.MoreAvailable == true); 

回答