Reputation: 65
Without using the plugin registration tool or the CRM customizations form, how can you delete SDK message steps?
Is this possible in code using the XRM SDK. Also can plugins be deleted in code?
Upvotes: 1
Views: 1314
Reputation: 2980
To get all the steps:
var step = xrmServiceContext.SdkMessageSet.FirstOrDefault(step => step.Name == "foobar");
To get all the plugin assemblies:
var plugin = xrmServiceContext.PluginAssemblySet.FirstOrDefault(p => p.Name == "foobar");
Once you get the GUIDs you would delete them like any other entity:
service.Delete(PluginAssembly.EntityLogicalName, plugin.Id);
If there are any dependencies, you would need to traverse up the dependency list and delete them first. Use RetrieveDependentComponentsRequest to fetch a list of all dependencies.
Upvotes: 3