启动 synchronizationJob
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
启动现有同步作业。 如果作业已暂停,它将从暂停点开始继续处理更改。 如果作业隔离,则清除隔离状态。 请勿创建脚本以在启动作业运行时持续调用它,因为这可能会导致服务停止运行。 仅在作业当前已暂停或处于隔离状态时,才使用启动作业。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
Directory.ReadWrite.All
委派(个人 Microsoft 帐户)
不支持。
应用程序
Application.ReadWrite.OwnedBy、Directory.ReadWrite.All
HTTP 请求
POST /servicePrincipals/{id}/synchronization/jobs/{jobId}/start
名称
类型
说明
Authorization
string
Bearer {token}。必需。
请求正文
请勿提供此方法的请求正文。
响应
如果成功,则返回 响应 204 No Content 。 它不会在响应正文中返回任何内容。
示例
请求
请求示例如下所示。
POST https://graph.microsoft.com/beta/servicePrincipals/{id}/synchronization/jobs/{jobId}/start
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
await graphClient.ServicePrincipals["{servicePrincipal-id}"].Synchronization.Jobs["{synchronizationJob-id}"]
.Start()
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
await client.api('/servicePrincipals/{id}/synchronization/jobs/{jobId}/start')
.version('beta')
.post();
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/servicePrincipals/{id}/synchronization/jobs/{jobId}/start"]]];
[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.servicePrincipals("{id}").synchronization().jobs("{jobId}")
.start()
.buildRequest()
.post();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
servicePrincipalId := "servicePrincipal-id"
synchronizationJobId := "synchronizationJob-id"
graphClient.ServicePrincipalsById(&servicePrincipalId).Synchronization().JobsById(&synchronizationJobId).Start(servicePrincipal-id, synchronizationJob-id).Post()
Import-Module Microsoft.Graph.Applications
Start-MgServicePrincipalSynchronizationJob -ServicePrincipalId $servicePrincipalId -SynchronizationJobId $synchronizationJobId
响应
响应示例如下所示。
HTTP/1.1 204 No Content