locked
User does not have the privilege to act on behalf another user - Error RRS feed

  • Question

  • Hi,

    We have MS CRM 2015 online integration with Azure portal.

    From Azure portal connecting to CRM and retrieving Case entity records showing in Azure.

    But a user while trying to update the Case record in Azure portal getting the error.

    The error log saying:

    Microsoft.Xrm.Sdk.SaveChangesException: An error occured while processing this request. ---> System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: User does not have the privilege to act on behalf another user.

    This user having appropriate BU and Security Roles in CRM.

    Another observation is some other user can able to update the records in portal with the same permissions.

    Please let me know if anybody having experience in this issue. This is blocking issue for us please help.

     

    Yadav

    Wednesday, August 5, 2015 1:06 PM

All replies

  • Hello,

    Could you please provide code that you use to instantiate IOrganizationService instance?


    Dynamics CRM MVP
    My blog

    Wednesday, August 5, 2015 1:14 PM
    Moderator
  • Hi,

    The following is the code using to connect to the CRM 2015 online

     public class CRMHelper : IDisposable
        {
            string CRMServiceURL;
            string loggedinusername;
            OrganizationServiceProxy proxy;
            Guid _userId;
            public CRMHelper()
            {
                loggedinusername = string.Empty;
                CRMServiceURL = Configuration.ReadString(Configuration.ReadString("Tenant") + "Url");
                InitializeOrganizationServiceProxy();
            }

            public CRMHelper(string loggedUserAlias)
            {
                CRMServiceURL = Configuration.ReadString(Configuration.ReadString("Tenant") + "Url");
                loggedinusername = loggedUserAlias;
                InitializeOrganizationServiceProxy();
            }

            public IOrganizationService GetOrganizationService()
            {
                return InitializeOrganizationServiceProxy();
            }

            IOrganizationService InitializeOrganizationServiceProxy()
            {
                // var creds = new ClientCredentials();
                ClientCredentials Credentials = new ClientCredentials();

                Credentials.UserName.UserName = Configuration.ReadString("crmusername");
                Credentials.UserName.Password = Configuration.ReadString("crmuserpwd");

                /*,
                                                                Configuration.ReadString("crmuserdomain")
                                                                );*/

                proxy = new OrganizationServiceProxy(new Uri(CRMServiceURL), null, Credentials, null);
                proxy.Timeout = new TimeSpan(1, 20, 0);
                proxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
                proxy.EnableProxyTypes();
                if (!string.IsNullOrWhiteSpace(loggedinusername))
                {
                    Guid _userId = GetUserID;
                    proxy.CallerId = _userId;
                }
                return (IOrganizationService)proxy;
            }

    Please let me know if you need any other information.


    Yadav

    Thursday, August 6, 2015 8:21 AM
  • First thing - I don't see anywhere declaration of GetUserID.

    Second - please provide code that you use to instantiate CRMHelper instance.


    Dynamics CRM MVP
    My blog

    Thursday, August 6, 2015 8:31 AM
    Moderator