来宾用户邀请未发送电子邮件

时间:2019-02-28 23:41:26

标签: azure azure-active-directory

我正在使用here定义的来宾用户邀请api将来宾用户添加到我的Active Directory中。

发布请求成功后返回201响应代码,并返回以下数据:

{
   "@odata.context":"https://graph.microsoft.com/v1.0/$metadata#invitations/$entity",
   "id":"xxx",
   "inviteRedeemUrl":"https://invitations.microsoft.com/redeem/?tenant=xxx&ticket=xxx&ver=2.0",
   "invitedUserDisplayName":"xxx",
   "invitedUserType":"Guest",
   "invitedUserEmailAddress":"xxx@gmail.com",
   "sendInvitationMessage":false,
   "inviteRedirectUrl":"http://localhost:4200/",
   "status":"PendingAcceptance",
   "invitedUserMessageInfo":{
      "messageLanguage":null,
      "customizedMessageBody":null,
      "ccRecipients":[
         {
            "emailAddress":{
               "name":null,
               "address":null
            }
         }
      ]
   },
   "invitedUser":{
      "id":"xxx"
   }
}

当我使用Azure UI检查活动目录时,看到在目录中创建了用户。但是,除非我在用户界面中为用户单击重新发送邀请按钮,否则我永远不会收到邀请电子邮件。

在将请求发送到邀请api时,如何确保发送邀请电子邮件,而不必手动单击用户的“重新发送邀请”按钮?

1 个答案:

答案 0 :(得分:1)

我犯了严重错误。您需要在请求json有效负载中添加sendInvitationMessage: true属性,以便发送电子邮件。您的请求对象中允许的属性的文档位于https://docs.microsoft.com/en-us/graph/api/resources/invitation?view=graph-rest-1.0