How to get profile detail Using OneDrive API Android

1k Views Asked by At

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.

1

There are 1 best solutions below

6
Viral Patel On

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.