How to programatically retrieve data from BAMPrimaryImport using supportable API

Eventhough there are Portal UI and Excel that would allow you to query and access BAM activity data, it seems that there are some of you who would like to programmatically access/query this data from a custom application.

In BizTalk Server Documentation, currently in its 2006 pre-released version, you will find information on the BAMManagementService API.  (Under Technical Reference | Developers Reference | BizTalk Server 2006 .Net Class Reference | Microsoft.BizTalk.Bam.Webservices.Management ). 

The BamManagementService class is what we are interested. This is a webservice API and you can also see its methods by pointing to the box where Biztalk is installed. (replace localhost with the machine name in the link below). 


For example, the above GetViewSummaryForCurrentUser would allow you to retrieve all views that the user has access.  And it would allow you to retrieve the activity names from there.  See code example in help doc for this.

Once you have retrieve the activity name, you can then connect to the database and call the views that below to the specific activity. 

Sample code from help doc (some of these are still been updated):

using WS = BamManagementService;

class Program
    static void Main(string[] args)

        Console.WriteLine("Hit Enter when ready.");

    static void GetViewSummary()
        // Create a web service proxy object.
        using (WS.BamManagementService managementService = new WS.BamManagementService())
            // BAM Management Web Service requires client to be authenticated.
            // The client must be a member of the BAM Portal Users group.
            managementService.Credentials = System.Net.CredentialCache.DefaultCredentials;

            // Get the list of all BAM views available to the current user.
            WS.ViewSummaryList viewSummaryList = managementService.GetViewSummaryForCurrentUser();

            // Print the info for all views on the screen.
            foreach (WS.ViewSummary viewSummary in viewSummaryList.View)
                Console.WriteLine("View: {0}", viewSummary.Name);
                // Each view is defined on one or more BAM activities.
                foreach (WS.ActivitySummary activitySummary in viewSummary.Activity)
                    // The activity data can be on a different server/database if distributed
                    // BAM infrastructure is deployed.
                    Console.WriteLine("    Activity: {0} {1}",
                        activitySummary.IsRemote ? "[ Remote ]" : "");
                    Console.WriteLine("        Server: {0}", activitySummary.Server);
                    Console.WriteLine("        Database: {0}", activitySummary.Database);
                    Console.WriteLine("        BAM Portal URL: {0}", activitySummary.PortalUrl);

                    // OLAP and Real-time aggregations aggregations can be defined.
                    if (activitySummary.Aggregation != null)
                        Console.WriteLine("        Aggregations:");
                        foreach (WS.Aggregation aggregation in activitySummary.Aggregation)
                            Console.WriteLine("            Name: {0} *** Type: {1} *** Cube Name: {2}",
                            if (aggregation.PivotView != null)
                                foreach (WS.PivotView pivotView in aggregation.PivotView)
                                    Console.WriteLine("                PivotView: {0}", pivotView.Name);


            if (viewSummaryList.PartialResults)
                // Distributed BAM infrastructure is deployed and one of the referenced databases
                // is not accesible.
                Console.WriteLine("One or more of the referenced databases are not available. " +
                    "The given list of views may not be complete.");

Sample Output:

View: SalesManagerView
Activity: PurchaseOrder
Server: purchasesrv
Database: BAMPrimaryImport
BAM Portal URL: http://purchasesrv/BAM
Name: POCube *** Type: OLAP *** Cube Name: POCube
Name: POByLocation *** Type: RTA *** Cube Name: POCube
Activity: Shipment [ Remote ]
Server: shipsrv
Database: BAMPrimaryImport
BAM Portal URL: http://shipsrv/BAM
Name: SHCube *** Type: OLAP *** Cube Name: SHCube
Name: SHByLocation *** Type: RTA *** Cube Name: SHCube

View: SupplyManagerView
Activity: SupplyOrder
Server: purchasesrv
Database: BAMPrimaryImport
BAM Portal URL: http://purchasesrv/BAM
Name: SupplyCube *** Type: OLAP *** Cube Name: SupplyCube
PivotView: SupplyCost
Name: SupplyTimes *** Type: RTA *** Cube Name: SupplyCube
PivotView: SupplyTimes

Hit Enter when ready.








Comments (6)
  1. If you have installed BAM (BizTalk Server 2004 or BizTalk Server 2006), you may have noticed that a web…

  2. amrutha says:

    can we develope our own portal by using these web services.

  3. keithlim says:

    Hi Amrutha,

    As long as you use those supported API, there is nothing preventing you from creating custom portal.  Infact one area you might want to consider doing this is extending the view to view other related docs/whatever to an activity.  See AddReference method.



  4. Peter says:

    If you are interested in the Activity Instances IMO the only really interesting stuff, this web service does not deliver.

    According to the msdn help on this webservice:

    "The BAM Portal uses this web service for everything except the activity instance queries. Custom applications can use this web service to avoid working directly with the database.


  5. keithlim says:

    Detail information of the activity instances can be retrieved from using all the activity views once you know what the activity names are. When you deploy an activity check all the views that are available for that activities, this allows for much greater flexibility of what you can do.

    Please post it here to get other perspectives as well: ttp://

  6. Peter says:

    That’s not much different from BizTalk 2004 IMO; Our dba has problems with querying the BizTalk database directly, so it’s a bit of a disappointment that there is no web interface to query the detail information.

Comments are closed.

Skip to main content