driveItem:checkin
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
签入签出的 driveItem 资源,使文档的版本可供其他人使用。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
Files.ReadWrite、Files.ReadWrite.All、Sites.ReadWrite.All
委派(个人 Microsoft 帐户)
Files.ReadWrite、Files.ReadWrite.All
应用程序
Files.ReadWrite.All、Sites.ReadWrite.All
HTTP 请求
POST /drives/{driveId}/items/{itemId}/checkin
POST /groups/{groupId}/drive/items/{itemId}/checkin
POST /me/drive/items/{item-id}/checkin
POST /sites/{siteId}/drive/items/{itemId}/checkin
POST /users/{userId}/drive/items/{itemId}/checkin
请求正文
在请求正文中,提供具有以下参数的 JSON 对象。
名称
值
说明
checkInAs
string
可选。 签入操作完成后文档的状态。 可以是 published 或未指定。
comment
string
与此版本相关联的签入注释。
示例
本示例签入由 {item-id} 标识的文件。
POST /drives/{drive-id}/items/{item-id}/checkin
Content-Type: application/json
{
"comment": "Updating the latest guidelines"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var comment = "Updating the latest guidelines";
await graphClient.Drives["{drive-id}"].Items["{driveItem-id}"]
.Checkin(null,comment)
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
const checkin = {
comment: 'Updating the latest guidelines'
};
await client.api('/drives/{drive-id}/items/{item-id}/checkin')
.version('beta')
.post(checkin);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/drives/{drive-id}/items/{item-id}/checkin"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
NSString *comment = @"Updating the latest guidelines";
payloadDictionary[@"comment"] = comment;
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();
String comment = "Updating the latest guidelines";
graphClient.drives("{drive-id}").items("{item-id}")
.checkin(DriveItemCheckinParameterSet
.newBuilder()
.withCheckInAs(null)
.withComment(comment)
.build())
.buildRequest()
.post();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.New()
comment := "Updating the latest guidelines"
requestBody.SetComment(&comment)
driveId := "drive-id"
driveItemId := "driveItem-id"
graphClient.DrivesById(&driveId).ItemsById(&driveItemId).Checkin(drive-id, driveItem-id).Post(requestBody)
Import-Module Microsoft.Graph.Files
$params = @{
Comment = "Updating the latest guidelines"
}
Invoke-MgCheckinDriveItem -DriveId $driveId -DriveItemId $driveItemId -BodyParameter $params
响应
如果成功,该 API 调用会返回 204 No content。
HTTP/1.1 204 No content