4

I am using OneDrive compile('com.onedrive.sdk:onedrive-sdk-android:1.0.2') version

and trying to get Profile pic and email detail from IOneDriveClient but not found a way to get this.

  1. Profile Pic
  2. Email

Please help to get these detail.

IshRoid
  • 3,696
  • 2
  • 26
  • 39

1 Answers1

0

You can find the documentation here about Getting user data (Android) using Microsoft Live SDK for OneDrive.

The Live SDK for Android enables your Android app to access a user's info on Microsoft OneDrive.

Microsoft Live SDK Home Page (Android Apps)

Documentation for the Classes available in the API

Sample code from the page for finding owner name:

this.greetUserButton.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
        client.getAsync("USER ID", new LiveOperationListener() {
            public void onComplete(LiveOperation operation) {
                try {
                    JSONObject result = operation.getResult();
                    String name = result.getString("first_name");
                    // Display user's first name.
                } catch (JSONException e) {
                    // Display error if first name is unavailable.
                    return;
                }
            }
            public void onError(LiveOperationException exception, LiveOperation operation) {
                // Display error if operation is unsuccessful.
            }
        });
    }
});

I think if you start digging further from here and exploring the used classes, you'll figure out how to extract the rest of the information you want.

Viral Patel
  • 32,418
  • 18
  • 82
  • 110
  • 1
    I am not getting client.getAsync, in using IOneDriveClient, I think above method is from old API. – IshRoid Jan 07 '16 at 17:28
  • Have you declared `client` as an instance of `LiveConnectClient`? See step three on the page. – Viral Patel Jan 07 '16 at 17:35
  • LiveSDK Last modified: March 10, 2015, After this they release new API, I am using that, please check GitHub, I am looking answer using new API Thanks for your response @Virus – IshRoid Jan 07 '16 at 19:07
  • @IshRoid did you find a way to get profile pic and email? Or at least email and user first and last name? – DoubleK Feb 14 '17 at 11:53
  • @DoubleK No :-( it is possible only if you are using API request, not SDK model class,, i solved it my self by using API instead of using there SDK. worst SDK i ever found :-( – IshRoid Feb 14 '17 at 17:16
  • @IshRoid yes, it's a bit annoying, I started upgrading my app that uses LiveSDK since it says that everyone should move to OneDriveAPI, but the I found that I can't get profile photo and that I should use msGraphAPI, when I implemented that part it throws an error that only beta version supports profile photo. So now I will have to move to REST API :(. – DoubleK Feb 14 '17 at 17:47