Table of contents
- Introduction
- Prerequisites
- Register and configure the app
- Build and debug
- NuGet packages used in the sample
- Questions and comments
- Additional resources
The Office 365 Profile sample for Windows uses the Office 365 unified endpoint (preview) to get user profile data from various services such as Active Directory, SharePoint, and OneDrive.
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 email address, hire date, manager, and direct reports, comes from the unified endpoint.
This sample requires the following:
- Visual Studio 2013 with Update 4.
- An Office 365 account. You can sign up for an Office 365 Developer subscription that includes the resources that you need to start building Office 365 apps.
- A Microsoft Azure tenant to register your application. Azure Active Directory provides identity services that applications use for authentication and authorization. A trial subscription can be acquired here: Microsoft Azure.
Important: You will also need to ensure your Azure subscription is bound to your Office 365 tenant. To do this see the Active Directory team's blog post, Creating and Managing Multiple Windows Azure Active Directories. In this post, the Adding a new directory section will explain how to do this. You can also read Set up your Office 365 development environment for more information.
##Register and configure the app
- Sign in to the Azure Management Portal, using your Azure AD credentials.
- Click Active Directory on the left menu, then select the directory for your Office 365 developer site.
- On the top menu, click Applications.
- Click Add from the bottom menu.
- On the What do you want to do page, click Add an application my organization is developing.
- On the Tell us about your application page, specify O365-Win-Profile for the application name and select NATIVE CLIENT APPLICATION for type.
- Click the arrow icon on the bottom-right corner of the page.
- On the Application information page, specify a Redirect URI, for this example, you can specify http://localhost/profileSample, and then select the checkbox in the lower-right hand corner of the page. Remember this value for the following Build and debug section.
- Once the application has been successfully added, you will be taken to the Quick Start page for the application. From here, select Configure in the top menu.
- Under permissions to other applications, select Add application. In the dialog box, select the Office 365 unified API (preview) application. After you return to the application configuration page, select the Read items in all site collections, Read users' files, and Access directory as the signed in user permissions.
- Copy the value specified for Client ID on the Configure page, and be sure to remember the value you specified for the redirect URI.
- Click Save in the bottom menu.
Note: If you see any errors while installing packages during step 3 (for example, Unable to find "Microsoft.IdentityModel.Clients.ActiveDirectory") make sure the local path where you placed the solution is not too long/deep. Moving the solution closer to the root of your drive resolves this issue.
-
After you've loaded the solution in Visual Studio, configure the sample to use the client id that you registered in Azure Active directory by adding the following key and its corresponding value to the Application.Resources node of the App.xaml file. `
-
Open the AuthenticationHelper.cs file and set your redirect URI as the value of this variable. `
-
Press F5 to build and debug. Run the solution and sign in with your organizational account to Office 365.
The NuGet packages used in this sample will load automatically when you build the solution. If you want to create an app that uses the unified endpoint, be sure to install the following packages:
- Microsoft.IdentityModel.Clients.ActiveDirectory v.2.14
- Office 365 unified API client library (preview)
- Microsoft.OData.ProxyExtensions v1.0.30
- If you have any trouble running this sample, please log an issue.
- For more general feedback, send and email to docthis@microsoft.com.
- Office 365 profile sample for Android
- Office 365 profile sample for iOS
- Office 365 unified API overview (preview)
- Office 365 APIs platform overview
- Office 365 API code samples and videos
- Office developer code samples
- Office dev center
- Connecting to Office 365 in Windows Store, Phone, and universal apps
- Office 365 Code Snippets for Windows
- Office 365 Starter Project for Windows Store App
- Office 365 REST API Explorer for Sites
Copyright (c) 2015 Microsoft. All rights reserved.