group:assignLicense
命名空间:microsoft.graph
添加或删除组上的许可证。 分配给组的许可证将分配给组中的所有用户。 若要详细了解基于组的许可,请参阅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 |
Bearer {token}。必需。 |
| Content-Type |
application/json. Required. |
请求正文
在请求正文中,提供具有以下参数的 JSON 对象。
响应
如果成功,此方法在响应正文中返回 202 Accepted 响应代码和目标 组 对象。
示例
示例 1:向组添加许可证
以下示例将许可证添加到组。
请求
POST https://graph.microsoft.com/v1.0/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();
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
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')
.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')
.post(group);
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
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/v1.0/";
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];
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
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();
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
//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)
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
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
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
响应
响应是更新后的组对象。
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
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/v1.0/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();
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
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')
.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')
.post(group);
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
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/v1.0/";
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];
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
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();
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
//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)
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
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
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
响应
响应是更新后的组对象。
注意: 此处显示的响应对象可能会缩短可读性。
HTTP/1.1 202 Accepted
Content-type: application/json
location: https://graph.microsoft.com/v2/d056d009-17b3-4106-8173-cd3978ada898/directoryObjects/1ad75eeb-7e5a-4367-a493-9214d90d54d0/Microsoft.DirectoryServices.Group
{
"id": "1ad75eeb-7e5a-4367-a493-9214d90d54d0",
"deletedDateTime": null,
"classification": null,
"createdDateTime": "2018-04-18T22:05:03Z",
"securityEnabled": true,
}