Closed morphine9 closed 7 years ago
Seems it works for beta !
any progress on this, I also need profile photo?
Thank you
@kristijanexads -- /photo/$value
should be live in v1
and should be supported by the client library
@iambmelt maybe I'm doing something wrong but I'm still receiving following error:
I/System.out: [This is an unexpected error from Graph, please report this at https://github.com/microsoftgraph/msgraph-sdk-android/issues]
I/System.out: GET https://graph.microsoft.com/v1.0/me/photo/$value
I/System.out: SdkVersion : graph-android-v1.2.0
I/System.out: Authorization : bearer EwA4A8l6BAAU7p9QDpi/D7xJLwsTgCg3TskyTaQAAedwQvLhrGUP/R0+3ISAuTOxWZScBBOKGR4MHnWFwx4wwrGbvTgCo7eiJTC0dyR4mRIfka1JeJAaji5+1/yjuA3TdQbyr0UpyBP/6NnuON4LMJyIemMMScfTh/ZO5JE+tX79+pkN2ne5qvD+5q185xRYLvpQqcMRI62yW/2oqYsFOS6eTnrJ9Sct0UHhoz45/G2xoAh5nRtrjgPHtuxNRkWphSHYumAIbVgs+hCxzAMHgb6QnnbGr6rCZIcBe05LIWVkaWx7gpXgu5E9F0SwOBT92UTCuzbNQmu7/PP5PRYz1pMbRgPVUVOX0MYgmxp8dugMsO2N75MVneqIk2fdFDgDZgAACGvL9cvP83D2CAKSba4XRkX89HUwu8BXG5K8lY46UXZFlpq4JHuriQjF3WEhMwNERuSye4BExi7a0nGB/DvYzXhXJtf2NwiiT9n8FE6sb6pG9bHpl+LUl/CqB4uzG787uiV5kfIV4vHO1V+FT4i+mVsFDVb4ns4LVsBgH8smJ0CEyJ9HMjVQL8mKojlK0Y28xLS5WZs+kASuhdcYFEZBMSTwbzYtnLkpu47rTOaWykFv/hC3g29tSDPT58eAUW/FoGyc9gvg7NR1Jo4TGI31Dl+6eTnIo4MMo5pMYmcmT1xXhyoWmEGRknOSUFqH6e+c1eYQm6wEbOmymYeNVttfP7QlNf3LhpOsA1/J6u6173wocWw417zZK5adFzWQb9IKxYVGGWZ8Yc1a2V6gwtZyPV5F5CvSPZX9w5+X1fDm7s4M9pyqV920X7BNr1dXwxPVj9x+oS1MHwQQPezSBRVrUsVAAZ8Yxli01DMvhtsjnN7CMD4lCrMObbIXG0TErBnCiL1pSmf5Yu+rFHgAuvltijbb9f8rNzMjuux3mRAmuTmtLM3QfS9yJWS1USMLpPIc/MNV3X0LA7UGRrMiPYiyi91NO1RwoeZsdZJkabdbMabUSVlRkuiSvLO8qLx3zwg/31zcalJBcfyQD566PQuUgV8e/DzGRVP5avotZ6LGAvsjlTU4i6LCmvE4vXuR2gCeLUo9NwI=
I/System.out: 501 : Not Implemented
I/System.out: Duration : 247.7164
I/System.out: Cache-Control : private
I/System.out: X-Android-Sent-Millis : 1487149922106
I/System.out: Content-Type : application/json
I/System.out: x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"North Europe","Slice":"SliceA","ScaleUnit":"001","Host":"AGSFE_IN_1","ADSiteName":"DUB"}}
I/System.out: request-id : 78bfd90c-3202-46d0-a224-92d7249cfb99
I/System.out: X-Android-Selected-Protocol : http/1.1
I/System.out: Date : Wed, 15 Feb 2017 09:12:00 GMT
I/System.out: Transfer-Encoding : chunked
I/System.out: X-Android-Response-Source : NETWORK 501
I/System.out: client-request-id : 78bfd90c-3202-46d0-a224-92d7249cfb99
I/System.out: X-Android-Received-Millis : 1487149922528
I/System.out: {
I/System.out: "error": {
I/System.out: "code": "GetUserPhoto",
I/System.out: "message": "The operation is not supported.",
I/System.out: "innerError": {
I/System.out: "request-id": "78bfd90c-3202-46d0-a224-92d7249cfb99",
I/System.out: "date": "2017-02-15T09:12:00"
I/System.out: }
I/System.out: }
I/System.out: }
I'm using following:
compile ('com.microsoft.services.msa:msa-auth:0.8.6')
//compile ('com.microsoft.aad:adal:1.11.0') // not needed for now
compile('com.microsoft.graph:msgraph-sdk-android:1.2.+')
compile 'com.microsoft.graph:msa-auth-for-android-adapter:0.9.0'
and making request like this:
mGraphClient.getMe().getPhoto().getContent().buildRequest().get(new ICallback<InputStream>() {
@Override
public void success(final InputStream inputStream) {
System.out.println("success");
}
@Override
public void failure(ClientException ex) {
System.out.println("failure");
System.out.println(ex.getMessage());
}
});
also tried with this:
mGraphClient.getMe().getPhoto().buildRequest().get(new ICallback<ProfilePhoto>() {
@Override
public void success(ProfilePhoto profilePhoto) {
System.out.println(TAG + " success ProfilePhoto profilePhoto");
System.out.println(profilePhoto.getRawObject());
}
@Override
public void failure(ClientException ex) {
System.out.println(TAG + " failure ProfilePhoto profilePhoto");
}
});
}
@kkontus The 501
you are seeing is likely because the currently logged-in User is using an MSA (Microsoft Account) and not a work or school account. Per the Get User Photo documentation, this functionality is currently restricted to work or school accounts only.
@iambmelt you are right, I missed that note in the docs. Are there any plans to make this available later on through MSA account? I'm currently using LiveSDK for this and upload to OneDrive in my Android app. I was thinking of upgrading the app and use msgraph-sdk-android since one-drive-android SDK doesn't support showing logged user profile photo, but now I see that this is not possible with the msgraph either.
Is there any other option available to get logged user account profile photo?
Thank you
@kkontus At a glance, it appears you may be able to get access to this picture data through the Outlook Contacts REST API -- the documentation says that it applies to the following services, although I haven't tested these APIs personally:
Are there any plans to make this available later on through MSA account?
Over time, the MSGraph should gain these features; it's purpose is to act as the single-source of all your Microsoft data stored in the cloud - we're adding new services and functionalities all of the time, and for the most up-to-date public information regarding what's recently been released you can consult our changelog.
@iambmelt thank you once again for your effort on all my questions.
@iambmelt was the user photo added after almost a year later?
Hi @dfloresgonz - Sadly, no -- per the documentation, 'User > Get Photo' is only supported for work or school mailboxes at this time.
My problem solved when I switched to the Beta version.
https://graph.microsoft.com/beta/me/photo/$value
Not sure why photo elements are not returned by photo call
scopes added -