2014-07-14 1 views
1

Exchange 2013 SP1 및 Exchange Web Services managed API 2.2를 사용하여 공용 폴더에 저장 한 연락처 폴더의 연락처 목록을 얻으려고 시도합니다. ItemView의 크기를이 연락처 폴더에있는 총 연락처 수로 제한하고 싶습니다.하지만이 속성 (contactfolder.TotalCount)을 반환하려고 시도하면 항상 0을 반환합니다. 내 사서함의 연락처 폴더가 0이 아닌 값이 반환됩니다. ItemView의 생성자 값을 특정 숫자로 지정하거나 int.MaxValue를 사용하여이 문제를 해결할 수 있지만 연락처 목록에있는 총 항목 수를 사용하고 싶습니다. 어떤 도움이라도 대단히 감사합니다!공용 폴더의 TotalCount 속성이 항상 0 개 항목을 반환하는 이유는 무엇입니까?

private FindItemsResults<Microsoft.Exchange.WebServices.Data.Item> ExchangeContacts() 
    { 
     // Setup the exchange server connection. 
     ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1); 
     service.AutodiscoverUrl("[email protected]"); 

     // Set the filter to choose the correct contact list 
     SearchFilter filter = new SearchFilter.IsEqualTo(FolderSchema.DisplayName, "My Public Contacts"); 
     SearchFilter.SearchFilterCollection filterCollection = new SearchFilter.SearchFilterCollection(); 
     filterCollection.Add(filter);   


     // Get the FolderId using the search filter. 
     Folder parent = Folder.Bind(service, WellKnownFolderName.PublicFoldersRoot); 
     FindFoldersResults results = parent.FindFolders(filter, new FolderView(1)); 
     FolderId fid = results.Single().Id; 

     // Get the Contact folder based on the folderid. 
     ContactsFolder contactsfolder = (ContactsFolder)results.Single();    
     ItemView view = new ItemView(contactsfolder.TotalCount); 

     // Set the property that need to be shown in the page. 
     view.PropertySet = new PropertySet(BasePropertySet.IdOnly, ContactSchema.DisplayName, ContactSchema.CompanyName, ContactSchema.LastModifiedTime, ContactSchema.BusinessAddressCity, ContactSchema.BusinessAddressPostalCode, ContactSchema.BusinessAddressState, ContactSchema.BusinessAddressStreet, ContactSchema.HomeAddressCity, ContactSchema.HomeAddressPostalCode, ContactSchema.HomeAddressState, ContactSchema.HomeAddressStreet, ContactSchema.ItemClass, ContactSchema.FileAs, ContactSchema.LastModifiedName); 
     //view.PropertySet = new PropertySet(BasePropertySet.IdOnly, ContactSchema.DisplayName); 

     // Order the results by one of the selected properties 
     //view.OrderBy.Add(ContactSchema.LastModifiedTime, Microsoft.Exchange.WebServices.Data.SortDirection.Descending);   

     FindItemsResults<Microsoft.Exchange.WebServices.Data.Item> contactItems = contactsfolder.FindItems(view); 

     return contactItems; 
    } 

답변

5

공개 폴더 루트 바로 아래에서 공용 폴더를 다시 만들고 공용 폴더를 추가 한 다음 코드를 실행하여 contactItems.TotalCount 값을 1 (예상대로)로 가져옵니다. 그러나 Exchange 제품 팀과 논의한 후 FindFolder 요청이 공용 폴더의 콘텐츠가없는 공용 폴더 사서함으로 라우팅되는 경우 FindFolder가 잘못된 값을 반환 할 수 있음을 알았습니다. 따라서 TotalCount는 잘못된 값을 반환 할 수 있으며 공용 폴더에서는 지원되지 않습니다. 이 문제를 반영하여 설명서가 업데이트됩니다.

2

FindFolder operation (Exchange 2013) : 다음은 관련 코드입니다

BaseShape에 대한 기본 값을 사용하여이 응답은 폴더 이름, 폴더 ID, 하위 폴더의 수, 의 수를 반환 폴더에서 발견 된 하위 폴더 및 읽지 않은 항목의 수입니다. AllProperties 함께 요청

<

...>

FindFolder 응답은 형상이 TOTALCOUNT 및 공용 폴더 검색에 대한 읽지 요소를 반환은 응답하지 않을 것이다.

검색 조건에 속성 필터를 지정해야합니다.

관련 문제