关注驱动器项
本文内容
命名空间:microsoft.graph
关注 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();
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档 。
const options = {
authProvider,
};
const client = Client.init(options);
await client.api('/me/drive/items/{item-id}/follow')
.post();
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档 。
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
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];
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档 。
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
graphClient.me().drive().items("{item-id}")
.follow()
.buildRequest()
.post();
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档 。
HTTP/1.1 200 OK
Content-type: application/json
{
"id": "1312abc!1231",
"name": "March Proposal.docx",
"size": 19121,
"lastModifiedDateTime": "2017-12-12T10:40:59Z"
}