I’ve setup clean on premise installation of Dynamics 365 v9.0. When I tried to create new workflow I got this error:
Could not load file or assembly ‘file:///C:\Program Files\Dynamics 365\server\bin\assembly\Microsoft.Dynamics.Service.Plugins.dll’ or one of its dependencies. Access is denied.
Issue was that folder was not inheriting security permissions from C:\Program Files\Dynamics 365\Server\bin. Right click on assembly folder -> Properties -> Security tab -> Advanced -> Click on Enable inheritance button.
After that I needed to restart IIS. Works fine then!
If we did some changes on Account entity using SDK, we can very simply publish them. There is PublishXmlRequest message provided by SDK.
// Publish Account entity
string accountEntityXml = "Account";
PublishXmlRequest publishxmlrequest = new PublishXmlRequest
ParameterXml = String.Format(accountEntityXml)
We can use ParameterXml to define which solution component to publish in the request.
If we want to publish all customization we will use PublishAllXmlRequest.
PublishAllXmlRequest publishAllReq = new PublishAllXmlRequest();
I wanted to have step in workflow process where draft Email will be created using template.
There are two out of the box options regarding Email step in workflow. We can create draft email with specified body and subject. Other option is to send email using some workflow.
In order to create draft email with rendered template I created custom workflow activity which will execute InstantiateTemplateRequest, and for a result return rendered subject and message body.
This is a part of workflow activity:
InstantiateTemplateRequest instTemplateReq = new InstantiateTemplateRequest
TemplateId = templateId,
ObjectId = contactId,
ObjectType = "contact"
InstantiateTemplateResponse instTemplateResp = (InstantiateTemplateResponse)service.Execute(instTemplateReq);
Three parameters are sent, Template Id (Guid of email template), Contact Id as Object Id and contact Object Type. Here is rendered template of Contact type.
After executing request we need to pull out result details from InstantiateTemplateResponse object:
Entity template = instTemplateResp.EntityCollection.Entities;
if (template != null && template.Attributes.Contains("description"))
In last workflow step I added Create new email step where Subject and Description are applied on new email record.
I was looking for Email senders/receivers in [ActivityPartyBase] table. To identify what Email entity field is related to some ActivityParty we are using column [ParticipationTypeMask] in table [ActivityPartyBase]. Here are possible values for this column:
|Activity party type
||Specifies the sender.
||Specifies the recipient in the To field.
||Specifies the recipient in the Cc field.
||Specifies the recipient in the Bcc field.
||Specifies a required attendee.
||Specifies an optional attendee.
||Specifies the activity organizer.
||Specifies the regarding item.
||Specifies the activity owner.
||Specifies a resource.
||Specifies a customer.
||Specifies a partner.
Status and Status reason are both optionsets. Option set have an int value and a text value. The text value is meta data and the int value is held in the database on the database field.
Default entities have two status values
Status reason have different default values
Taken from Hosk’s blog
This errors occurred when I configured incoming email profile in Email router 2015. To resolve this I had to configure exchange impersonation in Exchange 2013 for email router account.
Exchange Impersonation enables a caller to impersonate a given user account. This enables the caller to perform operations by using the permissions that are associated with the impersonated account, instead of the permissions that are associated with the caller’s account.
This is command that should be executed within Exchange power shell console:
New-ManagementRoleAssignment -Name:”CRM mail account” -Role:ApplicationImpersonation -User:emailrouter
After fresh installation of CRM email router 2015 (07.00.0000.3543) I setup all necessary configuration. It is connected to CRM organization but I got following error:
#16192 – The Email Router service could not run the service main background thread. The Email Router service cannot continue and will now shut down. System.Configuration.ConfigurationErrorsException: System information was not specified in the Email Router service configuration file. The Email Router service cannot continue and will now shut down. —> System.UnauthorizedAccessException: Access to the path ‘C:\Program Files\Microsoft CRM Email\Service\Microsoft.Crm.Tools.EmailAgent.xml’ is denied.
After short investigation I figured out that email router service and CRM installations have different version. Actually CRM has already upgraded to version 07.0.0002.0053 (0.2 Update installed). So solution was to upgrade email router to the same version. Everything works OK then 🙂