CSharp API: Difference between revisions

From RangerMSP Wiki - PSA software for MSPs and IT services providers
Jump to navigation Jump to search
Line 19: Line 19:


After you create your C# project, you'll need to add a reference to the '''CommitLib.dll''' file, in order to have access to the CommitCRM library classes.
After you create your C# project, you'll need to add a reference to the '''CommitLib.dll''' file, in order to have access to the CommitCRM library classes.
Each application using the library will have to initialize on startup the '''CommitCRM.Application''' object and terminate it on exit.
Initialization method requires that you pass an object instance of '''CommitCRM.Config''' class configured with the following settings:
* '''AppName'''
: This is free text, preferably the name of your application.
* '''CommitDllFolder'''
: Behind the scenes the library uses the two CommitCRM API dlls: '''CmtDbEng.dll''' and '''CmtDbQry.dll'''.
: In the default CommitCRM installation you'll find these files in <span style="color: #963A46;">'C:\Commit\ThirdParty\UserDev'</span>.
: '''Important Note''': Always point to this folder and do '''not''' copy the dll files elsewhere. This is because when the CommitCRM version upgrade runs it also upgrades the  dll files stored in this folder. This verifies that you will always be using the latest release.
* '''CommitDbFolder'''
: Path to the CommitCRM database, default is <span style="color: #963A46;">'C:\Commit\db'</span>.
Assuming these default values, we can configure the '''CommitCRM.Config''' object like this:
<font face="courier new" size="3">
CommitCRM.<span style="color: #2B91AF;">Config</span> config = <span style="color: #3A3AFF;">new</span> CommitCRM.<span style="color: #2B91AF;">Config</span>();
</font>

Revision as of 08:48, 18 March 2011

Disclaimer

This documentation refers to CommitCRM 5.6 or later version and assumes CommitCRM is installed and accessible on the local computer.

Introduction

This document demonstrates how to use the CommitCRM C# API library in order to programmatically connect to your CommitCRM server and query or manipulate the CommitCRM database.


System Requirements

  • CommitCRM 5.6 or later.
  • Visual C# .NET 2008 or Visual C# .NET 2010.
  • CommitLib.dll (the CommitCRM C# compiled library).

Getting Started

After you create your C# project, you'll need to add a reference to the CommitLib.dll file, in order to have access to the CommitCRM library classes.

Each application using the library will have to initialize on startup the CommitCRM.Application object and terminate it on exit. Initialization method requires that you pass an object instance of CommitCRM.Config class configured with the following settings:

  • AppName
This is free text, preferably the name of your application.
  • CommitDllFolder
Behind the scenes the library uses the two CommitCRM API dlls: CmtDbEng.dll and CmtDbQry.dll.
In the default CommitCRM installation you'll find these files in 'C:\Commit\ThirdParty\UserDev'.
Important Note: Always point to this folder and do not copy the dll files elsewhere. This is because when the CommitCRM version upgrade runs it also upgrades the dll files stored in this folder. This verifies that you will always be using the latest release.
  • CommitDbFolder
Path to the CommitCRM database, default is 'C:\Commit\db'.

Assuming these default values, we can configure the CommitCRM.Config object like this:

CommitCRM.Config config = new CommitCRM.Config();