列出关注的项
命名空间:microsoft.graph
列出 已 登录用户关注的项目。
此集合包含用户驱动器中的项目,以及他们有从其他驱动器进行访问的权限的项目。
权限
要调用此 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 请求
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var following = await graphClient.Me.Drive.Following
.Request()
.GetAsync();
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
let following = await client.api('/me/drive/following')
.get();
有关如何将 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/following"]]];
[urlRequest setHTTPMethod:@"GET"];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
NSError *jsonError = nil;
MSCollection *collection = [[MSCollection alloc] initWithData:data error:&jsonError];
MSGraphDriveItem *driveItem = [[MSGraphDriveItem alloc] initWithDictionary:[[collection value] objectAtIndex: 0] error:&nserror];
}];
[meDataTask execute];
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
DriveItemCollectionPage following = graphClient.me().drive().following()
.buildRequest()
.get();
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
响应
此方法返回驱动器所有者正在跟踪的项目的 driveItem 资源集合。
如果未找到任何项目,则返回一个空集合。
HTTP/1.1 200 OK
Content-type: application/json
{
"value": [
{
"id": "1312abc!1231",
"name": "March Proposal.docx",
"size": 19121,
"lastModifiedDateTime": "2017-12-12T10:40:59Z"
},
{
"id": "1312def!9943",
"name": "Vacation.jpg",
"size": 37810,
"lastModifiedDateTime": "2016-10-18T10:40:59Z"
}
]
}