dynamics-crmdynamics-crm-onlinedynamics-crm-365

Publish a Dynamics CRM Theme programatically?


Is it possible to publish a Dynamics CRM Theme programatically ? I've tried setting the "isdefaulttheme" flag to true but this causes an exception.

I can't see an SDK message to do it - but it can be done from the CRM UI so there must be a way somehow :-)


Solution

  • You are looking for the PublishThemeRequest.

    https://learn.microsoft.com/en-us/dotnet/api/microsoft.crm.sdk.messages.publishthemerequest?view=dynamics-general-ce-9

    PublishThemeRequest request = new PublishThemeRequest();
    request.Target = new EntityReference(Theme.EntityLogicalName, defTheme.Id);
    service.Execute(request);