【问题标题】:Retrieving Email Template using plugin使用插件检索电子邮件模板
【发布时间】:2021-01-18 19:21:12
【问题描述】:

我想通过模板的 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);
}

【问题讨论】:

  • 任何后续问题?

标签: c# plugins dynamics-crm crm


【解决方案1】:

在上面代码中ColumnSet要查询的属性列表中添加“title”。

ColumnSet = new ColumnSet("templateid", "templatetypecode", "title"),

您的代码基于templatetypecode 过滤“contact”的值,这就是它使用service.RetrieveMultiple 方法的原因。

如果您知道记录 id guid,即templateid,那么这是一个不同的调用。

Entity template = service.Retrieve("template", templateId, new ColumnSet(true));

new ColumnSet(true) 将查询所有属性。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-31
    相关资源
    最近更新 更多