c# - Get All Contacts using Lync ContactManager -


I'm currently using the LyncClient.ContactManager.BegginSearch method to search for contacts. However, I have not understood how to get all the contacts I have tried to pass "*" and "%" as wild-card characters but it has not worked yet my function is call.

  _lyncClient.ContactManager.BeginSearch ("*", SearchProviders.GlobalAddressList, SearchFields.DisplayName, SearchOptions.ContactsOnly, 400, Search Callback, "Search Contact");    

Lync is organized into contact groups, so you have to start at the group level . Once you find a group, you can calculate it through its contact

  foreach (_client.ContactManager.Groups in var group) {foreach (different contacts in the group) {MessageBox.Show (contact .Uri); }}   

Good for backgrounds, more advanced features

edit : Specifically, the distribution group's expansion question For, I think the sample is flawed.

Instead of calling BeginExpand and waiting on WaitHandle, provide callback method to expand callback. Therefore, instead:

  asyncOpResult = DGGroup.BeginExpand (empty, zero); AsyncOpResult.AsyncWaitHandle.WaitOne (); DGGroup.EndExpand (asyncOpResult);   

Try this:

  ... asyncOpResult = DGGroup.BeginExpand (extension callback, DG group); ... public zero expansion callback (IAsyncResult AR) {distribution group DGGroup = (distribution group) ar.AsyncState; DGGroup.EndExpand (AR); Etc ...}   

This works perfectly for me.

Comments