gpt4 book ai didi

c# - Azure AD,无法针对邀请设置附加数据

转载 作者:行者123 更新时间:2023-12-03 00:21:19 25 4
gpt4 key购买 nike

我正在使用 GraphServiceClient 创建邀请以在 Azure Ad 中添加 guest ,并且我需要在邀请中添加 AnotherData。

var invitation = new Microsoft.Graph.Invitation
{
InvitedUserDisplayName = "John Doe",
InvitedUserEmailAddress = "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ddb7b2b5b3f3b9b2b89da9b8aea9f3beb2b0" rel="noreferrer noopener nofollow">[email protected]</a>",
InviteRedirectUrl = "https://test.com",
SendInvitationMessage = false,
AdditionalData = new Dictionary<string, object>
{
{"JobTitle", "Doctor"},
{"UsageLocation", "FR"}
}
};

await graphClient.Invitations
.Request()
.AddAsync(invitation);

John Doe 在 Azure Ad 中创建为 guest ,但 JobTitle 和 UsageLocation 为空。是否可以根据邀请或仅针对用户添加附加数据?

问候

最佳答案

您似乎正在尝试使用 Microsoft Graph API SDK 邀请 guest 用户以及 AdditionalData

你可以尝试这样:

            InvitedUserMessageInfo info = new InvitedUserMessageInfo();
object obj = new object();
obj = "Testing Another Additional Data";

var dict = new Dictionary<string, object>();
dict.Add("Data1", obj);
dict.Add("Data2", obj);
info.AdditionalData = dict;




var invitation = new Invitation
{
InvitedUserEmailAddress = "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3246574146575f535b5e725d47465e5d5d591c515d5f" rel="noreferrer noopener nofollow">[email protected]</a>",
InviteRedirectUrl = "https://yourapplicationurl.com",
InvitedUserMessageInfo = info
};

await _graphServiceClient.Invitations
.Request()
.AddAsync(invitation);

Note: Make sure you have required permission on your Tenant as specified on Microsoft official document

希望能有所帮助。如果您还有任何疑问,请告诉我。

关于c# - Azure AD,无法针对邀请设置附加数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68365395/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com