域:验证
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
验证域的所有权。
重要说明: 仅适用于未验证的域。对于未验证的域,域 的 isVerified 属性为 false。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
Domain.ReadWrite.All
委派(个人 Microsoft 帐户)
不支持。
应用程序
Domain.ReadWrite.All
HTTP 请求
POST /domains/{id}/verify
对于 {id},请使用其完全限定的域名指定该域。
名称
说明
Authorization
Bearer {token}。必需。
Content-Type
application/json
请求正文
响应
如果成功,此方法在响应正文中返回 200 OK 响应代码和 domain 对象。
示例
请求
POST https://graph.microsoft.com/beta/domains/contoso.com/verify
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
await graphClient.Domains["{domain-id}"]
.Verify()
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
await client.api('/domains/contoso.com/verify')
.version('beta')
.post();
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/domains/contoso.com/verify"]]];
[urlRequest setHTTPMethod:@"POST"];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
graphClient.domains("contoso.com")
.verify()
.buildRequest()
.post();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
domainId := "domain-id"
result, err := graphClient.DomainsById(&domainId).Verify(domain-id).Post()
Import-Module Microsoft.Graph.Identity.DirectoryManagement
Confirm-MgDomain -DomainId $domainId
响应
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"authenticationType": "authenticationType-value",
"availabilityStatus": "availabilityStatus-value",
"isAdminManaged": true,
"isDefault": true,
"isInitial": true,
"isRoot": true,
"name": "contoso.com"
}