Skip to content

Commit dd0aeb4

Browse files
authored
Merge pull request #2 from unoplatform/Update-readme
Update Readme
2 parents 72a18d2 + 01a8a74 commit dd0aeb4

File tree

1 file changed

+67
-4
lines changed

1 file changed

+67
-4
lines changed

README.md

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,78 @@ This new library replaces the `Microsoft.Toolkit.Uwp.UI.Controls.Graph` package;
77
If you need similar controls for the Web, please use the [Microsoft Graph Toolkit](https://aka.ms/mgt).
88

99
## <a name="supported"></a> Supported SDKs
10-
* TODO: Check 16299
10+
11+
* Windows 10 18362 (🚧 TODO: Check Lower SDKs)
12+
* Android via [Uno.Graph-Controls](https://aka.ms/wgt-uno) use `Uno.Microsoft.Graph.Controls` package.
13+
* 🚧 Coming Soon 🚧
14+
* PeoplePicker control
15+
* XAML Islands Sample
16+
* iOS (Waiting on [MSAL#1378](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/pull/1378) merge should be 4.4.0?)
1117

1218
## <a name="documentation"></a> Getting Started
13-
* TODO
19+
20+
Before using controls that access [Microsoft Graph](https://graph.microsoft.com), you will need to [register your application](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app) to get a **ClientID**.
21+
22+
> After finishing the initial registration page, you will also need to add an additional redirect URI. Clcik on "Add a Redirect URI" and check the `https://login.microsoftonline.com/common/oauth2/nativeclient` checkbox on that page. Then click "Save".
23+
24+
### Android Quick Start
25+
26+
To include the latest preview package in your Visual Studio environment, open your _Package Manager Console_ and type:
27+
28+
```powershell
29+
Install-Package Uno.Microsoft.Toolkit.Graph.Controls -IncludePrerelease
30+
```
31+
32+
Then open your shared `MainPage.xaml.cs` file and add the following initialization in your constructor:
33+
34+
<!-- 🚧 TODO: Can we simplify this pattern somehow in the future? -->
35+
36+
```csharp
37+
var ClientId = "YOUR_CLIENT_ID_HERE";
38+
_ = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
39+
{
40+
ProviderManager.Instance.GlobalProvider = await QuickCreate.CreateMsalProviderAsync(
41+
ClientId,
42+
#if __ANDROID__
43+
$"msal{ClientId}://auth", // Need to change redirectUri on Android for protocol registration from AndroidManifest.xml, ClientId needs to be updated there as well to match above.
44+
#endif
45+
scopes: new string[] { "user.read", "user.readbasic.all", "people.read" });
46+
});
47+
```
48+
49+
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.
50+
51+
Then also update the `data` tag in your **AndroidManifest.xml** file:
52+
53+
```xml
54+
<data android:scheme="msalYOUR_CLIENT_ID_HERE" android:host="auth" />
55+
```
56+
57+
You need this for the protocol redirect after the user authenticates.
58+
59+
**That's all you need to get started!**
60+
61+
You can add any of the controls now to your XAML pages like we've done in our [sample](SampleGraphApp/SampleGraphApp.Shared/MainPage.xaml).
62+
63+
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](https://github.com/microsoftgraph/msgraph-beta-sdk-dotnet) through `ProviderManager.Instance.GlobalProvider.Graph`, just be sure to check if the `GlobalProvider` has been set first and its `State` is `SignedIn`:
64+
65+
```csharp
66+
var provider = ProviderManager.Instance.GlobalProvider;
67+
68+
if (provider != null && provider.State == ProviderState.SignedIn)
69+
{
70+
// Do graph call here with provider.Graph...
71+
}
72+
```
73+
74+
### UWP Quick Start
75+
76+
Visit the [windows-toolkit/graph-controls](https://aka.ms/wgt) repo for instructions on using the library on UWP.
1477

1578
## Build Status
16-
| Target | Branch | Status | Recommended NuGet package |
79+
| Target | Branch | Status | Recommended package version |
1780
| ------ | ------ | ------ | ------ |
18-
| 6.0.0 | master | [![Build Status](https://dev.azure.com/dotnet/WindowsCommunityToolkit/_apis/build/status/windows-toolkit.Graph-Controls?branchName=master)](https://dev.azure.com/dotnet/WindowsCommunityToolkit/_build?definitionId=102&branchName=master) | 6.0.0 |
81+
| Pre-release beta testing | master | [![Build Status](https://uno-platform.visualstudio.com/Uno%20Platform/_apis/build/status/Uno%20Platform/Uno.Graph-Controls?branchName=master)](https://uno-platform.visualstudio.com/Uno%20Platform/_build/latest?definitionId=64&branchName=master) | - |
1982

2083
## Feedback and Requests
2184
Please use [GitHub Issues](https://github.com/windows-toolkit/Graph-Controls/issues) for bug reports and feature requests.

0 commit comments

Comments
 (0)