AdminApiClient.For.ExchangeOnline
3.1.0
dotnet add package AdminApiClient.For.ExchangeOnline --version 3.1.0
NuGet\Install-Package AdminApiClient.For.ExchangeOnline -Version 3.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AdminApiClient.For.ExchangeOnline" Version="3.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AdminApiClient.For.ExchangeOnline --version 3.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AdminApiClient.For.ExchangeOnline, 3.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AdminApiClient.For.ExchangeOnline as a Cake Addin
#addin nuget:?package=AdminApiClient.For.ExchangeOnline&version=3.1.0
// Install AdminApiClient.For.ExchangeOnline as a Cake Tool
#tool nuget:?package=AdminApiClient.For.ExchangeOnline&version=3.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
About
Built and tested against Exchange Online PowerShell 3.1.0
Features
- OData Client built from $metadata document
- Token provider for interactive and application login
Usage
Recommended and tested is using this together with Simple.OData.Client (Note this sample only grabs the first page):
var authTokenService = ExOInteractiveAuthorization.Create();
var (tenantId, authResult) = await authTokenService.AcquireFirstTokenParseTenantId();
var client = new ODataClient(new ODataClientSettings(new Uri($"https://outlook.office.com/adminApi/beta/{tenantId}"))
{
#if DEBUG
OnTrace = (x, y) => Console.WriteLine(string.Format(x, y)),
#endif
BeforeRequest = (message) => message.Headers.Authorization = new AuthenticationHeaderValue("Bearer", authResult.AccessToken)
});
return await client.For<Mailbox>().FindEntriesAsync();
Full-fledged sample including paging, selecting a subset of properties to be returned, filtering and dynamic handling of refresh tokens:
async Task<List<ExO.Mailbox>> SelectFilterUsingPropertySets()
{
var client = new ODataClient(new ODataClientSettings(new Uri($"https://outlook.office.com/adminApi/beta/{tenantId}"))
{
OnTrace = (x, y) => Console.WriteLine(string.Format(x, y)),
BeforeRequestAsync = async (message) =>
{
var ar = await authTokenService.AcquireToken();
message.Headers.Authorization = new AuthenticationHeaderValue("Bearer", ar.AccessToken);
}
});
var propertySets = string.Join(",", new[] { "Minimum", "AddressList" });
var annotations = new ODataFeedAnnotations();
var mailboxes = (await client
.For<ExO.Mailbox>()
.Select(m => new { m.UserPrincipalName, m.Alias })
.QueryOptions($"PropertySet={propertySets}")
.Filter(m => m.RecipientTypeDetails == "SharedMailbox")
.FindEntriesAsync(annotations))
.ToList();
while (annotations.NextPageLink != null)
{
mailboxes.AddRange(await client.For<ExO.Mailbox>().FindEntriesAsync(annotations.NextPageLink, annotations));
}
return mailboxes;
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Microsoft.Identity.Client (>= 4.49.1)
- Microsoft.OData.Client (>= 7.14.0)
- Microsoft.OData.Core (>= 7.14.0)
- Microsoft.OData.Edm (>= 7.14.0)
- Microsoft.Spatial (>= 7.14.0)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.IdentityModel.Tokens.Jwt (>= 6.26.0)
- System.Text.Json (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.1.0 | 197 | 2/1/2023 |