我在网站上建立网页订阅。因此,通过表单发送订阅者并将其添加到Dynamics 365 Online中的营销列表中。
从网站的预定作业开始,我会在营销列表中请求联系人。
然后我需要向他们发送一封电子邮件,其中包含使用此属性创建的新页面以及指向该页面的链接。
所以我想将Dynamics 365 Online作为一项责任。
所以即时使用Web API和动作:SendEmailFromTemplate 不确定我是否可以使用此操作,或者我是否需要创建自定义操作。
我需要传递页面的URL,标题和文本等数据。或者只是一个字符串 - 包含所有这些内容的电子邮件正文。
所以我在CRM上创建了一个电子邮件模板,就像代码找到它一样!
这是我认为我之后的行动: https://msdn.microsoft.com/en-us/library/mt607523.aspx
如果我检查SOAP服务的文档,实际上有一些例子: https://msdn.microsoft.com/en-us/library/microsoft.crm.sdk.messages.sendemailfromtemplaterequest.aspx?cs-save-lang=1&
但我会使用Web API。
所以我试过这个:
dynamic regarding = new ExpandoObject();
var oppIndexer = regarding as IDictionary<string, Object>;
oppIndexer["contactid"] = contact.ContactId; //contact that will recive the
email.
oppIndexer["@odata.type"] = "Microsoft.Dynamics.CRM.contact";
dynamic target = new ExpandoObject();
var targetIndexer = target as IDictionary<string, Object>;
targetIndexer["torecipients"] = "myemail@outlook.com";
targetIndexer["sender"] = "mysecondemail@businessname.com";
targetIndexer["inreplyto"] = "mysecondemail@businessname.com";
targetIndexer["subject"] = "This is the subject";
targetIndexer["description"] = "This should be the body of the email";
targetIndexer["directioncode"] = true; //outgoing
targetIndexer["@odata.type"] = "Microsoft.Dynamics.CRM.email";
dynamic sendEmailFromTemplate = new ExpandoObject();
sendEmailFromTemplate.TemplateId = Guid.Parse("my-email-template-guid-inserted-here");
sendEmailFromTemplate.Regarding = regarding;
sendEmailFromTemplate.Target = target;
api.ExecuteAction("SendEmailFromTemplate", sendEmailFromTemplate);
但我得到例外:&#34;电子邮件必须至少有一个收件人才能发送&#34;当我发布它。
可能是什么问题?
我认为文档在: https://msdn.microsoft.com/en-us/library/mt607523.aspx
只需声明target和about的类型应为&#34; crmbaseentity&#34;类型。基类......
任何人都知道可能导致这种情况的原因吗?
这是电子邮件实体: https://msdn.microsoft.com/en-us/library/mt608007.aspx
对于该领域&#34; torecipients&#34;人们可以阅读:&#34;显示与收件人相对应的电子邮件地址&#34;。所以我不确定这是我应该使用的领域。如果文本是&#34;收件人带&#34;,&#34;将重新收到消息的分隔符&#34;我更确定我必须使用这个领域。
更新: 哦,这就是你发布的内容:
{
"email_activity_parties": [
{ "partyid_systemuser@odata.bind": "/systemusers(852a441c-b544-e611-80e3-c4346bc5e750)", "participationtypemask": 1 },
{ "partyid_systemuser@odata.bind": "/systemusers(852a441c-b544-e611-80e3-c4346bc5e750)", "participationtypemask": 2 }
],
"description": "description lorem ipsum",
"subject": "rubrik",
"regardingobjectid_opportunity_email@odata.bind": "/opportunities(e9e6eb64-9c4c-e611-80e4-c4346bc58294)"
}
如果我愿意改变它,那么它符合我的需要。我不认为我会利用机会。或者我必须吗? SendEmailFromTemplate操作有三个参数:https://msdn.microsoft.com/en-us/library/mt607523.aspx TemplateId,关注和目标。我将此代码更改为(未经测试)
{
"TemplateId": "id-for-email-template",
"Regarding": [ { "contactid@odata.bind": "/contacts(contact-guid-X)" } ],
"Target": {
"email_activity_parties": [
{ "partyid_systemuser@odata.bind": "/systemusers(systemuser-guid-Y)", "participationtypemask": 1 }, //1 is "sender"
{ "contactid@odata.bind": "/contacts(contact-guid-X)", "participationtypemask": 2 } // 2 is "to"
],
"description": "description lorem ipsum",
"subject": "rubrik",
"contactid@odata.bind": "/contacts(contact-guid-X)"
}
}
我会试试这样的东西..
答案 0 :(得分:0)
电子邮件是一项活动,所有活动将分为活动指针+活动方。 regardingobject
也会将您toParty
用于//create activityparty
Entity Fromparty = new Entity("activityparty");
Entity Toparty = new Entity("activityparty");
//To set to Contact
Toparty["partyid"]= new EntityReference("contact", _ contactid));
//From set to User
Fromparty["partyid"]= new EntityReference("systemuser", _From));
//create email Object and set attributes
Entity email = new Entity("email");
email["from"] = new Entity[] { Fromparty };
email["to"] = new Entity[] { Toparty };
email["directioncode"] = true;
//setting the Regarding as Contact
email["regardingobjectid"] = new EntityReference("contact", _contactid);
的联系人与torecipients
放在一起。
to
What you have to do The e-mail must have at least one recipient before it can be sent
字段,仅使用//Create email
var email = new JObject(
new JProperty("email_activity_parties",
new JArray(
new JObject(
new JProperty("partyid_systemuser@odata.bind", "/systemusers (<guid>)"),
new JProperty("participationtypemask", 1)),
new JObject(
new JProperty("partyid_systemuser@odata.bind", "/systemusers(<guid>)"),
new JProperty("participationtypemask", 2)))),
new JProperty("description", txtEmail.Text.Replace("\r\n","<br>")),
new JProperty("subject", "Test Subject"),
new JProperty("regardingobjectid_opportunity_email@odata.bind", "/opportunities(<guid>)"));
。
错误import React from 'react';
import { connect } from 'react-redux' ;
import { reduxForm } from 'redux-form';
class Example extends React.Component {
...
}
function mapStateToProps(state) {
return { ... }
}
function mapDispatchToProps(dispatch) {
return { ... }
}
export default connect(mapStateToProps, mapDispatchToProps)(reduxForm({
form: 'formname',
validate
})(Example));
将消失。
更新:
我们必须使用web api的导航属性。
<NavLink className="nav-link-gdc" activeClassName="nav-link-gdc-selected" to="/home">HOME</NavLink>