c# - EWS - Get a user's peers (same manager) -
i'm trying exchange query user's peers, shown in global address list. first thought run query returns users same manager.
finditemtype request = new finditemtype(); distinguishedfolderidtype[] fid = { new distinguishedfolderidtype { id = distinguishedfolderidnametype.contacts } }; request.parentfolderids = fid; request.traversal = itemquerytraversaltype.shallow; itemresponseshapetype props = new itemresponseshapetype(); props.baseshape = defaultshapenamestype.allproperties; request.itemshape = props; // insert restriction "someone@somewhere.com" = contactsmanager finditemresponsetype response = _binding.finditem(request);
unfortunately queries contacts list, not gal. how can correctly?
i cannot query ad (app intended run off of internal network) , don't use ews managed api various other reasons.
any appreciated.
here's example of how access gal using ews exchange 2007 , above; taken here see link valid pointers. code searches gal particular contact.
static void main(string[] args) { exchangeservicebinding esb = new exchangeservicebinding(); esb.url = @"https://myserver/ews/exchange.asmx"; esb.credentials = new networkcredential( "username", @"password", @"domain"); // create resolvenamestype , set // unresolved entry. resolvenamestype rntype = new resolvenamestype(); rntype.returnfullcontactdata = true; rntype.unresolvedentry = "test"; // resolve names. resolvenamesresponsetype resolvenamesresponse = esb.resolvenames(rntype); arrayofresponsemessagestype responses = resolvenamesresponse.responsemessages; // check result. if (responses.items.length > 0 && responses.items[0].responseclass != responseclasstype.error) { resolvenamesresponsemessagetype responsemessage = responses.items[0] resolvenamesresponsemessagetype; // display resolution information. resolutiontype[] resolutions = responsemessage.resolutionset.resolution; foreach (resolutiontype resolution in resolutions) { console.writeline("name: " + resolution.contact.displayname); console.writeline("emailaddress: " + resolution.mailbox.emailaddress); if (resolution.contact.phonenumbers != null) { foreach (phonenumberdictionaryentrytype phone in resolution.contact.phonenumbers) { console.writeline(phone.key.tostring() + " : " + phone.value); } } console.writeline("office location:" + resolution.contact.officelocation); console.writeline("\n"); } } }
Comments
Post a Comment