exchangewebservices - How to get user mail picture from exchange Web services -
i’m trying ad user picture through exchange serve web services. when i run code server returns me following error:
the remote server returned error: (401) unauthorized.
credential mail box correctly!
httpwebrequest request = webrequest.create("https://www.contoso.com/ews/exchange.asmx/s/getuserphoto?email=sadie@contoso.com&size=hr240x240";) httpwebrequest; credentialcache cc = new credentialcache(); cc.add( new uri("https://www.contoso.com/ews/exchange.asmx/s/getuserphoto?email=sadie@contoso.com&size=hr240x240";), "ntlm", new networkcredential("domainusername", "mypass")); request.credentials = cc; request.credentials =cc; // submit request. using (httpwebresponse resp = request.getresponse() httpwebresponse) { // take response , save image. bitmap image = new bitmap(resp.getresponsestream()); image.save("sadie.jpg"); }
what if try:
new networkcredential("username", "password", "domain")
and make sure uri correct 1 (not www.contoso.com).
Comments
Post a Comment