Remove acceptedSender
Article
02/09/2024
13 contributors
Feedback
In this article
Namespace: microsoft.graph
Remove a user or group from the accepted-senders list.
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)
Group.ReadWrite.All
Not available.
Delegated (personal Microsoft account)
Not supported.
Not supported.
Application
Not supported.
Not supported.
HTTP request
DELETE /groups/{id}/acceptedSenders/$ref?$id=https://graph.microsoft.com/v1.0/users/{user-id}
DELETE /groups/{id}/acceptedSenders/$ref?$id=https://graph.microsoft.com/v1.0/groups/{other-group-id}
Request body
Don't supply a request body for this method.
Response
If successful, this method returns 204 No Content
response code. It doesn't return anything in the response body.
Example
Request
Here's an example of the request.
DELETE https://graph.microsoft.com/v1.0/groups/{id}/acceptedSenders/$ref?$id=https://graph.microsoft.com/v1.0/users/{user-id}
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Groups["{group-id}"].AcceptedSenders.Ref.DeleteAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Id = "https://graph.microsoft.com/v1.0/users/{user-id}";
});
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphgroups "github.com/microsoftgraph/msgraph-sdk-go/groups"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestId := "https://graph.microsoft.com/v1.0/users/{user-id}"
requestParameters := &graphgroups.GroupItemAcceptedSenders$refRequestBuilderDeleteQueryParameters{
Id: &requestId,
}
configuration := &graphgroups.GroupItemAcceptedSenders$refRequestBuilderDeleteRequestConfiguration{
QueryParameters: requestParameters,
}
graphClient.Groups().ByGroupId("group-id").AcceptedSenders().Ref().Delete(context.Background(), configuration)
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);
graphClient.groups().byGroupId("{group-id}").acceptedSenders().ref().delete(requestConfiguration -> {
requestConfiguration.queryParameters.id = "https://graph.microsoft.com/v1.0/users/{user-id}";
});
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);
await client.api('/groups/{id}/acceptedSenders/$ref')
.delete();
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\Groups\Item\AcceptedSenders\$ref\RefRequestBuilderDeleteRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new RefRequestBuilderDeleteRequestConfiguration();
$queryParameters = RefRequestBuilderDeleteRequestConfiguration::createQueryParameters();
$queryParameters->id = "https://graph.microsoft.com/v1.0/users/{user-id}";
$requestConfiguration->queryParameters = $queryParameters;
$graphServiceClient->groups()->byGroupId('group-id')->acceptedSenders()->ref()->delete($requestConfiguration)->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
Remove-MgGroupAcceptedSenderByRef -GroupId $groupId -Id "https://graph.microsoft.com/v1.0/users/{user-id}"
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
from msgraph import GraphServiceClient
from msgraph.generated.groups.item.acceptedSenders.$ref.ref_request_builder import RefRequestBuilder
graph_client = GraphServiceClient(credentials, scopes)
query_params = RefRequestBuilder.RefRequestBuilderDeleteQueryParameters(
id = "https://graph.microsoft.com/v1.0/users/{user-id}",
)
request_configuration = RefRequestBuilder.RefRequestBuilderDeleteRequestConfiguration(
query_parameters = query_params,
)
await graph_client.groups.by_group_id('group-id').accepted_senders.ref.delete(request_configuration = request_configuration)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
Here's an example of the response.
HTTP/1.1 204 No Content