public class CreateCrmOrg
{
public CreateCRM_Org()
{
static void Main()
{
DeploymentServiceClient service = Microsoft.Xrm.Sdk.Deployment.Proxy
.ProxyClientHelper.CreateClient(new Uri("http://srv-crm04/XRMDeployment/2011/Deployment.svc"));
Console.WriteLine(CreateOrganization(service
,new Organization
{
UniqueName = "testOrgProv1",
FriendlyName = "testOrgProv1",
SqlServerName = "SQL1-CRM04",
SrsUrl = "http://SQL1-CRM04/ReportServer",
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;
}
}
No comments:
Post a Comment