Namespace: microsoft.graph
Removes a group from a lifecycle policy.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
✅ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type |
Least privileged permissions |
Higher privileged permissions |
Delegated (work or school account) |
Directory.ReadWrite.All |
Not available. |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
Directory.ReadWrite.All |
Not available. |
HTTP request
POST /groupLifecyclePolicies/{id}/removeGroup
Request body
In the request body, provide a JSON object with the following parameters.
Parameter |
Type |
Description |
groupId |
String |
The identifier of the group to remove from the policy. |
Response
If successful, this method returns 200 OK
response code. If the group is removed from the policy, a true
value is returned in the response body. Otherwise, a false
value is returned in the response body.
Example
Request
POST https://graph.microsoft.com/v1.0/groupLifecyclePolicies/{id}/removeGroup
Content-type: application/json
{
"groupId": "ffffffff-ffff-ffff-ffff-ffffffffffff"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.GroupLifecyclePolicies.Item.RemoveGroup;
var requestBody = new RemoveGroupPostRequestBody
{
GroupId = "ffffffff-ffff-ffff-ffff-ffffffffffff",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.GroupLifecyclePolicies["{groupLifecyclePolicy-id}"].RemoveGroup.PostAsRemoveGroupPostResponseAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc group-lifecycle-policies remove-group post --group-lifecycle-policy-id {groupLifecyclePolicy-id} --body '{\
"groupId": "ffffffff-ffff-ffff-ffff-ffffffffffff"\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphgrouplifecyclepolicies "github.com/microsoftgraph/msgraph-sdk-go/grouplifecyclepolicies"
//other-imports
)
requestBody := graphgrouplifecyclepolicies.NewRemoveGroupPostRequestBody()
groupId := "ffffffff-ffff-ffff-ffff-ffffffffffff"
requestBody.SetGroupId(&groupId)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
removeGroup, err := graphClient.GroupLifecyclePolicies().ByGroupLifecyclePolicyId("groupLifecyclePolicy-id").RemoveGroup().PostAsRemoveGroupPostResponse(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.grouplifecyclepolicies.item.removegroup.RemoveGroupPostRequestBody removeGroupPostRequestBody = new com.microsoft.graph.grouplifecyclepolicies.item.removegroup.RemoveGroupPostRequestBody();
removeGroupPostRequestBody.setGroupId("ffffffff-ffff-ffff-ffff-ffffffffffff");
var result = graphClient.groupLifecyclePolicies().byGroupLifecyclePolicyId("{groupLifecyclePolicy-id}").removeGroup().post(removeGroupPostRequestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const _boolean = {
groupId: 'ffffffff-ffff-ffff-ffff-ffffffffffff'
};
await client.api('/groupLifecyclePolicies/{id}/removeGroup')
.post(_boolean);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\GroupLifecyclePolicies\Item\RemoveGroup\RemoveGroupPostRequestBody;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new RemoveGroupPostRequestBody();
$requestBody->setGroupId('ffffffff-ffff-ffff-ffff-ffffffffffff');
$result = $graphServiceClient->groupLifecyclePolicies()->byGroupLifecyclePolicyId('groupLifecyclePolicy-id')->removeGroup()->post($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.Groups
$params = @{
groupId = "ffffffff-ffff-ffff-ffff-ffffffffffff"
}
Remove-MgGroupFromLifecyclePolicy -GroupLifecyclePolicyId $groupLifecyclePolicyId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.grouplifecyclepolicies.item.remove_group.remove_group_post_request_body import RemoveGroupPostRequestBody
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = RemoveGroupPostRequestBody(
group_id = "ffffffff-ffff-ffff-ffff-ffffffffffff",
)
result = await graph_client.group_lifecycle_policies.by_group_lifecycle_policy_id('groupLifecyclePolicy-id').remove_group.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
HTTP/1.1 200 OK