2016-04-14 49 views
0

我嘗試使用soap在ms dynamics crm 4中用模板電子郵件創建一封電子郵件。 我設法創建一個簡單的電子郵件,併發送沒有問題與soapui。 但是,當我嘗試使用模板電子郵件,它不起作用。這裏是肥皂信息。Mscrm Dynamics SOAP從模板發送電子郵件

<web:Execute xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:web="http://schemas.microsoft.com/crm/2007/WebServices"> 
    <web:Request xsi:type="SendEmailFromTemplate"> 
    <web:TemplateId>EA84AF18-FC9-E11-A165-005069A6DB2</web:TemplateId> 
    <web:RegardingType>invoice</web:RegardingType> 
     <web:RegardingId>1175670-102-E61-AB42-0050569A6DB</web:RegardingId> 
      <web:Target xsi:type="TargetSendFromTemplateEmail"> 
      <web:Email> 
      <activityid>4B165B0-851-611-A42-00505696DB2</activityid> 
      </web:Email> 
     </web:Target> 
     </web:Request> 
    </web:Execute> 

我收到此錯誤:

<soap:Body><soap:Fault> 
<faultcode>soap:Client</faultcode> 
<faultstring>Server was unable to process request.</faultstring> 
<detail><error> 
<code>0x80040216</code> 
<description>An unexpected error occurred.</description> 
<type>Platform</type> 
</error></detail></soap:Fault> 

感謝你的幫助。

回答

0

我沒有4.0組織可用,但我對我的2015組織執行了消息,並在提琴手中捕獲了請求。這裏的要求是什麼樣子:

<Execute xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services"> 
    <request i:type="c:SendEmailFromTemplateRequest" xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:c="http://schemas.microsoft.com/crm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> 
     <b:Parameters xmlns:d="http://schemas.datacontract.org/2004/07/System.Collections.Generic"> 
      <b:KeyValuePairOfstringanyType> 
       <d:key>TemplateId</d:key> 
       <d:value i:type="e:guid" xmlns:e="http://schemas.microsoft.com/2003/10/Serialization/">00000000-0000-0000-0000-000000000000</d:value> 
      </b:KeyValuePairOfstringanyType> 
      <b:KeyValuePairOfstringanyType> 
       <d:key>RegardingType</d:key> 
       <d:value i:nil="true"/> 
      </b:KeyValuePairOfstringanyType> 
      <b:KeyValuePairOfstringanyType> 
       <d:key>RegardingId</d:key> 
       <d:value i:type="e:guid" xmlns:e="http://schemas.microsoft.com/2003/10/Serialization/">00000000-0000-0000-0000-000000000000</d:value> 
      </b:KeyValuePairOfstringanyType> 
      <b:KeyValuePairOfstringanyType> 
       <d:key>Target</d:key> 
       <d:value i:type="b:Entity"> 
        <b:Attributes> 
         <b:KeyValuePairOfstringanyType> 
          <d:key>activityid</d:key> 
          <d:value i:type="e:guid" xmlns:e="http://schemas.microsoft.com/2003/10/Serialization/">00000000-0000-0000-0000-000000000000</d:value> 
         </b:KeyValuePairOfstringanyType> 
        </b:Attributes> 
        <b:EntityState i:nil="true"/> 
        <b:FormattedValues/> 
        <b:Id>00000000-0000-0000-0000-000000000000</b:Id> 
        <b:KeyAttributes xmlns:e="http://schemas.microsoft.com/xrm/7.1/Contracts"/> 
        <b:LogicalName>email</b:LogicalName> 
        <b:RelatedEntities/> 
        <b:RowVersion i:nil="true"/> 
       </d:value> 
      </b:KeyValuePairOfstringanyType> 
     </b:Parameters> 
     <b:RequestId i:nil="true"/> 
     <b:RequestName>SendEmailFromTemplate</b:RequestName> 
    </request> 
</Execute> 

我不能完全肯定把我的頭請求看起來多麼不同針對4.0端點的頂部,但它仍然可以幫助你找出如何構建你的要求。

+0

感謝它幫助我。 – Nicolas