Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions CommunityToolkit.Net.Graph/CommunityToolkit.Net.Graph.csproj
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
<Project Sdk="MSBuild.Sdk.Extras">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>

<Title>Windows Community Toolkit .NET Standard Graph Services</Title>
<PackageId>CommunityToolkit.Net.Graph</PackageId>
<Description>
This package includes .NET Standard code helpers such as:
- GraphExtensions: Helpers for common tasks related to the Microsoft Graph used by the Microsoft.Toolkit.Graph.Controls.
- ProviderExtensions: Extension on IProvider for accessing a pre-configured GraphServiceClient instance.
</Description>
<PackageTags>Windows Community Toolkit Graph Provider Extensions</PackageTags>
<SignAssembly>false</SignAssembly>
<GenerateLibraryLayout>true</GenerateLibraryLayout>
<LangVersion>8.0</LangVersion>
<Configurations>Debug;Release;CI</Configurations>
<Platforms>AnyCPU;ARM;ARM64;x64;x86</Platforms>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ private static void OnProviderUpdated(object sender, ProviderUpdatedEventArgs e)
if (e.Reason == ProviderManagerChangedState.ProviderChanged || !(providerManager.GlobalProvider?.State == ProviderState.SignedIn))
{
_client = null;
_betaClient = null;
}
}

Expand Down
31 changes: 31 additions & 0 deletions Docs/QuickStart-WindowsProvider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# How To: Quickly setup the WindowsProvider for authentication
Here are some quick setup steps for using the WindowsProvider in a UWP app:

1. Open Visual Studio and create a new C# UWP application.

2. Add the following nuget packages (Nuget feed: [WindowsCommunityToolkit-MainLatest](https://pkgs.dev.azure.com/dotnet/WindowsCommunityToolkit/_packaging/WindowsCommunityToolkit-MainLatest/nuget/v3/index.json)):
* `CommunityToolkit.Net.Authentication` – For the ProviderManager
* `CommunityToolkit.Uwp.Authentication` – For the WindowsProvider
* `CommunityToolkit.Uwp.Graph.Controls` – For the LoginButton

3. Open the App.xaml.cs and add the following code to the bottom of the OnLaunched. You’ll need to make the method async as well.

```
// Find this line in the OnLaunched method and add the following code immediately after.
Window.Current.Activate();

string[] scopes = new string[] { "User.Read", "Tasks.ReadWrite" };
ProviderManager.Instance.GlobalProvider = new WindowsProvider(scopes);
```

4. Add a LoginButton to the MainPage.xaml

```
xmlns:graphcontrols="using:CommunityToolkit.Uwp.Graph.Controls"

<graphcontrols:LoginButton />
```

5. Associate the app to the Store in VS by selecting `Project` -> `Publish` -> `Associate App with the Store...` and following the prompts.

6. Run the app and click the button to initiate login.
2 changes: 1 addition & 1 deletion Docs/WindowsProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ It extends IProvider and uses the native AccountsSettingsPane APIs for login.

```CSharp
// Provider config
string clientId = "YOUR_CLIENT_ID_HERE"; // Only required for approving application or delegated permissions.
string clientId = "YOUR_CLIENT_ID_HERE"; // AAD configuration is only required for admin-level consent.
string[] scopes = { "User.Read", "People.Read", "Calendars.Read", "Mail.Read" };
bool autoSignIn = true;

Expand Down
Loading