The VBossapi COM Server API user guide and reference
The VBossapi COM api is a complete COM Server that allows developers to harness the power of the VBossapi business logic. The VBossapi COM api can be accessed through any development environment that can consume COM Servers.
What is the VBossapi COM Server?
COM technology was developed to make it possible for applications to be treated as objects, which can call each other. Using the VBossapi COM Server allows the VBossapi application to be treated as an object in your development environment.
The VBossapi COM Server exposes the Properties, Events and Methods of the VBossapi business logic. This gives developers access to VBossapi method and functions calls which can be used to return information back for the developer’s use.
The type of information returned from the VBossapi COM Server depends on what VBossapi method was called. When accessing a method that returns a dataset, an XML string will be returned to the developer which the developer can then render into his desired data type and display the information to his users.
For more on the VBossapi COM XML return string, see VBossapi XML Output topic.
…and what it is not.
While the VBossapi COM Server makes it easy for developers to access the internal VBossapi business logic, the VBossapi COM Server will not run as is. A development environment that can consume COM Servers is needed in order to access the VBossapi COM Server. Also, after data is passed back to the developer from a VBossapi method, some commands must be issued in your development environment in order to display the results to the user.
Setup and Installation
Setup and installation of the VBossapi COM Server is quick and easy. All you need is a registered copy of VIrtualBoss for Windows installed on your PC. The VBossapi COM Server is installed automatically.
Configuration
Before you can start accessing the VBossapi COM Server, you’ll have to understand a little bit about how VBossapi works.
VBossapi can support multiple sets of databases. Each database contains multiple tables. Normally when using VBossapi for Windows, the VBossapi application will manage the databases for you. However, when using the VBossapi COM Server, you will have to initialize a property in the VBossapi object so that the COM Server will know where the VBossapi application resides. The VBossapi application is the location where you installed VB for Windows. The default installation directory is “c:\program files\VirtualBoss\”.
The following is a Visual Studio .Net C# example of hooking into the VBossapi COM Server and setting these properties.
|
//VBoss.cs vbossapiClass vbobject = new vbossapiClass (); vbobject.PROP_CAPPSTARTPATH = “c:\program files\VirtualBoss\”;
|
If the PROP_CAPPSTARTPATH property is not set in your application, the VB Windows installation directory will be assumed.
VBossapi XML Output
The VBossapi COM Server api makes calling methods in VBossapi quick and easy. Most of your calls to our COM Server will initialize calls to the VBossapi database and generate output for your use.
In order to make the return data useful to a wide range of developers, the VBossapi COM Server outputs its data as an XML string.
The XML string will contain only the data generated as a result of the request and will not contain the XML Schema. The XML Schema definitions will be supplied in a separated .XSD document that can be downloaded from our website at “www.virtualboss.net/api/”. These Schema definitions will also be supplied with the VBossapi setup application.
The schema xsd files names are named as follows:
|
ctcust.xsd |
Contact table schema |
|
ctgroup.xsd |
Drop down list schema |
|
tmjob.xsd |
Job table schema |
|
tmtask.xsd |
Task list table schema |
You can them use any XML parser to read the data.
Check out the Examples
In this section we will show you a few examples of how to access information from the VBossapi COM Server.
C# example of hooking into the VBossapi COM Server and opening the default database.
|
//MyVBossdemo.cs using System; using System.Collections.Generic; using System.Text;
using vbossapi;
namespace vboss { class Class1 { private void GetTasksByJobno() { vbossapiClass o = new vbossapiClass (); o.PROP_CAPPSTARTPATH = “c:\program files\virtualboss\”; o.vboss_OpenDefaultDatabase(); } } }
|
C# example of querying all tasks in the task table for a desired job number and displaying the results in a grid.
|
//MyVBossdemo.cs using System; using System.Collections.Generic; using System.Text;
using vbossapi;
namespace vboss { class Class1 { private void GetTasksByJobno() { vbossapiClass o = new vbossapiClass (); o.PROP_CAPPSTARTPATH = “c:\program files\virtualboss\”; o.vboss_OpenDataBase(“MyDatabaseName”);
o.vboss_GetTaskByJobno(“JobNo1”);
//Bind XML to grid. DataSet MyDs = new DataSet(); MyDs.ReadXml(new StringReader(lc_xml), XmlReadMode.InferSchema);
this.grd_grid.DataSource = MyDs.Tables[0]; } } }
|
In Case of problems
In something goes wrong during installation and you are unable to hook into the API, ensure that all software applications are shutdown and try the installation again.
Also try checking our website at “www.virtualboss.net/api/” for frequently asked questions about our VBossapi COM api.
Class Reference
|
Name |
Type |
Description |
|
vboss_AddContact |
Method |
Adds a contact to the contact file. |
|
vboss_AddJob |
Method |
Adds a job with details. |
|
vboss_AddJobGroup |
Method |
Add a job group. |
|
vboss_AddTask |
Method |
Add a task record. |
|
vboss_AddTaskGroup |
Method |
Add a task group. |
|
vboss_checkdate |
Method |
Returns TRUE if VirtualBoss has expired. |
|
vboss_CheckDBC |
Method |
Checks to ensure that a VirtualBoss database is opened, if not, this will open the default database. |
|
vboss_CurrentDir |
Method |
Returns current VirtualBoss directory. |
|
vboss_DefaultQuery |
Method |
Performs default query in VirtualBoss, returns XML string. |
|
vboss_GetAllContacts |
Method |
Get all contacts. Optional Active switch. Returns XML string. |
|
vboss_GetAllJobs |
Method |
Get all jobs. Optional Active Job Only switch. Returns XML string. |
|
vboss_GetDataSets |
Method |
Returns a an XML string of all VirtualBoss databases available. |
|
vboss_GetTaskByJobno |
Method |
Retrieves all tasks by job number. Returns XML string. |
|
vboss_GetTaskByTaskno |
Method |
Retrieves tasks by task number. Returns XML string. |
|
vboss_MyDoCmd |
Method |
Execute a VirtualBoss Command |
|
vboss_OpenDataBase |
Method |
Opens a VirtualBoss Database by name. |
|
vboss_OpenDefaultDatabase |
Method |
Opens the default VirtualBoss Database. |
|
vboss_SysInfo |
Method |
Return an XML string of the open database, tables, application path, current directory and version. |
|
vboss_UpdateJobByJobno |
Method |
Allows updating of a job by job number. |
|
vboss_UpdateTaskByTaskno |
Method |
Allows updating of a task by task number. |
|
prop_cLastError |
Property |
Contains last error message generated in VBoss api. |
|
prop_cAppStartPath |
Property |
Location of vboss api file. |
|
prop_version |
Property |
VBoss api version. |
|
prop_xmlsize |
Property |
Size of last generated XML string. |
|
prop_tally |
Property |
Number of records affected in last method call. |
|
|
|
|