/// <summary> /// Creates an Organization.svc/Web <see cref="Uri"/> instance targeting CRM Online for the specified organization/region pair /// </summary> /// <param name="organizationName">The organization name</param> /// <param name="region">The region where the organization is located</param> /// <returns>A new instance of <see cref="Uri"/> for the Organization.svc/Web</returns> public static Uri CreateOnlineOrganizationWebServiceUri(string organizationName, CrmOnlineRegion region = CrmOnlineRegion.NA) { string location = XrmServiceUriFactory.CreateOnlineOrganizationServiceLocation(organizationName, region); return(XrmServiceUriFactory.CreateOrganizationWebServiceUri(location)); }
/// <summary> /// Creates a string representing the CRM Online Organization.svc location based on the specified region /// </summary> /// <param name="organizationName">The organization name being targeted</param> /// <param name="region">The applicable CRM Online region</param> /// <returns>The formatted Organization.svc location for the organization/region pair</returns> private static string CreateOnlineOrganizationServiceLocation(string organizationName, CrmOnlineRegion region) { switch (region) { case CrmOnlineRegion.NA: default: return(String.Format(XrmServiceUriFactory.OrganizationServiceOnlineNAUriFormat, organizationName)); case CrmOnlineRegion.EMEA: return(String.Format(XrmServiceUriFactory.OrganizationServiceOnlineEMEAUriFormat, organizationName)); case CrmOnlineRegion.APAC: return(String.Format(XrmServiceUriFactory.OrganizationServiceOnlineAPACUriFormat, organizationName)); } }