group: assignLicense
Artikel
07/18/2022
8 Minuten Lesedauer
3 Mitwirkende
In diesem Artikel
Namespace: microsoft.graph
Hinzufügen oder Entfernen von Lizenzen für die Gruppe. Der Gruppe zugewiesene Lizenzen werden allen Benutzern in der Gruppe zugewiesen. Weitere Informationen zur gruppenbasierten Lizenzierung finden Sie unter Was ist gruppenbasierte Lizenzierung in Azure Active Directory .
Um die im Verzeichnis verfügbaren Abonnements abzurufen, führen Sie eine GET subscribedSkus-Anforderung aus .
Berechtigungen
Eine der nachfolgenden Berechtigungen ist erforderlich, um diese API aufrufen zu können. Weitere Informationen, unter anderem zur Auswahl von Berechtigungen, finden Sie im Artikel zum Thema Berechtigungen .
Berechtigungstyp
Berechtigungen (von der Berechtigung mit den wenigsten Rechten zu der mit den meisten Rechten)
Delegiert (Geschäfts-, Schul- oder Unikonto)
Group.ReadWrite.All, Directory.ReadWrite.All
Delegiert (persönliches Microsoft-Konto)
Nicht unterstützt
Anwendung
Group.ReadWrite.All, Directory.ReadWrite.All
HTTP-Anforderung
POST /groups/{id}/assignLicense
Kopfzeile
Wert
Authorization
Bearer {token}. Erforderlich.
Content-Type
application/json. Erforderlich.
Anforderungstext
Geben Sie im Anforderungstext ein JSON-Objekt mit den folgenden Parametern an.
Parameter
Typ
Beschreibung
addLicenses
assignedLicense Sammlung
Eine Sammlung von assignedLicense -Objekten, die die hinzuzufügenden Lizenzen angeben. Sie können servicePlans deaktivieren, die einer Lizenz zugeordnet sind, indem Sie die disabledPlans-Eigenschaft für ein assignedLicense-Objekt festlegen.
removeLicenses
GUID-Sammlung
Eine Sammlung von skuIds, die die zu entfernenden Lizenzen identifizieren.
Antwort
Bei erfolgreicher Ausführung gibt die Methode den 202 Accepted Antwortcode und ein Zielgruppenobjekt im Antworttext zurück.
Beispiele
Beispiel 1: Hinzufügen von Lizenzen zur Gruppe
Im folgenden Beispiel werden der Gruppe Lizenzen hinzugefügt.
Anforderung
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();
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
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);
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
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];
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
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();
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
//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)
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
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
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
Antwort
Die Antwort ist das aktualisierte Gruppenobjekt.
Hinweis: Das hier gezeigte Antwortobjekt kann zur besseren Lesbarkeit gekürzt werden.
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,
}
Beispiel 2: Entfernen von Lizenzen aus der Gruppe
Im folgenden Beispiel werden Lizenzen aus der Gruppe entfernt.
Anforderung
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();
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
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);
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
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];
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
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();
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
//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)
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
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
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
Antwort
Die Antwort ist das aktualisierte Gruppenobjekt.
Hinweis: Das hier gezeigte Antwortobjekt ist möglicherweise zur besseren Lesbarkeit gekürzt.
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,
}