Thursday, 16 July 2015

Get the Plugin DLL from Database or Managed Solution in CRM 2011/2013/2015


There might be many situations where we would want to get the Plugin.dll from Database or Managed Solution in CRM 2011/2013/2015.

Here is the way for it.

QueryExpression objQueryExpression = new QueryExpression("pluginassembly");
objQueryExpression.ColumnSet = new ColumnSet(true);
objQueryExpression.Criteria.AddCondition(new ConditionExpression("name", ConditionOperator.Equal, "CRM.Test.PluginsAndWorkflows"));
EntityCollection entCol = objSerivce.RetrieveMultiple(objQueryExpression);
byte[] assembly = Convert.FromBase64String(entCol.Entities[0]["content"].ToString());
File.WriteAllBytes(entCol.Entities[0]["name"].ToString() + ".dll", assembly);

Hope this helps.

No comments:

Post a Comment