通过 Microsoft Graph 和 App Credentials 添加来宾邀请给 Method Not Found
Add guest invitation via Microsoft Graph and App Credentials give Method Not Found
我正在尝试开发一个类似于 question
中要求的应用程序
我已经在 Azure 门户中为应用程序配置了适当的权限,并遵循了指南 here。
应用程序似乎正在使用范围 https://graph.microsoft.com/.default
从 AD 获取正确的令牌
调用后,返回“找不到方法”错误。
Code: UnknownError
Message: Method not allowed
Inner error:
AdditionalData:
date: 2020-10-11T21:36:03
request-id: ...
client-request-id: ...
ClientRequestId: ...
request-id、client-request-id 和 ClientRequestId 都具有相同的值。
有没有办法解决返回的 ID 出现此错误的原因?
我的配置中是否缺少某些内容?
此应用程序的目的是为我们举办的 Give Camp 自助注册志愿者,并将使用 Microsoft Teams 作为协作工具。如果有更好的方法来做到这一点,我愿意接受建议。
代码可以在这里找到https://github.com/swogc/GiveCamp-Teams
授予应用的权限:
看来权限和post都可以。如果应用没有用户授权,可以参考here and use Client credentials provider调用MS图API.
string[] scopes = { "https://graph.microsoft.com/.default" };
IConfidentialClientApplication confidentialClientApplication = ConfidentialClientApplicationBuilder
.Create(clientId)
.WithTenantId(tenantID)
.WithClientSecret(clientSecret)
.Build();
ClientCredentialProvider authProvider = new ClientCredentialProvider(confidentialClientApplication, scopes);
GraphServiceClient graphClient = new GraphServiceClient(authProvider);
var invitation = new Invitation
{
InvitedUserEmailAddress = "pamela@xxx",
InviteRedirectUrl = "https://southwestohiogivecamp.org",
};
await graphClient.Invitations.Request().AddAsync(invitation);
我正在尝试开发一个类似于 question
中要求的应用程序我已经在 Azure 门户中为应用程序配置了适当的权限,并遵循了指南 here。
应用程序似乎正在使用范围 https://graph.microsoft.com/.default
调用后,返回“找不到方法”错误。
Code: UnknownError
Message: Method not allowed
Inner error:
AdditionalData:
date: 2020-10-11T21:36:03
request-id: ...
client-request-id: ...
ClientRequestId: ...
request-id、client-request-id 和 ClientRequestId 都具有相同的值。
有没有办法解决返回的 ID 出现此错误的原因? 我的配置中是否缺少某些内容?
此应用程序的目的是为我们举办的 Give Camp 自助注册志愿者,并将使用 Microsoft Teams 作为协作工具。如果有更好的方法来做到这一点,我愿意接受建议。
代码可以在这里找到https://github.com/swogc/GiveCamp-Teams
授予应用的权限:
看来权限和post都可以。如果应用没有用户授权,可以参考here and use Client credentials provider调用MS图API.
string[] scopes = { "https://graph.microsoft.com/.default" };
IConfidentialClientApplication confidentialClientApplication = ConfidentialClientApplicationBuilder
.Create(clientId)
.WithTenantId(tenantID)
.WithClientSecret(clientSecret)
.Build();
ClientCredentialProvider authProvider = new ClientCredentialProvider(confidentialClientApplication, scopes);
GraphServiceClient graphClient = new GraphServiceClient(authProvider);
var invitation = new Invitation
{
InvitedUserEmailAddress = "pamela@xxx",
InviteRedirectUrl = "https://southwestohiogivecamp.org",
};
await graphClient.Invitations.Request().AddAsync(invitation);