c# - 使用插件检索电子邮件模板
问题描述
我想通过模板的 Guid 检索电子邮件标题。有什么办法可以拿到头衔吗?
这是我的代码。我也在过滤模板。
public static void TemplateLogic(IOrganizationService service, string selected_option)
{
var queryBuildInTemplates = new QueryExpression
{
EntityName = "template",
ColumnSet = new ColumnSet("templateid", "templatetypecode"),
Criteria = new FilterExpression()
};
queryBuildInTemplates.Criteria.AddCondition("templatetypecode",
ConditionOperator.Equal, "contact");
EntityCollection templateEntityCollection = service.RetrieveMultiple(queryBuildInTemplates);
}
解决方案
在上面的代码中要查询的属性列表中添加“ title ”。ColumnSet
ColumnSet = new ColumnSet("templateid", "templatetypecode", "title"),
您的代码基于“联系人templatetypecode
”的值进行过滤,这就是它使用方法的原因。service.RetrieveMultiple
如果您知道记录 id guid,即 ie templateid
,那么这是一个不同的调用。
Entity template = service.Retrieve("template", templateId, new ColumnSet(true));
new ColumnSet(true)
将查询所有属性。
推荐阅读
- startapp - StartAppSDK:展示次数减少,因为 AD_CLOSED_TOO_QUICKLY
- python - python不允许将浮点数分配给nan值
- database-connection - 连接池库的连接队列
- javascript - 如何动态创建 div 并在复选框更改时调整 div
- python - 如何在 pygame 中添加分数?
- r - R中的代理::dist
- python - 如何在python的4维字典中找到最大值
- python - 如何只允许 python 类型中的某些字符?
- jasmine - 如何获取 Jasmine 短信网关的 SMS-C 主机和端口
- elasticsearch - Elasticsearch 接收器连接器中是否支持 UpdateByQuery,或者有人可以将我引导到任何此类自定义接收器连接器以进行弹性搜索吗?