Integrate the Microsoft Graph Beta API into your .NET project!
The Microsoft Graph Beta .NET Client Library 0.x targets .NetStandard 1.1 and .Net Framework 4.5.
The Microsoft Graph Beta .NET Client Library 4.x targets .NetStandard 2.0 and .Net Framework 4.6.2.
To install the client library via NuGet:
- Search for
Microsoft.Graph.Beta
in the NuGet Library, or - Type
Install-Package Microsoft.Graph.Beta -PreRelease
into the Package Manager Console.
Both the v1.0 and beta Microsoft Graph endpoints share the same namespace. This results in both the v1.0 and beta generated libraries sharing the same namespace. You can use the beta library by itself with no changes to your environment. If you plan to use the beta endpoint in addition to the v1.0 endpoint, you'l have a couple of integration steps you'll need to follow to enable a beta client to be used alongside the v1.0 client which is obtained with the Microsoft.Graph
(v1.0) NuGet package.
If your project (.csproj) uses a Reference element to reference the Microsoft.Graph.Beta library, you'll need to specify the DLL alias within the element. We suggest that you use the BetaLib alias, although any alias will do:
<Reference Include="Microsoft.Graph.Beta, Version=0.35.0-preview, Culture=neutral">
<SpecificVersion>False</SpecificVersion>
<HintPath>Resources\Microsoft.Graph.Beta.dll</HintPath>
<Aliases>BetaLib</Aliases>
</Reference>
If your project (.csproj) uses a PackageReference element to reference the Microsoft.Graph.Beta library, you'll need to specify the DLL alias within the element. Again, we suggest that you use the BetaLib alias, although any alias will do:
<Target Name="ChangeAliasesOfStrongNameAssemblies" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences">
<ItemGroup>
<ReferencePath Condition="'%(FileName)' == 'Microsoft.Graph.Beta'">
<Aliases>BetaLib</Aliases>
</ReferencePath>
</ItemGroup>
</Target>
The project reference approach to aliasing DLLs will be updated and is on the NuGet backlog.
Now, you set the extern alias
directive (above all using directives) to get access to the Microsoft.Graph.Beta library. We suggest that you alias the namespace to Beta
:
extern alias BetaLib;
using Beta = BetaLib.Microsoft.Graph;
You can now reference the Microsoft.Graph.Beta objects like this:
var contact = new Beta.Contact();
Beta.GraphServiceClient betaClient = new Beta.GraphServiceClient();
Please see msgraph-sdk-dotnet for information on getting started with this library.
Between 0.x and 4.x there were some major breaking changes:
- .NET Standard minimum version bumped from
netStandard1.3
tonetstandard2.0
- .NET Framework minimum version bumped from
net45
tonet462
- Replacing Newtosoft.Json with System.Text.Json
- Upgrading Microsoft.Graph.Core dependency to version 2.0.0
View the upgrade guide here..
To view or log issues, see issues.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
- NuGet Package: https://www.nuget.org/packages/Microsoft.Graph.Beta
If you are looking to build the library locally for the purposes of contributing code or running tests, you will need to:
- Have the .NET Core SDK (> 1.0) installed
- Run
dotnet restore
from the command line in your package directory - Run
nuget restore
andmsbuild
from CLI or run Build from Visual Studio to restore Nuget packages and build the project
Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT license. See Third Party Notices for information on the packages referenced via NuGet.