web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

CRM Dynamics - disable plugin step using C#

(0) ShareShare
ReportReport
Posted on by 25

i am working on Microsoft Dynamics 365 on-premises and i want to develop a custom tool using C# that can disable the plugin steps, i tried the below code but it did not work with me, the code executed to the end but nothing happen .

any recommendations please ?

public string EnablePlugin(IOrganizationService orgService, bool enable, string pluginName)

{

var qe = new QueryExpression("sdkmessageprocessingstep");

qe.ColumnSet.AddColumns("sdkmessageprocessingstepid", "name");
qe.Criteria = new FilterExpression();
qe.Criteria.AddCondition("name", ConditionOperator.Equal, pluginName);

var step = orgService.RetrieveMultiple(qe).Entities.First();

var pluginId = (Guid)step.Attributes["sdkmessageprocessingstepid"];
MessageBox.Show(pluginId.ToString());
int pluginStateCode = enable ? 0 : 1;

int pluginStatusCode = enable ? 1 : 2;

OrganizationResponse res = orgService.Execute(new SetStateRequest

{

EntityMoniker = new EntityReference("sdkmessageprocessingstep", pluginId),

State = new OptionSetValue(pluginStateCode),

Status = new OptionSetValue(pluginStatusCode)

});
return "Ok";

}

I have the same question (0)
  • Pradip Raj Profile Picture
    327 on at

    Hi Eslam,

    The below link will help you to resolve an issue :

    blog.magnetismsolutions.com/.../crm-2011-automatically-enable-disable-plug-ins-and-workflows

    social.microsoft.com/.../programmatically-disabling-the-plugin-step

    Thanks

    Pradip

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 101 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 83

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans