Export emal template from CRM4 to CRM 2016

294 views Asked by At

I need to export email templates from CRM 4 directly into CRM 2016. Can't go over the complete upgrade process so my best guess would be to export using services, connect to CRM 4 and then import into CRM 2016. The problem seems to be the import into CRM 2016 which throws a faultexception. But before I would start looking into to this I tried to recreate a template that I created in CRM 2016. Using the services but this also doesn't seem so easy to do..the process creates a copy of the email template but subject and body are missing. Does this need to be casted to something esle? What could be the problem here?

This is the code I used:

ColumnSet cols = new ColumnSet(new string[] { Template.AttributeLogicalNames.Title, Template.AttributeLogicalNames.Subject,
            Template.AttributeLogicalNames.TemplateTypeCode, Template.AttributeLogicalNames.IsPersonal,
            Template.AttributeLogicalNames.LanguageCode, Template.AttributeLogicalNames.Body });

            QueryExpression query = new QueryExpression(Template.EntityLogicalName);
            query.ColumnSet = cols;

            query.Criteria = new FilterExpression();
            query.Criteria.AddCondition("title", ConditionOperator.Equal, "TestTemplate Candidate");

            EntityCollection results = _service.RetrieveMultiple(query);

            foreach (var item in results.Entities)
            {
                Template template = new Template() { Title = ((Template)item).Title + "-2", Subject = ((Template)item).Subject,
                    TemplateTypeCode = ((Template)item).TemplateTypeCode, IsPersonal = ((Template)item).IsPersonal,
                    LanguageCode = ((Template)item).LanguageCode,Body = ((Template)item).Body
                };
                Guid templateid = _service.Create(template);
                Console.WriteLine("Template created with Guid: {0}", templateid);
            }
1

There are 1 answers

0
Sven On

It seems I was missing some fields: subjectpresentationxml, presentationxml, generatetypecode