locked
unable to create organisation programmaticaly through c# RRS feed

  • Question

  • hey guys, i need to create the organisation using c# and i have the followign code ... 

    public void Main2()
            {
                DeploymentServiceClient service = Microsoft.Xrm.Sdk.Deployment.Proxy
                    .ProxyClientHelper.CreateClient(new Uri("http://192.168.78.98:5555/XRMDeployment/2011/Deployment.svc"));
                Console.WriteLine(CreateOrganization(service
                    , new Organization
                    {
                        UniqueName = "testOrgProv1",
                        FriendlyName = "testOrgProv1",
                        SqlServerName = "CRMDDC2",
                        SrsUrl = @"http://crmddc2/Reports",
                        BaseCurrencyCode = RegionInfo.CurrentRegion.ISOCurrencySymbol,
                        BaseCurrencyName = RegionInfo.CurrentRegion.CurrencyNativeName,
                        BaseCurrencySymbol = RegionInfo.CurrentRegion.CurrencySymbol,
                        State = Microsoft.Xrm.Sdk.Deployment.OrganizationState.Enabled
                    }));
            }

            Guid? CreateOrganization(IDeploymentService deploymentService
                , Organization org)
            {
                BeginCreateOrganizationRequest req = new BeginCreateOrganizationRequest
                {
                    Organization = org
                };

                BeginCreateOrganizationResponse resp = deploymentService.Execute(req) as BeginCreateOrganizationResponse;
                return resp != null ? (Guid?)resp.OperationId : null;
            }

    but im getting the error as "The Deployment Service cannot process the request because one or more validation checks failed."

    im using the local administrator account, it is also the deployment administrator,

    please help me in this regard!!!!

    ps:when i used similar code in a different way, the same error was popping but there the internal message was "The current Active Directory user doesnt have read write permission on the reporting group ....."


    • Edited by SyedHaroon Tuesday, August 21, 2012 2:43 PM
    Tuesday, August 21, 2012 2:25 PM

Answers

  • thanks ashraf,

    but i resolved the issue..

    actually i have to change the app pool settings for crm website, i added teh domain account in teh app pool identity instead of the network service.

    Hope this information helps to others as well.


    • Proposed as answer by CRMDevlpr Friday, August 24, 2012 10:25 AM
    • Marked as answer by SyedHaroon Friday, September 21, 2012 6:59 AM
    Friday, August 24, 2012 10:20 AM

All replies

  • hey guys, i need to create the organisation using c# and i have the followign code ... 

    public void Main2()
            {
                DeploymentServiceClient service = Microsoft.Xrm.Sdk.Deployment.Proxy
                    .ProxyClientHelper.CreateClient(new Uri("http://192.168.78.98:5555/XRMDeployment/2011/Deployment.svc"));
                Console.WriteLine(CreateOrganization(service
                    , new Organization
                    {
                        UniqueName = "testOrgProv1",
                        FriendlyName = "testOrgProv1",
                        SqlServerName = "CRMDDC2",
                        SrsUrl = @"http://crmddc2/Reports",
                        BaseCurrencyCode = RegionInfo.CurrentRegion.ISOCurrencySymbol,
                        BaseCurrencyName = RegionInfo.CurrentRegion.CurrencyNativeName,
                        BaseCurrencySymbol = RegionInfo.CurrentRegion.CurrencySymbol,
                        State = Microsoft.Xrm.Sdk.Deployment.OrganizationState.Enabled
                    }));
            }

            Guid? CreateOrganization(IDeploymentService deploymentService
                , Organization org)
            {
                BeginCreateOrganizationRequest req = new BeginCreateOrganizationRequest
                {
                    Organization = org
                };

                BeginCreateOrganizationResponse resp = deploymentService.Execute(req) as BeginCreateOrganizationResponse;
                return resp != null ? (Guid?)resp.OperationId : null;
            }

    but im getting the error as "The Deployment Service cannot process the request because one or more validation checks failed."

    im using the local administrator account, it is also the deployment administrator,

    please help me in this regard!!!!

    ps:when i used similar code in a different way, the same error was popping but there the internal message was "The current Active Directory user doesnt have read write permission on the reporting group ....."

    Tuesday, August 21, 2012 2:42 PM
  • If you try to create an Organization through Deployment Manager using the same values, does it succeed or do you get the same error?

    Have you confirmed that the user you are logged in does in fact have read/write permissions on the CRM OUs in Active Directory? 

    You might also try creating a new user and adding him as a Deployment Admin to see if that has any effect. 


    Jason Lattimer

    Tuesday, August 21, 2012 7:10 PM
    Moderator
  • Please don't create duplicated threads!

    Freelance Developer for Dynamics CRM 4.0/2011

    Tuesday, August 21, 2012 8:48 PM
    Moderator
  • using deployment manager im able to create the organisation and all the three validations checks are passed...

    Wednesday, August 22, 2012 5:12 AM
  • sorry andrii , but i've been looking for a solution for this from 1 week but no luck, so i have to create those duplicate threads....

    Wednesday, August 22, 2012 5:13 AM
  • Hi Syed,

         Try the following code and hope it works.

                Guid operationId = Guid.Empty;

               // CustomBinding_IDeploymenService is the name of the configuration setting for the CustomBinding

                 

                using (DeploymentServiceClient client = new DeploymentServiceClient("CustomBinding_IDeploymentService"))
                {
                    // Set properties for the new organization
                    Organization organization = new Organization
                    {
                        BaseCurrencyCode = "USD",
                        BaseCurrencyName = "US Dollar",
                        BaseCurrencyPrecision = 2,
                        BaseCurrencySymbol = "$",
                        BaseLanguageCode = 1033,
                        FriendlyName = "Alpha Helix",
                        UniqueName = "AlphaHelix",
                        SqlCollation = "Latin1_General_CI_AI",
                        SqlServerName = "CRM01",
                        SrsUrl = "http://CRM01/ReportServer",
                        SqmIsEnabled = false
                    };

                    // Create a request for the deployment service
                    BeginCreateOrganizationRequest request = new BeginCreateOrganizationRequest();
                    request.Organization = organization;

                    // Execute the request
                    BeginCreateOrganizationResponse response = (BeginCreateOrganizationResponse)client.Execute(request);

                    // The operation is asynchronous, so the response object contains a unique identifier
                    // for the operation
                    operationId = response.OperationId;

                }

    Regards

       Abish


    Abish Asharaf

    • Proposed as answer by Abish Asharaf Wednesday, August 22, 2012 11:25 AM
    Wednesday, August 22, 2012 11:25 AM
  • thanks ashraf,

    but i resolved the issue..

    actually i have to change the app pool settings for crm website, i added teh domain account in teh app pool identity instead of the network service.

    Hope this information helps to others as well.


    • Proposed as answer by CRMDevlpr Friday, August 24, 2012 10:25 AM
    • Marked as answer by SyedHaroon Friday, September 21, 2012 6:59 AM
    Friday, August 24, 2012 10:20 AM