// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Chats.Item.RemoveAllAccessForUser;
using Microsoft.Graph.Beta.Models;
var requestBody = new RemoveAllAccessForUserPostRequestBody
{
User = new TeamworkUserIdentity
{
OdataType = "microsoft.graph.teamworkUserIdentity",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Chats["{chat-id}"].RemoveAllAccessForUser.PostAsync(requestBody);
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc-beta chats remove-all-access-for-user post --chat-id {chat-id} --body '{\
"user": {\
"@odata.type": "microsoft.graph.teamworkUserIdentity"\
}\
}\
'
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.chats.item.removeallaccessforuser.RemoveAllAccessForUserPostRequestBody removeAllAccessForUserPostRequestBody = new com.microsoft.graph.beta.chats.item.removeallaccessforuser.RemoveAllAccessForUserPostRequestBody();
TeamworkUserIdentity user = new TeamworkUserIdentity();
user.setOdataType("microsoft.graph.teamworkUserIdentity");
removeAllAccessForUserPostRequestBody.setUser(user);
graphClient.chats().byChatId("{chat-id}").removeAllAccessForUser().post(removeAllAccessForUserPostRequestBody);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\RemoveAllAccessForUserPostRequestBody;
use Microsoft\Graph\Generated\Models\TeamworkUserIdentity;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new RemoveAllAccessForUserPostRequestBody();
$user = new TeamworkUserIdentity();
$user->setOdataType('microsoft.graph.teamworkUserIdentity');
$requestBody->setUser($user);
$graphServiceClient->chats()->byChatId('chat-id')->removeAllAccessForUser()->post($requestBody)->wait();