我正在尝试对Microsft Graph进行基本调用。
https://graph.microsoft.com/v1.0/me/
我已经通过C#SDK并直接使用rest和两个调用来完成此操作,但出现以下错误
消息=“资源'f9d58168-4b3e-4948-9133-6c978d1ab18a'不存在,或者其查询的参考属性对象之一不存在。”
错误响应内容流中返回的完整错误消息
{
"error": {
"code": "Request_ResourceNotFound",
"message": "Resource 'f9d58168-4b3e-4948-9133-6c978d1ab18a' does not exist or one of its queried reference-property objects are not present.",
"innerError": {
"request-id": "80af6aec-5052-49ab-890c-273fea5c65ba",
"date": "2017-07-31T06:08:37"
}
}
}
Run Code Online (Sandbox Code Playgroud)
GUID可以不同。
当我通过“图形资源管理器”执行此操作时,它工作正常。
这是我用来获取应用程序凭据的代码
private ClientCredential GetCredentials()
{
return new ClientCredential(_azureAdOptions.ClientId, _azureAdOptions.ClientSecret);
}
private AuthenticationContext GetContext(string userObjectId)
{
return new AuthenticationContext($"{_azureAdOptions.AadInstance}{_azureAdOptions.Tenant}", GetTokenCache(userObjectId));
}
private DistributedTokenCache GetTokenCache(string userObjectId)
{
return new DistributedTokenCache(userObjectId, _azureAdOptions.ClientId, _distributedCache, _loggerFactory);
}
public async Task<AuthenticationResult> GetToken(string userObjectId, string resourceId)
{
AuthenticationResult result; …Run Code Online (Sandbox Code Playgroud) 有谁知道为什么我会收到此错误?这是我的 SendGrid 输出绑定:
{
"bindings": [
{
"name": "docId",
"type": "queueTrigger",
"direction": "in",
"queueName": "movedocument",
"connection": "cpoffice365_STORAGE"
},
{
"type": "sendGrid",
"name": "message",
"apiKey": "<MYSENDGRIDKEY>",
"from": "<MYFROMEMAIL>",
"direction": "out"
}
],
"disabled": false
}
Run Code Online (Sandbox Code Playgroud)
我的代码可以编译,但随后会在日志中抛出此错误:
Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.<MYFUNCTIONAME>'. Microsoft.Azure.WebJobs.Host: '<MYSENDGRIDKEY>' does not resolve to a value.
Run Code Online (Sandbox Code Playgroud)