关注驱动器项
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
关注 driveItem 。
注意: 若要取消关注项目,请参阅"取消 关注项目"。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
Files.Read、Files.ReadWrite、Files.Read.All、Files.ReadWrite.All、Sites.Read.All、Sites.ReadWrite.All
委派(个人 Microsoft 帐户)
不支持。
应用程序
Files.Read.All、Files.ReadWrite.All、Sites.Read.All、Sites.ReadWrite.All
HTTP 请求
POST /drives/{drive-id}/items/{item-id}/follow
POST /groups/{group-id}/drive/items/{item-id}/follow
POST /me/drive/items/{item-id}/follow
POST /sites/{site-id}/drive/items/{item-id}/follow
POST /users/{user-id}/drive/items/{item-id}/follow
请求正文
无需请求正文。
响应
此方法返回所关注项目的 DriveItem。
示例
本示例遵循由 标识的项目 {item-id} 。
POST /me/drive/items/{item-id}/follow
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
await graphClient.Me.Drive.Items["{driveItem-id}"]
.Follow()
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
await client.api('/me/drive/items/{item-id}/follow')
.version('beta')
.post();
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/me/drive/items/{item-id}/follow"]]];
[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.me().drive().items("{item-id}")
.follow()
.buildRequest()
.post();
HTTP/1.1 200 OK
Content-type: application/json
{
"id": "1312abc!1231",
"name": "March Proposal.docx",
"size": 19121,
"lastModifiedDateTime": "2017-12-12T10:40:59Z"
}