The Office 365 API v2.0 exposes from the Microsoft Graph, so the Microsoft Graph is gateway of information as files of the OneDrive, email, schedule, a task of the Planner and so on.
The gateway also provides authentication as SSO with Azure Active Directory, Facebook, on premise Active Directory, Twitter and so on.
The Intelligent cloud provided Microsoft is not only Microsoft Graph but Microsoft provides many services from Microsoft Azure, although Microsoft Graph accomplishes important roll of the Intelligent cloud.
There is the SDK for using the Intelligent cloud from any client apps created by iOS , Android, UWP, web apps and so on. So the Intelligent edge apps creation is easy with the Visual Studio.
This article explain how to develop client app as the Intelligent edge using Microsoft Graph.
>>Sample solution for Visual Studio 2017
>>Visual Studio 2017 community is free
This web site is concept of the Intelligent Cloud and Intelligent Edge from Microsoft.
>>Microsoft aims to empower every developer for a new era of intelligent cloud and intelligent edge
・SDK
The helper class of the SDK conceals complex process of OAuth v2.0. This article uses UWP sample though, there is many app types samples.
At first, Modify the code of previous article. Import the namespace ‘Microsoft.Graph’ and ‘Microsoft.Identity.Client’ from the NuGet.
The next, import the AuthenticationHelper class, and modify the namespace to name of the project. This sample uses the namespace ‘Microsoft.Graph’.
The AuthenticationHelper class has code below.
static string clientId = App.Current.Resources["ida:ClientID"].ToString();
So the code below should be added to App.xaml.
<Application.Resources> <!-- Add your client id here. --> <x:String x:Key="ida:ClientID">ENTER_YOUR_CLIENT_ID</x:String> <x:String x:Key="ida:ReturnUrl">urn:ietf:wg:oauth:2.0:oob</x:String> </Application.Resources>
The last step is add code below at any place, and Press [F5]. The code put into the Profile.xaml.cs file in the sample code of this article.
var oAuthClient = AuthenticationHelper.GetAuthenticatedClient(); if (oAuthClient != null) { var user = await oAuthClient.Me.Request().GetAsync(); result = user.GivenName; } else { result = "Internal Error when creating OAuth client"; } NotifyUser(result);
・App.xaml
・xaml.cs
No responses yet