域:forceDelete
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
使用异步操作删除域。
在调用 forceDelete 之前,必须更新或删除对 Exchange设置服务 的任何引用。
以下操作作为此操作的一部分执行:
使用对已删除域的引用重命名用户的 UPN、EmailAddress 和 ProxyAddress。
使用对已删除域的引用重命名组的 EmailAddress。
使用对已删除域的引用重命名应用程序的 identifierUri。
如果要重命名的对象数大于 1,000,则返回错误。
如果要重命名的应用程序之一是多租户应用,则返回错误。
域删除完成后,已删除域的 API 操作将返回 404 HTTP 响应代码。 若要验证是否删除域,可以执行 get 域 。 如果已成功删除域,响应中将返回 404 HTTP 响应代码。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
Domain.ReadWrite.All
委派(个人 Microsoft 帐户)
不支持。
应用程序
Domain.ReadWrite.All
HTTP 请求
POST /domains/{id}/forceDelete
对于 {id},请使用其完全限定的域名指定该域。
名称
说明
Authorization
Bearer {token}。必需。
Content-Type
application/json
请求正文
在请求正文中,提供具有以下参数的 JSON 对象。
参数
类型
说明
disableUserAccounts
Boolean
用于禁用重命名的用户帐户的选项。 如果禁用用户帐户,将不允许用户登录。为 ( 默认) - 已禁用作为此操作的一部分重命名的用户帐户。False - 不会禁用作为此操作的一部分重命名的用户帐户。
响应
如果成功,此方法返回 200 OK 响应代码。
示例
请求
POST https://graph.microsoft.com/beta/domains/contoso.com/forceDelete
Content-type: application/json
{
"disableUserAccounts": true
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var disableUserAccounts = true;
await graphClient.Domains["{domain-id}"]
.ForceDelete(disableUserAccounts)
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
const forceDelete = {
disableUserAccounts: true
};
await client.api('/domains/contoso.com/forceDelete')
.version('beta')
.post(forceDelete);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/domains/contoso.com/forceDelete"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
BOOL disableUserAccounts = YES;
payloadDictionary[@"disableUserAccounts"] = disableUserAccounts;
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];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
Boolean disableUserAccounts = true;
graphClient.domains("contoso.com")
.forceDelete(DomainForceDeleteParameterSet
.newBuilder()
.withDisableUserAccounts(disableUserAccounts)
.build())
.buildRequest()
.post();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewDisableUserAccountsRequestBody()
disableUserAccounts := true
requestBody.SetDisableUserAccounts(&disableUserAccounts)
domainId := "domain-id"
graphClient.DomainsById(&domainId).ForceDelete(domain-id).Post(requestBody)
Import-Module Microsoft.Graph.Identity.DirectoryManagement
$params = @{
DisableUserAccounts = $true
}
Invoke-MgForceDomainDelete -DomainId $domainId -BodyParameter $params
响应
HTTP/1.1 200 OK