MassifApp.MSGraph 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package MassifApp.MSGraph --version 1.0.1                
NuGet\Install-Package MassifApp.MSGraph -Version 1.0.1                
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="MassifApp.MSGraph" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MassifApp.MSGraph --version 1.0.1                
#r "nuget: MassifApp.MSGraph, 1.0.1"                
#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 MassifApp.MSGraph as a Cake Addin
#addin nuget:?package=MassifApp.MSGraph&version=1.0.1

// Install MassifApp.MSGraph as a Cake Tool
#tool nuget:?package=MassifApp.MSGraph&version=1.0.1                

MassifApp.MSGraph

概要

Microsoft Graph向けラッパークラスです。
Graphで使用するトークンの取り扱いを若干簡略化します。
Graphの全APIに対応しているかは保証されていません。

注意点

System.Net.Http.HttpClientクラスのインスタンスをプライベート変数として保持しています。そのため、同クラスのデザインパターン適用を推奨します。

詳細

  • アクセストークンの有効期限をあまり気にしないようにできます(期限切れは自動で再取得)。
  • 注意点にも記載しましたが、HttpClientクラスのインスタンスを内部で保持しています。リクエスト毎にインスタンス化することは避けてください。
  • クラス継承が本来の姿なのかもしれません。継承すると仮想メソッドのオーバライドが禁止されているのでインスタンス保持を選択しましたが・・・

Outlook GrapAPIを呼び出してメール一覧を取得:
string clientId = "略";
string clientSecret = "略";
string tenantId = "略";
MSGraphToken token = new(clientId, clientSecret, tenantId)
HttpGraphClient client = new(token);
HttpRequestMessage request = await client.GetRequestTokenMessage("https://graph.microsoft.com/v1.0/users/foo@example.com/mailFolders/inbox/messages?$select=id,from,subject");
string messages = client.GetStringAsync(request)
Outlook GraphAPIを呼び出してメール送信:
HttpRequestMessage request = await client.GetRequestTokenMessage("https://graph.microsoft.com/v1.0/users/foo@example.com/sendMail");
//
// 適切なコンテンツ処理
// string jsonString = ...
//
request.Content = new StringContent(jsonString, Encoding.UTF8, "application/json");
request.Method = HttpMethod.Post;
await client.GetAsync(request);
Product 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

    • No dependencies.

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
1.3.3.2 270 10/30/2023
1.3.2 348 11/28/2022
1.3.1 350 11/24/2022
1.3.0 334 11/22/2022
1.2.0 435 10/15/2022
1.1.0 404 9/17/2022
1.0.1 393 9/5/2022