locked
Programmatically Disabling the Plugin Step RRS feed

  • Question

  • Hi all,
    I want to disable my plugin step programmatically. I'm importing thousands of recordsthrough my custom import tool.
    I want to disable some plugin through it. like Audit log plugin.
    Please Suggest how to do it?

    Dare to promise
    Wednesday, September 2, 2009 4:54 AM

Answers

  • from the plguin registration tool codebase:
    public static void UpdateStepStatus(CrmOrganization org, Guid stepId, bool isEnable)
    {
        if (org == null)
        {
            throw new ArgumentNullException("org");
        }
        else if (stepId == Guid.Empty)
        {
            throw new ArgumentException("Invalid Guid", "stepId");
        }
    
        SetStateSdkMessageProcessingStepRequest request = new SetStateSdkMessageProcessingStepRequest();
        request.EntityId = stepId;
        if (isEnable)
        {
            request.SdkMessageProcessingStepState = SdkMessageProcessingStepState.Enabled;
        }
        else
        {
            request.SdkMessageProcessingStepState = SdkMessageProcessingStepState.Disabled;
        }
        request.SdkMessageProcessingStepStatus = -1;
        org.CrmService.Execute(request);
    
        return;
    }

    Wednesday, September 2, 2009 6:14 AM