Using the ApplicationProvisioning API

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The methods and properties in ApplicationProvisioning.dll can be used to provision an application that is built on Unified Communications Managed API 2.0 Core SDK and that works with Office Communications Server. Alternatively, ApplicationProvisioner.exe can be used to provision the application. For more information, see Using ApplicationProvisioner.

For information about the classes, methods, properties, and events that are in ApplicationProvisioning.dll, see ApplicationProvisioning API.

Using ApplicationProvisioning.dll to Provision an Application

As an alternative to using ApplicationProvisioner.exe to provision your application, you can use the methods and properties that are provided in ApplicationProvisioning.dll. When your application creates a CollaborationPlatform instance, information (such as the FQDN of the application server or load balancer, the port, and the GRUU) from the trusted service object for that server is required. You can use the API provided in ApplicationProvisioning.dll to retrieve this information, as shown in the following code.

using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;

// . . . 

TrustedApplicationPool trustedApplicationPool = TrustedApplicationPool.GetApplicationPoolForLocalMachine(appType);

List<ApplicationEndpoint> applicationEndpoints = new List<ApplicationEndpoint>();
CollaborationPlatform platform = null;
// Declare a certificate variable.
// Working code must initialize cert with a certificate obtained from a trusted
// certificate authority (CA).
X509Certificate2 cert;

if(trustedApplicationPool != null)
{

  TrustedService trustedService = trustedApplicationPool.GetTrustedServiceForLocalMachine();

  ICollection<Contact> contacts = trustedApplicationPool.Contacts;

  if(trustedService != null && trustedApplicationPool.Contacts != null  && trustedApplicationPool.Contacts.Count > 0)
  {

    ServerPlatformSettings platformSettings = new ServerPlatformSettings(
                appType,
                trustedService.Fqdn,
                trustedService.Port,
                trustedService.Gruu, 
                cert);


    platform = new CollaborationPlatform(platformSettings);


    foreach(Contact contact in trustedApplicationPool.Contacts)
    {
      ApplicationEndpointSettings endpointSettings =
                        new ApplicationEndpointSettings(contact.SipUri,
                            contact.HomeServerFqdn, 5061);

      applicationEndpoints.Add(new ApplicationEndpoint(platform, endpointSettings));

    }
  }
}