Map Business Online SDK
Server API

Getting Started with Server API

Here are the steps required to start using Map Business Online Server API.

  1. Create a new Console Application in Visual Studio. Note that you can use this API from server types of projects, for example, in ASP.NET Web Application.
  2. Add reference to the MBO.dll assembly. Choose one that corresponds to the .NET framework you use:
    • .NET Framework 3.5: <SDK install folder>\Bin\DotNet35\MBO.dll
    • .NET Framework 4.0+: <SDK install folder>\Bin\DotNet40\MBO.dll

    MBO.dll depends on other assemblies from Bin folder. When you build the project they will be automatically copied to the output folder.

  3. Add <SDK install folder>\Config\MBO.dll.config file to the root of the project. In the file's Properties window set "Copy to Output Directory" to "Copy Always".
    Note that by default MBO.dll searches for MBO.dll.config file in the same folder where the assembly is located. If you want to change that, you would need to specify the path to the config file in Config.Path property.
  4. For C#. Add the following lines to the using section. Most of the API types are defined in MBO namespace, whereas main Server class is defined in MBO.Server namespace.       
    using MBO;
    using MBO.Server;
    For Visual Basic. In the project's Properties window, on References tab find and check MBO and MBO.Server namespaces in Imported namespaces section.
  5. Add the following code to the Main method:
    '' Create server connection.
    Dim server As Server = New Server(New Credentials("<Your MBO account e-mail>", "<Your MBO account password>"))
    // Create server connection.
    Server server = new Server(new Credentials("<Your MBO account e-mail>", "<Your MBO account password>"));
  6. In the code above replace "<Your MBO account e-mail>" and "<Your MBO account password>" with your real MBO user account credentials.
  7. Now you are ready to call Server methods. For example, you can plot some data on existing map:
    Dim fieldMapping As DatasetFieldMapping = New DatasetFieldMapping()
    With fieldMapping
        .AddressFieldName = "<Address field name>"
        .CityFieldName = "<City field name>"
        .StateProvinceFieldName = "<State field name>"
        .PostalCodeFieldName = "<Postal code field name>"
        .NameFieldName = "<Name field name>"
    End With
    
    server.PlotData("<Map Name>", "<Data file path>", fieldMapping)
    DatasetFieldMapping fieldMapping = new DatasetFieldMapping();
    fieldMapping.AddressFieldName = "<Address field name>";
    fieldMapping.CityFieldName = "<City field name>";
    fieldMapping.StateProvinceFieldName = "<State field name>";
    fieldMapping.PostalCodeFieldName = "<Postal code field name>";
    fieldMapping.NameFieldName = "<Name field name>";
    
    server.PlotData("<Map Name>", @"<Data file path>", fieldMapping);
    Replace <placeholders> with real data. Note that map with specified name must exist in your account in My maps folder.   
  8. Finally build and start the application. After the application has completed its work, open the map in MBO. You will see new dataset on the map! In order to update plotted dataset you can call corresponding UpdateData method.
See Also