既然你已经在使用
Microsoft.Graph
命名空间中,可以使用
GraphServiceClient
var graphserviceClient = new GraphServiceClient(
new DelegateAuthenticationProvider(
(requestMessage) =>
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", "<your-access-token>");
}));
var group = new Microsoft.Graph.Group
{
DisplayName = "Library Assist",
Description = "Self help community for library",
MailNickname = "library",
MailEnabled = true,
SecurityEnabled = true,
GroupTypes = new List<string> { "Unified" }
};
var createdGroup = await graphserviceClient.Groups.Request().AddAsync(group);
参考-
Intro to the Microsoft Graph .NET Client Library