c# - Lync InvalidStateException when changing contact relationship -
trying change accesslevel of contacts, never succeeds unless use accesslevel.default. here's i've got currently:
private void beginsearchcallback(iasyncresult r) { object[] asyncstate = (object[])r.asyncstate; contactmanager cm = (contactmanager)asyncstate[0]; try { searchresults results = cm.endsearch(r); if (results.allresults.count == 0) { console.writeline("no results."); } else if (results.allresults.count == 1) { contactsubscription srs = cm.createsubscription(); contact contact = results.contacts[0]; // change relationship contact.beginchangesetting(contactsetting.accesslevel, accesslevel.colleague, setprivacycallback, contact); } else { console.writeline("more 1 result."); } } catch (searchexception se) { console.writeline("search failed: " + se.reason.tostring()); } _client.contactmanager.endsearch(r); }
a microsoft.lync.model.invalidstateexception blank message gets thrown on line invoking beginchangesetting.
any ideas?
edit:
also, i've checked see if contact setting can modified, , it's true.
var canchange = contact.canchangesetting(contactsetting.accesslevel);
Comments
Post a Comment