C# code samples
Sage CRM is supplied with a number of Microsoft Visual Studio 2005 C# solutions that contain code samples you can use when developing Web Services applications for Sage CRM.
On a Sage CRM server, you can find these C# solutions in the following location:
<Sage CRM installation folder>\WWWRoot\Examples\WebServices
By default, Sage CRM is installed to %ProgramFiles(x86)%\Sage\CRM\CRM.
In the specified location, you will find the Sage CRM Web Services Sample Code.zip file that includes the following folders:
- CRM Add Resource. Contains code that adds a resource (user) to Sage CRM through Web Services. The sample code lets you enter a first name and a last name for the resource. It creates a record in the User table.
- CRM AlterColumnWidth. Contains code that changes the width of the comp_practicefield column in the Company table.
- CRM Create. Contains code that creates company, person, address, and phone records in Sage CRM.
- CRM Delete. Contains code that deletes a specified company from Sage CRM.
- CRM LogOn and LogOff. Contains code that logs on and logs off from Sage CRM. At logon, this code returns and displays a session ID.
- CRM MetaData. Contains code that gets information about Sage CRM tables. The user can select from five entities: Company, Person, Case, Opportunity, or Communication. When the user clicks MetaData, all table columns are displayed in the left-hand pane. The user can highlight any column to display information about the column. When the user clicks AllMetaData, the main Sage CRM tables are listed in a drop-down. The user can select a table to view all associated columns.
- CRM QueryEntity. Contains code that queries the Company table. The user enters a known company ID and clicks Search to display all people associated with the specified company.
- CRM QueryIdNoDate. Contains code that allows the user to enter a date. The user clicks Query N/D to display a list of company IDs where the update date is greater than or equal to the date entered.
- CRM SelectionLists. Contains code that works with selection lists. The user can select from seven tables: Company, Person, Opportunity, Case, Communication, Solution, or Library. When the user clicks List, the Lists drop-down list is populated with the selection fields in the table. When the user chooses a selection field and clicks Lists Items, the left-hand pane is populated with values from the selection field.
- CRM SID Grabber. Contains code that displays the current session ID and Sage CRM version number. At least one user must be logged on to Sage CRM.
- CRM SID_Key. Contains code that displays the current session ID on the form. At least one user must be logged on to Sage CRM.
- CRM Update. Contains code that updates the Source and Website fields in Sage CRM.
- CRM Version. Contains code that displays the current session ID on the form and Sage CRM version number in a pop-up box.
To run sample code, enter your Sage CRM user name and password, and click Log On. When you're finished working with code samples, click Log Off. Make sure that you specify the correct reference to the WSDL file. For more information, see Using the WSDL file.