发送邮件报User does not have send-as privilege for错误的解决办法

我是微软Dynamics 365 & Power Platform方面的工程师罗勇,也是2015年7月到2018年6月连续三年Dynamics CRM/Business Solutions方面的微软最有价值专家(Microsoft MVP),欢迎关注我的微信公众号 MSFTDynamics365erLuoYong ,回复422或者20200729可方便获取本文,同时可以在第一间得到我发布的最新博文信息,follow me!

 我不用实时工作流来发邮件,见到过有人这么做.然后看到的报错信息是 You do not have sufficient privileges to send email as the selected queue. 类似如下:

更加具体的错误信息如下:

Exception type: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]
Message: User does not have send-as privilege for.Detail: 
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
  <ActivityId>1408e4e5-10b0-48ab-b3b4-0e03d33ab434</ActivityId>
  <ErrorCode>-2147203057</ErrorCode>
  <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
    <KeyValuePairOfstringanyType>
      <d2p1:key>ApiExceptionSourceKey</d2p1:key>
      <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">Plugin/Microsoft.Crm.Common.ObjectModel.EmailService</d2p1:value>
    </KeyValuePairOfstringanyType>
    <KeyValuePairOfstringanyType>
      <d2p1:key>ApiOriginalExceptionKey</d2p1:key>
      <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">Microsoft.Crm.CrmException: User does not have send-as privilege for. ---&gt; Microsoft.Crm.CrmException: User does not have send-as privilege for.
   at Microsoft.Crm.ObjectModel.ObjectModelSendManager.CheckSendOnBehalfOf(ActivityParty sender)
   at Microsoft.Crm.Common.ObjectModel.EmailService.&lt;&gt;c__DisplayClass33_0.&lt;Send&gt;b__0()
   at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties)
   at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func)
   --- End of inner exception stack trace ---
   at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.Pipeline.&lt;&gt;c__DisplayClass3_0.&lt;RunStep&gt;b__0()</d2p1:value>
    </KeyValuePairOfstringanyType>
    <KeyValuePairOfstringanyType>
      <d2p1:key>ApiStepKey</d2p1:key>
      <d2p1:value xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/" i:type="d4p1:guid">05cdbb1b-ea3e-db11-86a7-000a3a5473e8</d2p1:value>
    </KeyValuePairOfstringanyType>
    <KeyValuePairOfstringanyType>
      <d2p1:key>ApiDepthKey</d2p1:key>
      <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:int">3</d2p1:value>
    </KeyValuePairOfstringanyType>
    <KeyValuePairOfstringanyType>
      <d2p1:key>ApiActivityIdKey</d2p1:key>
      <d2p1:value xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/" i:type="d4p1:guid">1408e4e5-10b0-48ab-b3b4-0e03d33ab434</d2p1:value>
    </KeyValuePairOfstringanyType>
    <KeyValuePairOfstringanyType>
      <d2p1:key>ApiPluginSolutionNameKey</d2p1:key>
      <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">System</d2p1:value>
    </KeyValuePairOfstringanyType>
    <KeyValuePairOfstringanyType>
      <d2p1:key>ApiStepSolutionNameKey</d2p1:key>
      <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">System</d2p1:value>
    </KeyValuePairOfstringanyType>
    <KeyValuePairOfstringanyType>
      <d2p1:key>ApiExceptionCategory</d2p1:key>
      <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">ClientError</d2p1:value>
    </KeyValuePairOfstringanyType>
    <KeyValuePairOfstringanyType>
      <d2p1:key>ApiExceptionMesageName</d2p1:key>
      <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">UserDoesNotHaveSendAsForQueue</d2p1:value>
    </KeyValuePairOfstringanyType>
    <KeyValuePairOfstringanyType>
      <d2p1:key>ApiExceptionHttpStatusCode</d2p1:key>
      <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:int">400</d2p1:value>
    </KeyValuePairOfstringanyType>
  </ErrorDetails>
  <HelpLink>http://go.microsoft.com/fwlink/?LinkID=398563&amp;error=Microsoft.Crm.CrmException%3a8004480f&amp;client=platform</HelpLink>
  <Message>User does not have send-as privilege for.</Message>
  <Timestamp>2019-01-18T06:59:57.9502203Z</Timestamp>
  <ExceptionRetriable>false</ExceptionRetriable>
  <ExceptionSource i:nil="true" />
  <InnerFault>
    <ActivityId>1408e4e5-10b0-48ab-b3b4-0e03d33ab434</ActivityId>
    <ErrorCode>-2147203057</ErrorCode>
    <ErrorDetails xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
    <HelpLink i:nil="true" />
    <Message>User does not have send-as privilege for.</Message>
    <Timestamp>2019-01-28T06:59:57.9502203Z</Timestamp>
    <ExceptionRetriable>false</ExceptionRetriable>
    <ExceptionSource i:nil="true" />
    <InnerFault i:nil="true" />
    <OriginalException i:nil="true" />
    <TraceText i:nil="true" />
  </InnerFault>
  <OriginalException i:nil="true" />
  <TraceText>[Microsoft.Xrm.Sdk.Workflow: Microsoft.Xrm.Sdk.Workflow.Activities.SendEmail]
[SendEmailStep5]
</TraceText>
</OrganizationServiceFault>

真的是缺少如下权限吗? Buiness Management > Send Email as Another User .

 实际上并不是,. 参考帖子 Workflow to send email as queue: You do not have sufficient privileges to send email as the selected queue 实际上是当前用户对这个邮件的发件人 是一个queue缺乏读取权限,添加权限后即可. 从我的测试来看,以某个queue作为发件人(From) 并不需要用户具有 Send Email as Another User 这个权限.

那什么时候需要 Send Email as Another User 这个权限呢?我进行了测试,我得测试结果和这个帖子 Dynamics 365 – Error while sending mail on behalf of another user 的结论是一样的.

假设A用户发送邮件,发件人(From)是B, 那么A用户需要具有 Send Email as Another User , B用户还需要在个人设置中中选[Allow other Microsoft Dynamics 365 users to send email on your behalf]选项.

猜你喜欢

转载自www.cnblogs.com/luoyong0201/p/Dynamics_365_Solve_Send_Email_Error_User_does_not_have_send_as_privilege_for.html