group: assignLicense
[アーティクル]
05/05/2022
3 人の共同作成者
この記事の内容
名前空間: microsoft.graph
重要
Microsoft Graph のバージョンの /beta API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 API が v1.0 で使用できるかどうかを確認するには、 バージョン セレクターを使用します。
グループのライセンスを追加または削除します。 グループに割り当てられているライセンスは、グループ内のすべてのユーザーに割り当てられます。 グループ ベースのライセンスの詳細については、「Azure Active Directoryでのグループ ベースのライセンスとは」 を参照してください。
ディレクトリで使用可能なサブスクリプションを取得するには、 GET subscribedSkus 要求 を実行します。
アクセス許可
この API を呼び出すには、次のいずれかのアクセス許可が必要です。アクセス許可の選択方法などの詳細については、「アクセス許可 」を参照してください。
アクセス許可の種類
アクセス許可 (特権の小さいものから大きいものへ)
委任 (職場または学校のアカウント)
Group.ReadWrite.All、Directory.ReadWrite.All
委任 (個人用 Microsoft アカウント)
サポートされていません。
アプリケーション
Group.ReadWrite.All、Directory.ReadWrite.All
HTTP 要求
POST /groups/{id}/assignLicense
ヘッダー
値
Authorization
ベアラー {token}。必須。
Content-Type
application/json. Required.
要求本文
要求本文で、次のパラメーターを含む JSON オブジェクトを指定します。
応答
成功した場合、このメソッドは 202 Accepted 応答コードと応答本文のターゲット グループ オブジェクトを返します。
例
例 1: グループにライセンスを追加する
次の例では、グループにライセンスを追加します。
要求
POST https://graph.microsoft.com/beta/groups/1132b215-826f-42a9-8cfe-1643d19d17fd/assignLicense
Content-type: application/json
{
"addLicenses": [
{
"disabledPlans": [
"113feb6c-3fe4-4440-bddc-54d774bf0318",
"14ab5db5-e6c4-4b20-b4bc-13e36fd2227f"
],
"skuId": "b05e124f-c7cc-45a0-a6aa-8cf78c946968"
},
{
"disabledPlans": [
"a413a9ff-720c-4822-98ef-2f37c2a21f4c"
],
"skuId": "c7df2760-2c81-4ef7-b578-5b5392b571df"
}
],
"removeLicenses": []
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var addLicenses = new List<AssignedLicense>()
{
new AssignedLicense
{
DisabledPlans = new List<Guid>()
{
Guid.Parse("113feb6c-3fe4-4440-bddc-54d774bf0318"),
Guid.Parse("14ab5db5-e6c4-4b20-b4bc-13e36fd2227f")
},
SkuId = Guid.Parse("b05e124f-c7cc-45a0-a6aa-8cf78c946968")
},
new AssignedLicense
{
DisabledPlans = new List<Guid>()
{
Guid.Parse("a413a9ff-720c-4822-98ef-2f37c2a21f4c")
},
SkuId = Guid.Parse("c7df2760-2c81-4ef7-b578-5b5392b571df")
}
};
var removeLicenses = new List<Guid>()
{
};
await graphClient.Groups["{group-id}"]
.AssignLicense(addLicenses,removeLicenses)
.Request()
.PostAsync();
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var addLicenses = new List<AssignedLicense>()
{
new AssignedLicense
{
DisabledPlans = new List<Guid>()
{
Guid.Parse("113feb6c-3fe4-4440-bddc-54d774bf0318"),
Guid.Parse("14ab5db5-e6c4-4b20-b4bc-13e36fd2227f")
},
SkuId = Guid.Parse("b05e124f-c7cc-45a0-a6aa-8cf78c946968")
},
new AssignedLicense
{
DisabledPlans = new List<Guid>()
{
Guid.Parse("a413a9ff-720c-4822-98ef-2f37c2a21f4c")
},
SkuId = Guid.Parse("c7df2760-2c81-4ef7-b578-5b5392b571df")
}
};
var removeLicenses = new List<Guid>()
{
};
await graphClient.Groups["{group-id}"]
.AssignLicense(addLicenses,removeLicenses)
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
const group = {
addLicenses: [
{
disabledPlans: [
'113feb6c-3fe4-4440-bddc-54d774bf0318',
'14ab5db5-e6c4-4b20-b4bc-13e36fd2227f'
],
skuId: 'b05e124f-c7cc-45a0-a6aa-8cf78c946968'
},
{
disabledPlans: [
'a413a9ff-720c-4822-98ef-2f37c2a21f4c'
],
skuId: 'c7df2760-2c81-4ef7-b578-5b5392b571df'
}
],
removeLicenses: []
};
await client.api('/groups/1132b215-826f-42a9-8cfe-1643d19d17fd/assignLicense')
.version('beta')
.post(group);
const options = {
authProvider,
};
const client = Client.init(options);
const group = {
addLicenses: [
{
disabledPlans: [
'113feb6c-3fe4-4440-bddc-54d774bf0318',
'14ab5db5-e6c4-4b20-b4bc-13e36fd2227f'
],
skuId: 'b05e124f-c7cc-45a0-a6aa-8cf78c946968'
},
{
disabledPlans: [
'a413a9ff-720c-4822-98ef-2f37c2a21f4c'
],
skuId: 'c7df2760-2c81-4ef7-b578-5b5392b571df'
}
],
removeLicenses: []
};
await client.api('/groups/1132b215-826f-42a9-8cfe-1643d19d17fd/assignLicense')
.version('beta')
.post(group);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/groups/1132b215-826f-42a9-8cfe-1643d19d17fd/assignLicense"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
NSMutableArray *addLicensesList = [[NSMutableArray alloc] init];
MSGraphAssignedLicense *addLicenses = [[MSGraphAssignedLicense alloc] init];
NSMutableArray *disabledPlansList = [[NSMutableArray alloc] init];
[disabledPlansList addObject: @"113feb6c-3fe4-4440-bddc-54d774bf0318"];
[disabledPlansList addObject: @"14ab5db5-e6c4-4b20-b4bc-13e36fd2227f"];
[addLicenses setDisabledPlans:disabledPlansList];
[addLicenses setSkuId:@"b05e124f-c7cc-45a0-a6aa-8cf78c946968"];
[addLicensesList addObject: addLicenses];
MSGraphAssignedLicense *addLicenses = [[MSGraphAssignedLicense alloc] init];
NSMutableArray *disabledPlansList = [[NSMutableArray alloc] init];
[disabledPlansList addObject: @"a413a9ff-720c-4822-98ef-2f37c2a21f4c"];
[addLicenses setDisabledPlans:disabledPlansList];
[addLicenses setSkuId:@"c7df2760-2c81-4ef7-b578-5b5392b571df"];
[addLicensesList addObject: addLicenses];
payloadDictionary[@"addLicenses"] = addLicensesList;
NSMutableArray *removeLicensesList = [[NSMutableArray alloc] init];
payloadDictionary[@"removeLicenses"] = removeLicensesList;
NSData *data = [NSJSONSerialization dataWithJSONObject:payloadDictionary options:kNilOptions error:&error];
[urlRequest setHTTPBody:data];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/groups/1132b215-826f-42a9-8cfe-1643d19d17fd/assignLicense"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
NSMutableArray *addLicensesList = [[NSMutableArray alloc] init];
MSGraphAssignedLicense *addLicenses = [[MSGraphAssignedLicense alloc] init];
NSMutableArray *disabledPlansList = [[NSMutableArray alloc] init];
[disabledPlansList addObject: @"113feb6c-3fe4-4440-bddc-54d774bf0318"];
[disabledPlansList addObject: @"14ab5db5-e6c4-4b20-b4bc-13e36fd2227f"];
[addLicenses setDisabledPlans:disabledPlansList];
[addLicenses setSkuId:@"b05e124f-c7cc-45a0-a6aa-8cf78c946968"];
[addLicensesList addObject: addLicenses];
MSGraphAssignedLicense *addLicenses = [[MSGraphAssignedLicense alloc] init];
NSMutableArray *disabledPlansList = [[NSMutableArray alloc] init];
[disabledPlansList addObject: @"a413a9ff-720c-4822-98ef-2f37c2a21f4c"];
[addLicenses setDisabledPlans:disabledPlansList];
[addLicenses setSkuId:@"c7df2760-2c81-4ef7-b578-5b5392b571df"];
[addLicensesList addObject: addLicenses];
payloadDictionary[@"addLicenses"] = addLicensesList;
NSMutableArray *removeLicensesList = [[NSMutableArray alloc] init];
payloadDictionary[@"removeLicenses"] = removeLicensesList;
NSData *data = [NSJSONSerialization dataWithJSONObject:payloadDictionary options:kNilOptions error:&error];
[urlRequest setHTTPBody:data];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
LinkedList<AssignedLicense> addLicensesList = new LinkedList<AssignedLicense>();
AssignedLicense addLicenses = new AssignedLicense();
LinkedList<UUID> disabledPlansList = new LinkedList<UUID>();
disabledPlansList.add(UUID.fromString("113feb6c-3fe4-4440-bddc-54d774bf0318"));
disabledPlansList.add(UUID.fromString("14ab5db5-e6c4-4b20-b4bc-13e36fd2227f"));
addLicenses.disabledPlans = disabledPlansList;
addLicenses.skuId = UUID.fromString("b05e124f-c7cc-45a0-a6aa-8cf78c946968");
addLicensesList.add(addLicenses);
AssignedLicense addLicenses1 = new AssignedLicense();
LinkedList<UUID> disabledPlansList1 = new LinkedList<UUID>();
disabledPlansList1.add(UUID.fromString("a413a9ff-720c-4822-98ef-2f37c2a21f4c"));
addLicenses1.disabledPlans = disabledPlansList1;
addLicenses1.skuId = UUID.fromString("c7df2760-2c81-4ef7-b578-5b5392b571df");
addLicensesList.add(addLicenses1);
LinkedList<UUID> removeLicensesList = new LinkedList<UUID>();
graphClient.groups("1132b215-826f-42a9-8cfe-1643d19d17fd")
.assignLicense(GroupAssignLicenseParameterSet
.newBuilder()
.withAddLicenses(addLicensesList)
.withRemoveLicenses(removeLicensesList)
.build())
.buildRequest()
.post();
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
LinkedList<AssignedLicense> addLicensesList = new LinkedList<AssignedLicense>();
AssignedLicense addLicenses = new AssignedLicense();
LinkedList<UUID> disabledPlansList = new LinkedList<UUID>();
disabledPlansList.add(UUID.fromString("113feb6c-3fe4-4440-bddc-54d774bf0318"));
disabledPlansList.add(UUID.fromString("14ab5db5-e6c4-4b20-b4bc-13e36fd2227f"));
addLicenses.disabledPlans = disabledPlansList;
addLicenses.skuId = UUID.fromString("b05e124f-c7cc-45a0-a6aa-8cf78c946968");
addLicensesList.add(addLicenses);
AssignedLicense addLicenses1 = new AssignedLicense();
LinkedList<UUID> disabledPlansList1 = new LinkedList<UUID>();
disabledPlansList1.add(UUID.fromString("a413a9ff-720c-4822-98ef-2f37c2a21f4c"));
addLicenses1.disabledPlans = disabledPlansList1;
addLicenses1.skuId = UUID.fromString("c7df2760-2c81-4ef7-b578-5b5392b571df");
addLicensesList.add(addLicenses1);
LinkedList<UUID> removeLicensesList = new LinkedList<UUID>();
graphClient.groups("1132b215-826f-42a9-8cfe-1643d19d17fd")
.assignLicense(GroupAssignLicenseParameterSet
.newBuilder()
.withAddLicenses(addLicensesList)
.withRemoveLicenses(removeLicensesList)
.build())
.buildRequest()
.post();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.New()
requestBody.SetAddLicenses( []AssignedLicense {
msgraphsdk.NewAssignedLicense(),
SetAdditionalData(map[string]interface{}{
"disabledPlans": []String {
"113feb6c-3fe4-4440-bddc-54d774bf0318",
"14ab5db5-e6c4-4b20-b4bc-13e36fd2227f",
}
"skuId": "b05e124f-c7cc-45a0-a6aa-8cf78c946968",
}
msgraphsdk.NewAssignedLicense(),
SetAdditionalData(map[string]interface{}{
"disabledPlans": []String {
"a413a9ff-720c-4822-98ef-2f37c2a21f4c",
}
"skuId": "c7df2760-2c81-4ef7-b578-5b5392b571df",
}
}
requestBody.SetRemoveLicenses( []string {
}
groupId := "group-id"
result, err := graphClient.GroupsById(&groupId).AssignLicense(group-id).Post(requestBody)
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.New()
requestBody.SetAddLicenses( []AssignedLicense {
msgraphsdk.NewAssignedLicense(),
SetAdditionalData(map[string]interface{}{
"disabledPlans": []String {
"113feb6c-3fe4-4440-bddc-54d774bf0318",
"14ab5db5-e6c4-4b20-b4bc-13e36fd2227f",
}
"skuId": "b05e124f-c7cc-45a0-a6aa-8cf78c946968",
}
msgraphsdk.NewAssignedLicense(),
SetAdditionalData(map[string]interface{}{
"disabledPlans": []String {
"a413a9ff-720c-4822-98ef-2f37c2a21f4c",
}
"skuId": "c7df2760-2c81-4ef7-b578-5b5392b571df",
}
}
requestBody.SetRemoveLicenses( []string {
}
groupId := "group-id"
result, err := graphClient.GroupsById(&groupId).AssignLicense(group-id).Post(requestBody)
Import-Module Microsoft.Graph.Groups
$params = @{
AddLicenses = @(
@{
DisabledPlans = @(
"113feb6c-3fe4-4440-bddc-54d774bf0318"
"14ab5db5-e6c4-4b20-b4bc-13e36fd2227f"
)
SkuId = "b05e124f-c7cc-45a0-a6aa-8cf78c946968"
}
@{
DisabledPlans = @(
"a413a9ff-720c-4822-98ef-2f37c2a21f4c"
)
SkuId = "c7df2760-2c81-4ef7-b578-5b5392b571df"
}
)
RemoveLicenses = @(
)
}
Set-MgGroupLicense -GroupId $groupId -BodyParameter $params
Import-Module Microsoft.Graph.Groups
$params = @{
AddLicenses = @(
@{
DisabledPlans = @(
"113feb6c-3fe4-4440-bddc-54d774bf0318"
"14ab5db5-e6c4-4b20-b4bc-13e36fd2227f"
)
SkuId = "b05e124f-c7cc-45a0-a6aa-8cf78c946968"
}
@{
DisabledPlans = @(
"a413a9ff-720c-4822-98ef-2f37c2a21f4c"
)
SkuId = "c7df2760-2c81-4ef7-b578-5b5392b571df"
}
)
RemoveLicenses = @(
)
}
Set-MgGroupLicense -GroupId $groupId -BodyParameter $params
応答
応答は、更新されたグループ オブジェクトです。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 202 Accepted
Content-type: application/json
location: https://graph.microsoft.com/v2/e8e96c2a-d787-4eb1-98d7-9e57c965f1de/directoryObjects/1132b215-826f-42a9-8cfe-1643d19d17fd/Microsoft.DirectoryServices.Group
{
"id": "1132b215-826f-42a9-8cfe-1643d19d17fd",
"createdDateTime": "2021-03-12T11:15:03Z",
"groupTypes": [],
"securityEnabled": true,
}
例 2: グループからライセンスを削除する
次の例では、グループからライセンスを削除します。
要求
POST https://graph.microsoft.com/beta/groups/1132b215-826f-42a9-8cfe-1643d19d17fd/assignLicense
Content-type: application/json
{
"addLicenses": [],
"removeLicenses": [
"c7df2760-2c81-4ef7-b578-5b5392b571df",
"b05e124f-c7cc-45a0-a6aa-8cf78c946968"
]
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var addLicenses = new List<AssignedLicense>()
{
};
var removeLicenses = new List<Guid>()
{
Guid.Parse("c7df2760-2c81-4ef7-b578-5b5392b571df"),
Guid.Parse("b05e124f-c7cc-45a0-a6aa-8cf78c946968")
};
await graphClient.Groups["{group-id}"]
.AssignLicense(addLicenses,removeLicenses)
.Request()
.PostAsync();
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var addLicenses = new List<AssignedLicense>()
{
};
var removeLicenses = new List<Guid>()
{
Guid.Parse("c7df2760-2c81-4ef7-b578-5b5392b571df"),
Guid.Parse("b05e124f-c7cc-45a0-a6aa-8cf78c946968")
};
await graphClient.Groups["{group-id}"]
.AssignLicense(addLicenses,removeLicenses)
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
const group = {
addLicenses: [],
removeLicenses: [
'c7df2760-2c81-4ef7-b578-5b5392b571df',
'b05e124f-c7cc-45a0-a6aa-8cf78c946968'
]
};
await client.api('/groups/1132b215-826f-42a9-8cfe-1643d19d17fd/assignLicense')
.version('beta')
.post(group);
const options = {
authProvider,
};
const client = Client.init(options);
const group = {
addLicenses: [],
removeLicenses: [
'c7df2760-2c81-4ef7-b578-5b5392b571df',
'b05e124f-c7cc-45a0-a6aa-8cf78c946968'
]
};
await client.api('/groups/1132b215-826f-42a9-8cfe-1643d19d17fd/assignLicense')
.version('beta')
.post(group);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/groups/1132b215-826f-42a9-8cfe-1643d19d17fd/assignLicense"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
NSMutableArray *addLicensesList = [[NSMutableArray alloc] init];
payloadDictionary[@"addLicenses"] = addLicensesList;
NSMutableArray *removeLicensesList = [[NSMutableArray alloc] init];
[removeLicensesList addObject: @"c7df2760-2c81-4ef7-b578-5b5392b571df"];
[removeLicensesList addObject: @"b05e124f-c7cc-45a0-a6aa-8cf78c946968"];
payloadDictionary[@"removeLicenses"] = removeLicensesList;
NSData *data = [NSJSONSerialization dataWithJSONObject:payloadDictionary options:kNilOptions error:&error];
[urlRequest setHTTPBody:data];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/groups/1132b215-826f-42a9-8cfe-1643d19d17fd/assignLicense"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
NSMutableArray *addLicensesList = [[NSMutableArray alloc] init];
payloadDictionary[@"addLicenses"] = addLicensesList;
NSMutableArray *removeLicensesList = [[NSMutableArray alloc] init];
[removeLicensesList addObject: @"c7df2760-2c81-4ef7-b578-5b5392b571df"];
[removeLicensesList addObject: @"b05e124f-c7cc-45a0-a6aa-8cf78c946968"];
payloadDictionary[@"removeLicenses"] = removeLicensesList;
NSData *data = [NSJSONSerialization dataWithJSONObject:payloadDictionary options:kNilOptions error:&error];
[urlRequest setHTTPBody:data];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
LinkedList<AssignedLicense> addLicensesList = new LinkedList<AssignedLicense>();
LinkedList<UUID> removeLicensesList = new LinkedList<UUID>();
removeLicensesList.add(UUID.fromString("c7df2760-2c81-4ef7-b578-5b5392b571df"));
removeLicensesList.add(UUID.fromString("b05e124f-c7cc-45a0-a6aa-8cf78c946968"));
graphClient.groups("1132b215-826f-42a9-8cfe-1643d19d17fd")
.assignLicense(GroupAssignLicenseParameterSet
.newBuilder()
.withAddLicenses(addLicensesList)
.withRemoveLicenses(removeLicensesList)
.build())
.buildRequest()
.post();
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
LinkedList<AssignedLicense> addLicensesList = new LinkedList<AssignedLicense>();
LinkedList<UUID> removeLicensesList = new LinkedList<UUID>();
removeLicensesList.add(UUID.fromString("c7df2760-2c81-4ef7-b578-5b5392b571df"));
removeLicensesList.add(UUID.fromString("b05e124f-c7cc-45a0-a6aa-8cf78c946968"));
graphClient.groups("1132b215-826f-42a9-8cfe-1643d19d17fd")
.assignLicense(GroupAssignLicenseParameterSet
.newBuilder()
.withAddLicenses(addLicensesList)
.withRemoveLicenses(removeLicensesList)
.build())
.buildRequest()
.post();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.New()
requestBody.SetAddLicenses( []AssignedLicense {
}
requestBody.SetRemoveLicenses( []String {
"c7df2760-2c81-4ef7-b578-5b5392b571df",
"b05e124f-c7cc-45a0-a6aa-8cf78c946968",
}
groupId := "group-id"
result, err := graphClient.GroupsById(&groupId).AssignLicense(group-id).Post(requestBody)
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.New()
requestBody.SetAddLicenses( []AssignedLicense {
}
requestBody.SetRemoveLicenses( []String {
"c7df2760-2c81-4ef7-b578-5b5392b571df",
"b05e124f-c7cc-45a0-a6aa-8cf78c946968",
}
groupId := "group-id"
result, err := graphClient.GroupsById(&groupId).AssignLicense(group-id).Post(requestBody)
Import-Module Microsoft.Graph.Groups
$params = @{
AddLicenses = @(
)
RemoveLicenses = @(
"c7df2760-2c81-4ef7-b578-5b5392b571df"
"b05e124f-c7cc-45a0-a6aa-8cf78c946968"
)
}
Set-MgGroupLicense -GroupId $groupId -BodyParameter $params
Import-Module Microsoft.Graph.Groups
$params = @{
AddLicenses = @(
)
RemoveLicenses = @(
"c7df2760-2c81-4ef7-b578-5b5392b571df"
"b05e124f-c7cc-45a0-a6aa-8cf78c946968"
)
}
Set-MgGroupLicense -GroupId $groupId -BodyParameter $params
応答
応答は、更新されたグループ オブジェクトです。
メモ: 読みやすくするために、ここに示す応答オブジェクトが短くなる可能性があります。
HTTP/1.1 202 Accepted
Content-type: application/json
location: https://graph.microsoft.com/v2/e8e96c2a-d787-4eb1-98d7-9e57c965f1de/directoryObjects/1132b215-826f-42a9-8cfe-1643d19d17fd/Microsoft.DirectoryServices.Group
{
"id": "1132b215-826f-42a9-8cfe-1643d19d17fd",
"createdDateTime": "2021-03-12T11:15:03Z",
"groupTypes": [],
"securityEnabled": true,
}