Table of contents
- Introduction
- Prerequisites
- Register and configure the app
- Build and debug
- How the sample affects your tenant data
- How to run the extensions snippets
- Questions and comments
- Additional resources
This sample shows how to use the Microsoft Graph API to send email, manage groups, and perform other activities with Office 365 data. Microsoft Graph exposes multiple APIs from Microsoft cloud services through a single REST API endpoint. This repository shows you how to access multiple resources, including Microsoft Azure Active Directory (AD) and the Office 365 APIs, by making HTTP requests to the Microsoft Graph API in a Windows 10 universal app.
In addition, the sample uses the Microsoft Authentication Library (MSAL) for authentication. The MSAL SDK provides features for working with the Azure AD v2.0 endpoint, which enables developers to write a single code flow that handles authentication for both work or school (Azure Active Directory) and personal (Microsoft) accounts.
This library is suitable for use in a production environment. We provide the same production level support for this library as we do our current production libraries. During the preview we may make changes to the API, internal cache format, and other mechanisms of this library, which you will be required to take along with bug fixes or feature improvements. This may impact your application. For instance, a change to the cache format may impact your users, such as requiring them to sign in again. An API change may require you to update your code. When we provide the General Availability release we will require you to update to the General Availability version within six months, as applications written using a preview version of library may no longer work.
Note: This sample does not always clean up the created objects in your mailbox and calendar. At this time you'll have to manually remove sample mails and calendar events. You can also use a test account.
This sample requires the following:
- Visual Studio 2015
- Windows 10 (development mode enabled)
- Either a Microsoft or Office 365 for business account.
-
Sign into the App Registration Portal using either your personal or work or school account.
-
Select Add an app.
-
Enter a name for the app, and select Create application.
The registration page displays, listing the properties of your app.
-
Under Platforms, select Add platform.
-
Select Native Application.
-
Copy both the Client Id (App Id) and Redirect URI values to the clipboard. You'll need to enter these values into the sample app.
The app id is a unique identifier for your app. The redirect URI is a unique URI provided by Windows 10 for each application to ensure that messages sent to that URI are only sent to that application.
-
Select Save.
Note: If you see any errors while installing packages during step 2, 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 and redirectURI that you registered by adding the corresponding values for these keys in the Application.Resources node of the App.xaml file. `
-
Press F5 to build and debug. Run the solution and sign in with either your personal or work or school account.
##How the sample affects your tenant data This sample runs REST commands that create, read, update, or delete data. When running commands that delete or edit data, the sample creates fake entities. The fake entities are deleted or edited so that your actual tenant data is unaffected. The sample will leave behind fake entities on your tenant.
##How to run the extensions snippets This sample contains snippets that show you how to work with custom extensions. This feature is currently in preview.
These snippets require the admin-only AccessAsUser.All scope, so in order to run them you'll need to uncomment that scope string in the AuthenticationHelper.cs
file.
Additionally, these snippets will run only on a tenant that has a verified domain. You specify the name of this domain by making it the value of the domainName
string in the ExtensionSnippets.cs
file:
const string domainName = "your verified domain";
If you'd like to contribute to this sample, see CONTRIBUTING.MD.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
We'd love to get your feedback about the O365 UWP Microsoft Graph Snippets project. You can send your questions and suggestions to us in the Issues section of this repository.
Your feedback is important to us. Connect with us on Stack Overflow. Tag your questions with [MicrosoftGraph] and [office365].
- Other Office 365 Connect samples
- Microsoft Graph overview
- Office 365 APIs platform overview
- Office 365 API code samples and videos
- Office developer code samples
- Office dev center
Copyright (c) 2017 Microsoft. All rights reserved.