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

标签 c# azure asp.net-core azure-active-directory

我正在使用 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/

相关文章:

c# - 如何使用 Azure 媒体服务 v3 将空或空白的 videolayer 生成为从 .mp3(或其他纯音频)文件编码的 .mp4?

c# - 如何将非托管对话框设置为 WinForm 窗体的所有者?

c# - 在 .net core 中使用 linq2db 时获取 "Could not load file or assembly ' System.EnterpriseServices""

c# - .NET CLI 是否仅适用于 .NET Core?

c# - 在 SignalR ASP.NET Core 3.0 中尝试使用 IAsyncEnumerable Catch

c# - 如何使用 IHttpClientFactory 刷新 token

c# - Unity3d开发: JNI ERROR (app bug): accessed stale local reference 0x200001 (index 0 in a table of size 0)

.net - 有没有办法防止 Azure 限制我的 csv 读取速度?

c# - Azure 生产环境中数据库迁移的最佳实践

azure - 每个容器的精细存储帐户成本监控