locked
unable to create organisation through c# RRS feed

  • Question

  • I have the followig program to create organisation in crm

     public void CreateOrganization(DeploymentServiceClient service, string DisplayName, string UniqueName, string SqlServerName, string SrsUrl)
            {
                DeferredOperationStatus createOrgStatus;

                using (service)
                {
                    Organization organization = new Organization
                    {
                        FriendlyName = DisplayName,
                        UniqueName = UniqueName,
                        SqlServerName = SqlServerName,
                        SrsUrl = SrsUrl,
                        BaseCurrencyCode = RegionInfo.CurrentRegion.ISOCurrencySymbol,
                        BaseCurrencyName = RegionInfo.CurrentRegion.CurrencyNativeName,
                        BaseCurrencySymbol = RegionInfo.CurrentRegion.CurrencySymbol,
                        BaseCurrencyPrecision = 2,
                        BaseLanguageCode = 1033,
                        SqlCollation = "Latin1_General_Cl_Al",
                        DatabaseName = UniqueName,

                        State = Microsoft.Xrm.Sdk.Deployment.OrganizationState.Enabled
                    };

                    try
                    {
                        BeginCreateOrganizationRequest request = new BeginCreateOrganizationRequest();

                        request.Organization = organization;
                        
                        BeginCreateOrganizationResponse response = (BeginCreateOrganizationResponse)service.Execute(request);

                        EntityInstanceId operationid = new EntityInstanceId()
                        {
                            Id = response.OperationId
                        };

                        createOrgStatus = service.Retrieve(DeploymentEntityType.DeferredOperationStatus, operationid) as DeferredOperationStatus;

                        //The process of creating new ORG is quite slow, thus the status is not checked regularly

                        while (createOrgStatus.State != DeferredOperationState.Completed)
                        {
                            //Thread.Sleep(Constants.WaitInterval);
                            createOrgStatus = service.Retrieve(DeploymentEntityType.DeferredOperationStatus, operationid) as DeferredOperationStatus;
                        }

                        Console.WriteLine(string.Format("Organization {0} has been created.", UniqueName));
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(string.Format("An exception has occurred while creating Organization {0}.{1}{2}.", UniqueName, Environment.NewLine, ex));
                    }

    but im getting the following error

    in error details , i found this:

    {[ActiveDirectoryRightsCheck, The current user does not have required permissions (read/write) for the following Active Directory group: CN=ReportingGroup {xxx},OU=xx,DC=xx,DC=local]}

    im able to create organisation manually,and there it is passing all three validations check.

    my account is the local adminsitrator and has full rights in sqldatabase and is also the deployemtna dminsitrator, and this is the account through which i installed the crm.

    i dont know what going wrong,

    please help me in this regard


    • Edited by SyedHaroon Thursday, March 6, 2014 10:41 AM
    Tuesday, August 14, 2012 9:47 AM

All replies


  • Have you tried using setspn for the reporting services user on the "CRM url" ? It could be because of that.
     
    You will have to do it twice, once with the servername and again with the FQDN of the server
     
    eg: http/crmau1 is my server name and the second one shows the fully qualified doimain name (fqdn). swmsft\crmp_srs_user is the user who runs the reporting service
     
    Setspn -a http/crmau1 swmsft\crmp_srs_user
     Setspn -a http/crmau1.lab.local  swmsft\crmp_srs_user
    Tuesday, August 14, 2012 11:12 AM