Set of Helpers and Controls for Windows development using the Microsoft Graph.
Перейти к файлу
Michael Hawker MSFT (XAML Llama) daa1072b9b
Update version.json for 7.0.0-preview4
2020-11-17 16:50:38 -08:00
.github Changes from master to main for WCT-Graph-Controls; there are still more changes to make for links to Azure Devops and MGT 2020-07-10 11:24:17 -07:00
Microsoft.Toolkit.Graph Update NuGet versions and move to 7.0.0-preview4 2020-11-17 14:50:01 -08:00
Microsoft.Toolkit.Graph.Controls Forgot update of TargetFramework to Microsoft.Toolkit.Graph.Controls package 2020-11-17 15:06:34 -08:00
Microsoft.Toolkit.Wpf.Graph.Providers Update to netcoreapp3.1 2020-05-17 22:01:59 -07:00
SampleTest Apply XAML Styler 2020-11-17 14:54:49 -08:00
Samples Apply XAML Styler 2020-11-17 14:54:49 -08:00
build Updated Main toolkit dependency to 7.0.0-preview2, updated dependencies in general, and now using the DispatcherQueue. 2020-08-11 13:06:47 -07:00
.editorconfig Initial Core Build Configuration and Info Files 2019-09-12 19:12:28 -07:00
.gitattributes Initial Core Build Configuration and Info Files 2019-09-12 19:12:28 -07:00
.gitignore Initial Core Build Configuration and Info Files 2019-09-12 19:12:28 -07:00
Directory.Build.props Update NuGet versions and move to 7.0.0-preview4 2020-11-17 14:50:01 -08:00
Directory.Build.targets Initial Core Build Configuration and Info Files 2019-09-12 19:12:28 -07:00
LICENSE.md Initial Core Build Configuration and Info Files 2019-09-12 19:12:28 -07:00
README.md Remove note on old issue. 2020-08-12 17:33:54 -07:00
Toolkit.ruleset Initial Core Build Configuration and Info Files 2019-09-12 19:12:28 -07:00
Windows-Toolkit-Graph-Controls.sln Exclude Sample Apps from CI Build 2019-10-24 21:52:35 -07:00
azure-pipelines.yml Changes from master to main for WCT-Graph-Controls; there are still more changes to make for links to Azure Devops and MGT 2020-07-10 11:24:17 -07:00
global.json Updated Main toolkit dependency to 7.0.0-preview2, updated dependencies in general, and now using the DispatcherQueue. 2020-08-11 13:06:47 -07:00
nuget.config Remove Singleton and reference preview one from MyGet in Microsoft.Toolkit 2019-09-13 16:34:31 -07:00
settings.xamlstyler Initial Core Build Configuration and Info Files 2019-09-12 19:12:28 -07:00
stylecop.json Initial Core Build Configuration and Info Files 2019-09-12 19:12:28 -07:00
toolkit.public.snk Initial Core Build Configuration and Info Files 2019-09-12 19:12:28 -07:00
toolkit.snk Initial Core Build Configuration and Info Files 2019-09-12 19:12:28 -07:00
version.json Update version.json for 7.0.0-preview4 2020-11-17 16:50:38 -08:00

README.md

Windows Graph Controls

This is a sub-repo for the Windows Community Toolkit focused on Microsoft Graph providing a set of Helpers and Controls for development on Windows 10 with .NET.

This new library replaces the Microsoft.Toolkit.Uwp.UI.Controls.Graph package; however, it is not backwards compatible nor does it provide all the same features at this time.

If you need similar controls for the Web, please use the Microsoft Graph Toolkit.

Supported SDKs

  • UWP Windows 10 18362 (🚧 TODO: Check Lower SDKs for UWP)
  • XAML Islands on .NET Core 3 w/ Windows 10 18362 (See Sample)
  • LoginButton & PersonView on Android via Uno.Graph-Controls use Uno.Microsoft.Graph.Controls package. (🚧 PeoplePicker soon!)
  • 🚧 Coming Soon 🚧
    • iOS (Waiting on MSAL#1378 merge should be 4.4.0?)

Getting Started

Before using controls that access Microsoft Graph, you will need to register your application to get a ClientID.

After finishing the initial registration page, you will also need to add an additional redirect URI. Click on "Add a Redirect URI", then "Add a platform", and then on "Mobile and desktop applications". Check the https://login.microsoftonline.com/common/oauth2/nativeclient checkbox on that page. Then click "Configure".

UWP Quick Start

Use the following command on the Package Manager Console to install the NuGet to your project:

Install-Package Microsoft.Toolkit.Graph.Controls -IncludePrerelease

Then open your MainPage.xaml file and add the following behavior:

<Page
    ...
    xmlns:Interactivity="using:Microsoft.Xaml.Interactivity"
    xmlns:providers="using:Microsoft.Toolkit.Graph.Providers">
    <Interactivity:Interaction.Behaviors>
        <providers:InteractiveProviderBehavior ClientId="YOUR_CLIENT_ID_HERE" Scopes="User.Read,User.ReadBasic.All,People.Read"/>
    </Interactivity:Interaction.Behaviors>
</Page>

You can also use the <providers:MockProviderBehavior/> instead to provide some test data.

You can use the Scopes property to preemptively request permissions from the user of your app for data your app needs to access from Microsoft Graph.

You only need the main/first page of your app to load use the provider behavior. This will initialize the graph provider for your entire application.

That's all you need to get started!

You can add any of the controls now to your XAML pages like we've done in our sample.

You can use the ProviderManager.Instance to listen to changes in authentication status with the ProviderUpdated event or get direct access to the .NET Graph Beta API through ProviderManager.Instance.GlobalProvider.Graph, just be sure to check if the GlobalProvider has been set first and its State is SignedIn:

var provider = ProviderManager.Instance.GlobalProvider;

if (provider != null && provider.State == ProviderState.SignedIn)
{
    // Do graph call here with provider.Graph...
}

Android Quick Start

Visit the Uno.Graph-Controls repo for instructions on using the library with Uno on Android.

Build Status

Target Branch Status Recommended package version
Pre-release beta testing master Build Status MyGet

Feedback and Requests

Please use GitHub Issues for bug reports and feature requests.

Principles

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information see the .NET Foundation Code of Conduct.

.NET Foundation

This project is supported by the .NET Foundation.