java - REST client sample to update thumbnail Photo using Azure AD Graph api? -


i looking sample rest client can update user thumbnailphoto using azure ad graph api? rest client there , works https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/users-operations#getuserthumbnailphoto

i tried sample java rest client received 405 - method not allowed:

 public void updateuserphotograph(modelmap model) throws ioexception {          //https://graph.windows.net/{tenant}/users/{user}/thumbnailphoto?api-version=1.6         uricomponents uricomponents = getphotouri();         string bearertoken = getbearertoken();          try {              httpclient httpclient = httpclients.createdefault();             byte[] bytesencoded = base64.encode(extractbytes());              uribuilder builder = new uribuilder(uricomponents.tostring());             uri uri = builder.build();             httppost request = new httppost(uri);             request.setheader(httpheaders.authorization, "bearer " + bearertoken);             request.setheader(httpheaders.content_type, mediatype.application_octet_stream);             request.setentity(new bytearrayentity(bytesencoded));              httpresponse response = httpclient.execute(request);             httpentity entity = response.getentity();             if (entity != null) {                 system.out.println(entityutils.tostring(entity));             }         } catch (exception e) {             system.out.println(e.getmessage());         }     } 

** changed above sent patch request well, got same error.

anyone used api update thumnailphoto?
can use [https://graph.windows.net/{tenant}/users/{user}/thumbnailphoto?api-version=1.6] update/set thumbnail photo?

what the right api that?

when looking this document, find "thumbnailphoto" property stream type , use patch , may try use below api update property :

 https://graph.windows.net/{tenant}/directoryobjects/{user}/microsoft.directoryservices.user/thumbnailphoto?api-version=1.5 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -