[DEPRECATED] To see a current sample that demonstrates the concepts explained here, visit https://github.com/microsoftgraph/android-java-snippets-rest-sample
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Office 365 Profile Sample for Android Using Microsoft Graph

Build Status

The first page presents you with a list of users. The second page displays information about any user you choose to view. All of this information, including files shared with the user, the user's alias, hire date, manager, direct reports, and groups comes from Microsoft Graph (previously called Office 365 unified API).

The following image shows the user's page that displays the information mentioned above:

Office 365 Profile sample

Device requirements

To run the Profile sample, your device needs to meet the following requirements:

  • Android API level 14 or later.


To use the Office 365 Profile sample for Android you need the following:

  • Android Studio version 1.0 or later.
  • An Office 365 account. You can join the Office 365 Developer Program and get a free 1 year subscription to Office 365 that includes the resources that you need to start building Office 365 apps. > Note: If you already have a subscription, the previous link sends you to a page that says Sorry, you can’t add that to your current account. In that case use an account from your current Office 365 subscription.
  • A client ID and redirect URI values of an application registered in Microsoft Azure. The application must run the following permissions:
    • Microsoft Graph
      • Read items in all site collections
      • Read all files that user can access
      • Access directory as the signed in user
      • Read all users' basic profiles

You can also add a native client application in Azure and grant proper permissions to it.

Open the sample using Android Studio

  1. Install Android Studio and add the Android SDK packages according to the instructions on developer.android.com.

  2. Download or clone this sample.

  3. Start Android Studio.

    1. Select Open an existing Android Studio project.
    2. Browse to your local repository and select the O365-Android-Profile project. Click OK.
  4. Open the Constants.java file.

    1. Find the CLIENT_ID constant and set its String value equal to the client id you registered in Azure Active Directory.
    2. Find the REDIRECT_URI constant and set its String value equal to the redirect URI you registered in Azure Active Directory. Office 365 Profile sample

    Note: If you don't have CLIENT_ID and REDIRECT_URI values, add a native client application in Azure and take note of the CLIENT_ID and REDIRECT_URI.

Once you've built the Profile sample, you can run it on an emulator or device.

Questions and comments

We'd love to get your feedback on the O365 Android Profile project. You can send your questions and suggestions to us in the Issues section of this repository.

Questions about Office 365 development in general should be posted to Stack Overflow. Make sure that your questions or comments are tagged with [Office365] and [API].

Additional resources


Copyright (c) 2015 Microsoft. All rights reserved.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.