【发布时间】:2021-04-13 13:00:08
【问题描述】:
当我使用图形浏览器并执行 获取https://graph.microsoft.com/v1.0/drives/{drive-id}/root/search(q='{search-text}')?select=name,id,webUrl 然后我没有问题地得到项目ID。 但是当我想在我的应用程序中获取工作簿时
private readonly GraphServiceClient _graphServiceClient;
public GraphService(
IOptions<AzureAdOptions> azureAdOptions)
{
var confidentialClientApplication = ConfidentialClientApplicationBuilder
.Create(azureAdOptions.Value.ClientId)
.WithTenantId(azureAdOptions.Value.TenantId)
.WithClientSecret(azureAdOptions.Value.ClientSecret)
.Build();
var authProvider = new ClientCredentialProvider(confidentialClientApplication);
_graphServiceClient = new GraphServiceClient(authProvider);
}
public async Task Test()
{
try {
var range = await _graphServiceClient.Drives[{drive-id}].Items[{item-id}]
.Request()
.GetAsync();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
然后我得到一个 itemnotfound 错误,尽管输入了正确的 id。 如果我只是添加该部分,它可以找到驱动器,因此我的设置似乎没有问题。 有没有人遇到过这个问题或知道如何解决这个问题?
【问题讨论】: