OrganizationServiceManager Class

The OrganizationServiceManager class purpose is to store endpoint metadata and issued security token (if applicable). An instance of this class should be reused to construct multiple service channels (OrganizationServiceProxy) as may be necessary for parallelized operations. In addition to providing a simplified and consistent pattern for connecting to the Organization.svc, this class also contain a ParallelProxy property which references an instance of ParallelOrganizationServiceProxy. Once a new manager class is instantiated, this property is immediately available to begin executing parallelized request operations.

Namespace: Microsoft.Pfe.Xrm
Assembly: Microsoft.Pfe.Xrm.Core.dll
Properties
Methods
Usage Examples
Below we've provided multiple constructor samples to address different authentication scenarios including Active Directory, Claims, and Online Federated.

1. Basic Active Directory Connection to CRM Organization.svc
Demonstrates a basic Active Directory connection to Organization.svc using a username, password, and domain.

var serverUri = XrmServiceUriFactory.CreateOrganizationServiceUri("http://mycrmserver:5555/myorganization");
var manager = new OrganizationServiceManager(serverUri, "username", "password", "mydomain");

using (var proxy = manager.GetProxy())
{
    //Do organization requests...
}

2. Basic Claims Connection to CRM Organization.svc
Demonstrates a basic claims-based connection to Organization.svc using a username and password

var serverUri = XrmServiceUriFactory.CreateOrganizationServiceUri("https://mycrmserver:5555/myorganization");
var manager = new OrganizationServiceManager(serverUri, "username", "password");

using (var proxy = manager.GetProxy())
{
    //Do organization requests...
}

3. Basic Connection to CRM Online Organization.svc
Demonstrates an online-federated connection to Organization.svc using a userprincipalname and password

var serverUri = XrmServiceUriFactory.CreateOnlineOrganizationServiceUri("myorganization", CrmOnlineRegion.NA);
var manager = new OrganizationServiceManager(serverUri, "username@mydomain.onmicrosoft.com", "password");

using (var proxy = manager.GetProxy())
{
    //Do organization requests...
}

4. Basic Cross-realm Connection to CRM Organization.svc
Demonstrates a claims-based, cross-realm connection to Organization.svc using a username, password, and alternate realm

var serverUri = XrmServiceUriFactory.CreateOrganizationServiceUri("https://mycrmserver:5555/myorganization");
var manager = new OrganizationServiceManager(serverUri, "username", "password", homeRealm: new Uri("https://myhomerealm.com"));

using (var proxy = manager.GetProxy())
{
    //Do organization requests...
}

5. Basic Pre-authenticated Connection to CRM Organization.svc
Demonstrates a claims-based connection to Organization.svc using a pre-authenticated instance of AuthenticationCredentials

var serverUri = XrmServiceUriFactory.CreateOrganizationServiceUri("https://mycrmserver:5555/myorganization");
var manager = new OrganizationServiceManager(serverUri, preAuthCredentials);

using (var proxy = manager.GetProxy())
{
    //Do organization requests...
}

Last edited Jun 11, 2015 at 6:02 PM by maustinjones, version 18