2016-04-07 10 views
0

Ich verwende die EWS-API für den Zugriff auf Kontakte, , kann aber nicht auf Kontakttelefonnummern zugreifen!Zugriff auf Telefonnummern nicht möglich

Es sieht aus, dass ContactSchema.PhoneNumbers nicht in Initiale in der view.Property akzeptiert holen

Zur Zeit habe ich:

 ItemView view = new ItemView(numItems); 

     view.PropertySet = new PropertySet(BasePropertySet.IdOnly, new PropertyDefinitionBase[] { ContactSchema.DisplayName}); 

     PropertySet PropSet = new PropertySet(); 
     PropSet.Add(ContactSchema.DisplayName); 
     PropSet.Add(ContactSchema.PhoneNumbers); 


     FindItemsResults<Item> findResults; 

     do 
     { 
      findResults = service.FindItems(WellKnownFolderName.Contacts, view); 

      if (findResults.Items.Count > 0) 
      { 
       service.LoadPropertiesForItems(findResults.Items, PropSet); 
       foreach (var item in findResults.Items) 
       { 
        // Display the list of contacts. 
        if (item is Contact) 
        { 
         Contact contact = item as Contact; 
         PhoneNumberDictionary ph = contact.PhoneNumbers; 
         // ph is empty here! 
        } 
       } 
      } 
      view.Offset += findResults.Items.Count; 
     } while (findResults.MoreAvailable); 

Antwort

1

Sie sind es fast nur jede Art Telefonnummer Buddy hinzufügen Sie möchten lese/schreibe in die Unterkunft und du hast es bekommen !!!

Private ReadOnly PhoneFields As PropertySet = New PropertySet(ContactSchema.PhoneNumbers, ContactSchema.MobilePhone, ContactSchema.CarPhone, ContactSchema.HomePhone, 
                    ContactSchema.HomePhone2, ContactSchema.HomePhone2, ContactSchema.BusinessPhone, ContactSchema.BusinessPhone2, 
                    ContactSchema.BusinessFax, ContactSchema.OtherFax, ContactSchema.HomeFax, ContactSchema.Pager, 
                    ContactSchema.OtherTelephone, ContactSchema.Callback, ContactSchema.CompanyMainPhone, ContactSchema.PrimaryPhone, 
                    ContactSchema.AssistantPhone, ContactSchema.RadioPhone, ContactSchema.TtyTddPhone, ContactSchema.Telex) 

usw. usw.

ich nur eine Kontaktsynchronisierung Windows-Dienst aufgebaut irgendwelche Fragen stellen mich twittet @rojobo

+0

Ja, löst das Problem: beide .PhoneNumbers und jede Telefonnummer Typ erforderlich wenn ich einen Kontakt erhalte – Ljudevit

+0

Ich bin froh, dass ich helfen konnte, weitere Fragen lassen Sie mich wissen, ich weiß es schwer mit dem Mangel an Dokumentation. – rojobo