Access is Denied on OrganizationServiceProxy RRS feed

  • Question

  • CRM 2011 - On Premise

    I have a repository class that I pass the appropriate configuration into to create an OrganizationServiceProxy:

    public CrmRepository(CrmConfig config)
                var userCredentials = new ClientCredentials();
                userCredentials.Windows.ClientCredential = new System.Net.NetworkCredential(config.UserName, config.Password, config.Domain);
                var organizationUri = new Uri(config.ServerUrl + "XRMServices/2011/Organization.svc");
                IServiceConfiguration<iorganizationservice> serviceConfiguration = ServiceConfigurationFactory.CreateConfiguration<iorganizationservice>(organizationUri);
                _organizationServiceProxy = new OrganizationServiceProxy(organizationUri, null, userCredentials, userCredentials);

    From here, I have a few methods that I call to interact with the Crm. Here is one of them I use to get picklist values for a dictionary:

    private Dictionary<int, string=""> GetAttributeDictionary(string attributeName, string entityName)
                Dictionary<int, string=""> dictionary = new Dictionary<int, string="">();
                var request = new RetrieveAttributeRequest
                    EntityLogicalName = entityName,
                    LogicalName = attributeName
                    var response = (RetrieveAttributeResponse)_organizationServiceProxy.Execute(request);
                    var picklist = (PicklistAttributeMetadata)response.AttributeMetadata;
                    foreach (var option in picklist.OptionSet.Options)
                        dictionary.Add(option.Value.Value, option.Label.UserLocalizedLabel.Label);
                return dictionary;

    My issue is when I call Execute from the service proxy, the only thing returned is "Access is Denied." No other information is given. I apoligize in advance if this has already been answered. I've been hunting an answer for 3 hours, but nothing works.  If you have an idea how to debug to get more information, that would help to.



    • Edited by Red 80 Sunday, February 19, 2012 11:32 PM
    Sunday, February 19, 2012 11:31 PM


  • Nevermind. I was passing in the wrong Uri into the configuration. Works great when you give it the correct information. Go figure.
    • Marked as answer by Red 80 Sunday, February 19, 2012 11:42 PM
    Sunday, February 19, 2012 11:42 PM