Home.Net APIPrinter Friendly Version

.Net API

Setting up and using the .NET API and triggers

1. Documentation and examples

1.1. PureCM.NET API

PureCM.Client is installed when you install the Client. If you want to write a .NET program using it you will need to add PureCM.Client as a reference and add 'using PureCM.Client' to your code.

The best way of getting familiar with the API is to use the object browser in Visual Studio. After adding PureCM.Client as a reference, right-click the reference and select 'View In Object Browser'. Alternatively you can download the .Net API documentation from the following link..

PureCM.Net-api

1.2. Getting Started : Checking Out a File

The attached code is a quick way of doing something useful with the PureCM.Client API. This is to help you get started and hopefully see how easy it is get going.

In Visual Studio simply create a new C# console application, add PureCM.Client as a reference and copy the attached code into your Program.cs.

The usage for the console app is:

    pcm_api checkout [filename]

1.3. Simple Console Example

Click on the following link to see some example code for the .Net api..

PureCM.Net-Example


To use this, create a C# Console Application in Visual Studio, add a
reference to PureCM.Client and copy the c# files into your project.

1.4. Client triggers example

Create a C# Console Application in Visual Studio

Add a reference to PureCM.Client (which should exist if installed correctly and should have the correct version)

Copy the code from dot_net_client_triggers.cs  in the following link into your Program.cs..

PureCM.Net-Triggers

 

Now when PureCM events are triggered, this program should catch them. eg 

OnUserConnected()

OnUserDisconnects()

OnEventCreated()

OnReposCreated()

OnReposDeleted()

OnStreamCreated()

OnStreamDeleted()

OnChangeSubmitted()

OnReviewAssigned()

OnReviewAccepted()

OnReviewRejected()

OnIssueAction()

OnAutoMergeFailed()

 

2. Installation And Setup

2.1. How do I install the .NET API?

PureCM.Client is installed when you install the client(C:\Program Files\PureCM\Client\PureCM.Client.dll).

In your VS project you add it as a reference. ie.


PureCM.Client as reference

3. FAQs

3.1. Running PureCM.Client on a 64-Bit Machine

Trying to run a .NET program which uses PureCM.Client on a 64-Bit machine will give the error:

'An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)'

This is because PureCM.Client uses various DLLs which are 32-Bit.

This can be fixed by going into the 'Build | Configuration Manager' dialog in Visual Studio and setting the project platform to be x86. This should tell .NET to only run the exe in 32-Bit mode.