Skip to content

Commit 283fa6d

Browse files
Merge pull request #273 from MicrosoftDocs/mhawker/graph-docs
Add new Graph Control Preview Docs
2 parents 6e3ca29 + 698437f commit 283fa6d

File tree

15 files changed

+772
-508
lines changed

15 files changed

+772
-508
lines changed
Lines changed: 84 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,84 @@
1-
---
2-
title: AadLogin Control
3-
author: OGcanviz
4-
description: The AadLogin Control leverages existing .NET login libraries to support basic AAD sign-in processes for Microsoft Graph.
5-
keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, AadLogin Control
6-
---
7-
8-
# AadLogin Control
9-
10-
The [AadLogin Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.graph.aadlogin) leverages existing .NET login libraries to support basic AAD sign-in processes for Microsoft Graph, it relies on the [MicrosoftGraphService](../services/MicrosoftGraph.md) for authentication.
11-
12-
> [!div class="nextstepaction"]
13-
> [Try it in the sample app](uwpct://Controls?sample=AadLogin)
14-
15-
## Syntax
16-
17-
```xaml
18-
<Page ...
19-
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls.Graph"/>
20-
21-
<controls:AadLogin x:Name="AADLogin1"
22-
View="PictureOnly"
23-
AllowSignInAsDifferentUser="True" />
24-
```
25-
26-
## Example Image
27-
28-
![AadLogin animation](../resources/images/Graph/AadLogin.png)
29-
30-
## Properties
31-
32-
| Property | Type | Description |
33-
| -- | -- | -- |
34-
| RequiredDelegatedPermissions | String[] | Gets required delegated permissions for Graph API access |
35-
| DefaultImage | BitmapImage | The default image displayed when no user is signed in |
36-
| View | [ViewType](https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/ProfileCard/ViewType.cs) | The visual layout of the control. Default is `PictureOnly` |
37-
| AllowSignInAsDifferentUser | Boolean | Whether or not the menu item for `Sign in as a different user` is enabled, default value is true |
38-
| SignInDefaultText | String | Default text for sign in button |
39-
| SignOutDefaultText | String | Default text for sign out button |
40-
| SignInAnotherUserDefaultText | String | Default text for `Sign in with another account` button |
41-
| CurrentUserId | String | Gets the unique identifier for current signed in user |
42-
43-
## Methods
44-
45-
| Method | Return Type | Description |
46-
| -- | -- | -- |
47-
| SignInAsync | bool | Method to call when to trigger the user signin. UX of the control is updated if successful. Returns false if the user cancels sign in |
48-
| SignOut | void | Method to call to signout the currently signed on user |
49-
50-
## Events
51-
52-
| Method | Type | Description |
53-
| -- | -- | -- |
54-
| SignInCompleted | EventHandler&lt;SignInEventArgs&gt; | Occurs when a user signs in |
55-
| SignInFailed | EventHandler&lt;SignInFailedEventArgs&gt; | Obsolete. Occurs when sign in failed when attempting to sign in. Only fires when an exception occurs during the sign in process and not when the user cancels sign in. |
56-
| SignOutCompleted | EventHandler | Occurs when the user clicks on SignOut, or the SignOut() method is called. Developers should clear any cached usage of GraphServiceClient objects they receive this event |
57-
58-
## Sample Code
59-
60-
First of all, initialize the [MicrosoftGraphService](../services/MicrosoftGraph.md) with your [Azure AD v2.0 app](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-app-registration), this should be done globally with the combined and unique [delegate permissions](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-scopes) required by all Graph controls and services used in your app.
61-
62-
```c#
63-
MicrosoftGraphService.Instance.AuthenticationModel = MicrosoftGraphEnums.AuthenticationModel.V2;
64-
65-
MicrosoftGraphService.Instance.Initialize(
66-
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
67-
MicrosoftGraphEnums.ServicesToInitialize.UserProfile,
68-
AadLogin.RequiredDelegatedPermissions
69-
);
70-
```
71-
72-
[AadLogin Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/AadLogin). You can [see this in action](uwpct://Controls?sample=AadLogin) in the [Windows Community Toolkit Sample App](http://aka.ms/uwptoolkitapp).
73-
74-
## Default Template
75-
76-
[AadLogin XAML File](https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/AadLogin/AadLogin.xaml) is the XAML template used in the toolkit for the default styling.
77-
78-
## Requirements
79-
80-
| Device family | Universal, 10.0.16299.0 or higher |
81-
| -- | -- |
82-
| Namespace | Microsoft.Toolkit.Uwp.UI.Controls.Graph |
83-
| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls.Graph](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls.Graph/) |
84-
85-
## API
86-
87-
* [AadLogin source code](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/AadLogin)
1+
---
2+
title: AadLogin Control
3+
author: OGcanviz
4+
description: The AadLogin Control leverages existing .NET login libraries to support basic AAD sign-in processes for Microsoft Graph.
5+
keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, AadLogin Control
6+
---
7+
8+
# AadLogin Control
9+
10+
The [AadLogin Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.graph.aadlogin) leverages existing .NET login libraries to support basic AAD sign-in processes for Microsoft Graph, it relies on the [MicrosoftGraphService](../../services/MicrosoftGraph.md) for authentication.
11+
12+
## Syntax
13+
14+
```xaml
15+
<Page ...
16+
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls.Graph"/>
17+
18+
<controls:AadLogin x:Name="AADLogin1"
19+
View="PictureOnly"
20+
AllowSignInAsDifferentUser="True" />
21+
```
22+
23+
## Example Image
24+
25+
![AadLogin animation](../../resources/images/Graph/AadLogin.png)
26+
27+
## Properties
28+
29+
| Property | Type | Description |
30+
| -- | -- | -- |
31+
| RequiredDelegatedPermissions | String[] | Gets required delegated permissions for Graph API access |
32+
| DefaultImage | BitmapImage | The default image displayed when no user is signed in |
33+
| View | [ViewType](https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/ProfileCard/ViewType.cs) | The visual layout of the control. Default is `PictureOnly` |
34+
| AllowSignInAsDifferentUser | Boolean | Whether or not the menu item for `Sign in as a different user` is enabled, default value is true |
35+
| SignInDefaultText | String | Default text for sign in button |
36+
| SignOutDefaultText | String | Default text for sign out button |
37+
| SignInAnotherUserDefaultText | String | Default text for `Sign in with another account` button |
38+
| CurrentUserId | String | Gets the unique identifier for current signed in user |
39+
40+
## Methods
41+
42+
| Method | Return Type | Description |
43+
| -- | -- | -- |
44+
| SignInAsync | bool | Method to call when to trigger the user signin. UX of the control is updated if successful. Returns false if the user cancels sign in |
45+
| SignOut | void | Method to call to signout the currently signed on user |
46+
47+
## Events
48+
49+
| Method | Type | Description |
50+
| -- | -- | -- |
51+
| SignInCompleted | EventHandler&lt;SignInEventArgs&gt; | Occurs when a user signs in |
52+
| SignInFailed | EventHandler&lt;SignInFailedEventArgs&gt; | Obsolete. Occurs when sign in failed when attempting to sign in. Only fires when an exception occurs during the sign in process and not when the user cancels sign in. |
53+
| SignOutCompleted | EventHandler | Occurs when the user clicks on SignOut, or the SignOut() method is called. Developers should clear any cached usage of GraphServiceClient objects they receive this event |
54+
55+
## Sample Code
56+
57+
First of all, initialize the [MicrosoftGraphService](../../services/MicrosoftGraph.md) with your [Azure AD v2.0 app](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-app-registration), this should be done globally with the combined and unique [delegate permissions](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-scopes) required by all Graph controls and services used in your app.
58+
59+
```c#
60+
MicrosoftGraphService.Instance.AuthenticationModel = MicrosoftGraphEnums.AuthenticationModel.V2;
61+
62+
MicrosoftGraphService.Instance.Initialize(
63+
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
64+
MicrosoftGraphEnums.ServicesToInitialize.UserProfile,
65+
AadLogin.RequiredDelegatedPermissions
66+
);
67+
```
68+
69+
[AadLogin Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/AadLogin). You can [see this in action](uwpct://Controls?sample=AadLogin) in the [Windows Community Toolkit Sample App](http://aka.ms/uwptoolkitapp).
70+
71+
## Default Template
72+
73+
[AadLogin XAML File](https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/AadLogin/AadLogin.xaml) is the XAML template used in the toolkit for the default styling.
74+
75+
## Requirements
76+
77+
| Device family | Universal, 10.0.16299.0 or higher |
78+
| -- | -- |
79+
| Namespace | Microsoft.Toolkit.Uwp.UI.Controls.Graph |
80+
| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls.Graph](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls.Graph/) |
81+
82+
## API
83+
84+
* [AadLogin source code](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/AadLogin)
Lines changed: 72 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,72 @@
1-
---
2-
title: PeoplePicker Control
3-
author: OGcanviz
4-
description: The PeoplePicker Control is a simple control that allows for selection of one or more users from an organizational AD.
5-
keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, PeoplePicker Control
6-
---
7-
8-
# PeoplePicker Control
9-
10-
The [PeoplePicker Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.graph.peoplepicker) is a simple control that allows for selection of one or more users from an organizational AD, see more details [here](https://developer.microsoft.com/en-us/graph/docs/concepts/people_example), it relies on the [MicrosoftGraphService](../services/MicrosoftGraph.md) for authentication.
11-
12-
> [!div class="nextstepaction"]
13-
> [Try it in the sample app](uwpct://Controls?sample=PeoplePicker)
14-
15-
## Syntax
16-
17-
```xaml
18-
<Page ...
19-
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls.Graph"/>
20-
21-
<controls:PeoplePicker x:Name="PeoplePicker1"
22-
AllowMultiple="True" />
23-
```
24-
25-
## Example Image
26-
27-
![PeoplePicker animation](../resources/images/Graph/PeoplePicker.png)
28-
29-
## Properties
30-
31-
| Property | Type | Description |
32-
|------------------------------|------------------------------|-----------------------------------------------------------------------------------|
33-
| RequiredDelegatedPermissions | String[] | Gets required delegated permissions for Graph API access |
34-
| GroupId | String | Search people in this group if specified, otherwise, search the organizational AD |
35-
| AllowMultiple | Boolean | Whether multiple people can be selected |
36-
| SearchResultLimit | Int | Max person returned in the search results |
37-
| PlaceholderText | String | Text to be displayed when no user is selected |
38-
| Selections | ObservableCollection<Person> | The selected person list |
39-
40-
## Sample Code
41-
42-
First of all, initialize the [MicrosoftGraphService](../services/MicrosoftGraph.md) with your [Azure AD v2.0 app](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-app-registration), this should be done globally with the combined and unique [delegate permissions](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-scopes) required by all Graph controls and services used in your app.
43-
44-
```c#
45-
MicrosoftGraphService.Instance.AuthenticationModel = MicrosoftGraphEnums.AuthenticationModel.V2;
46-
47-
MicrosoftGraphService.Instance.Initialize(
48-
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
49-
MicrosoftGraphEnums.ServicesToInitialize.UserProfile,
50-
PeoplePicker.RequiredDelegatedPermissions
51-
);
52-
```
53-
54-
The sign in will be processed by the [AadLogin](AadLogin.md) control, however, you could do sign in with the following alternatively.
55-
56-
```c#
57-
await MicrosoftGraphService.Instance.LoginAsync();
58-
```
59-
60-
[PeoplePicker Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/PeoplePicker). You can [see this in action](uwpct://Controls?sample=PeoplePicker) in the [Windows Community Toolkit Sample App](http://aka.ms/uwptoolkitapp).
61-
62-
## Default Template
63-
64-
[PeoplePicker XAML File](https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/PeoplePicker/PeoplePicker.xaml) is the XAML template used in the toolkit for the default styling.
65-
66-
## Requirements
67-
68-
| Device family | Universal, 10.0.16299.0 or higher |
69-
| -- | -- |
70-
| Namespace | Microsoft.Toolkit.Uwp.UI.Controls.Graph |
71-
| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls.Graph](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls.Graph/) |
72-
73-
## API
74-
75-
* [PeoplePicker source code](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/PeoplePicker)
1+
---
2+
title: PeoplePicker Control
3+
author: OGcanviz
4+
description: The PeoplePicker Control is a simple control that allows for selection of one or more users from an organizational AD.
5+
keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, PeoplePicker Control
6+
---
7+
8+
# PeoplePicker Control
9+
10+
The [PeoplePicker Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.graph.peoplepicker) is a simple control that allows for selection of one or more users from an organizational AD, see more details [here](https://developer.microsoft.com/en-us/graph/docs/concepts/people_example), it relies on the [MicrosoftGraphService](../../services/MicrosoftGraph.md) for authentication.
11+
12+
## Syntax
13+
14+
```xaml
15+
<Page ...
16+
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls.Graph"/>
17+
18+
<controls:PeoplePicker x:Name="PeoplePicker1"
19+
AllowMultiple="True" />
20+
```
21+
22+
## Example Image
23+
24+
![PeoplePicker animation](../../resources/images/Graph/PeoplePicker.png)
25+
26+
## Properties
27+
28+
| Property | Type | Description |
29+
|------------------------------|------------------------------|-----------------------------------------------------------------------------------|
30+
| RequiredDelegatedPermissions | String[] | Gets required delegated permissions for Graph API access |
31+
| GroupId | String | Search people in this group if specified, otherwise, search the organizational AD |
32+
| AllowMultiple | Boolean | Whether multiple people can be selected |
33+
| SearchResultLimit | Int | Max person returned in the search results |
34+
| PlaceholderText | String | Text to be displayed when no user is selected |
35+
| Selections | ObservableCollection<Person> | The selected person list |
36+
37+
## Sample Code
38+
39+
First of all, initialize the [MicrosoftGraphService](../../services/MicrosoftGraph.md) with your [Azure AD v2.0 app](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-app-registration), this should be done globally with the combined and unique [delegate permissions](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-scopes) required by all Graph controls and services used in your app.
40+
41+
```c#
42+
MicrosoftGraphService.Instance.AuthenticationModel = MicrosoftGraphEnums.AuthenticationModel.V2;
43+
44+
MicrosoftGraphService.Instance.Initialize(
45+
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
46+
MicrosoftGraphEnums.ServicesToInitialize.UserProfile,
47+
PeoplePicker.RequiredDelegatedPermissions
48+
);
49+
```
50+
51+
The sign in will be processed by the [AadLogin](AadLogin.md) control, however, you could do sign in with the following alternatively.
52+
53+
```c#
54+
await MicrosoftGraphService.Instance.LoginAsync();
55+
```
56+
57+
[PeoplePicker Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/PeoplePicker). You can [see this in action](uwpct://Controls?sample=PeoplePicker) in the [Windows Community Toolkit Sample App](http://aka.ms/uwptoolkitapp).
58+
59+
## Default Template
60+
61+
[PeoplePicker XAML File](https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/PeoplePicker/PeoplePicker.xaml) is the XAML template used in the toolkit for the default styling.
62+
63+
## Requirements
64+
65+
| Device family | Universal, 10.0.16299.0 or higher |
66+
| -- | -- |
67+
| Namespace | Microsoft.Toolkit.Uwp.UI.Controls.Graph |
68+
| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls.Graph](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls.Graph/) |
69+
70+
## API
71+
72+
* [PeoplePicker source code](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/PeoplePicker)

0 commit comments

Comments
 (0)