Hi Everyone,
I am trying to disable a user programmatically in a plug-in. I am using the following code snippet:
SetStateRequest setStateReq = new SetStateRequest(); setStateReq.EntityMoniker = new EntityReference("systemuser", userId); setStateReq.State = new OptionSetValue(0); setStateReq.Status = new OptionSetValue(-1); SetStateResponse response = (SetStateResponse)service.Execute(setStateReq);
The userId holds the Guid of the user needed to disable, service is an IOrganizationService.
The code runs without error, but the user does not get disabled. Any ideas what is possibly going wrong?
I don't know if it has anything to do with it, but I'm using CRM online.