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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -