Using Microsoft.BizTalk.ExplorerOM

Using Microsoft.BizTalk.ExplorerOM

With the aid of the Microsoft.BizTalk.ExplorerOM library found in "C:\Program Files\Microsoft BizTalk Server 2006\Developer Tools" you can write your own tool for administration of your Biztalk applications. With this API you can have a look at the installed applications, add applications and configure sendports and receivelocations and all other parts of the application.

Start with declaring an object of type BtsCatalogExplorer and giving it the connectionstring to the Biztalk Management database. On this object there is the applications collection as an entry to all the elements of an installed BizTalk application.

After changing the configuration you call the SaveChanges() method to make them permanent. Use RefreshChanges() to reload the latest configuration.

Example 1, just a dump of names of the applications, names of the orchestrations and sendports :

BtsCatalogExplorer btsCatalogExplorer; btsCatalogExplorer = new BtsCatalogExplorer(); btsCatalogExplorer.ConnectionString = "Integrated Security=SSPI;database=BizTalkMgmtDb;server=VS_BIZDEVSQL1";

foreach (Application o in btsCatalogExplorer.Applications) { Console.WriteLine(o.Name); } foreach (BtsOrchestration orch in btsCatalogExplorer.Applications["APP1"].Orchestrations) { Console.WriteLine(orch.FullName); } foreach (SendPort sport in btsCatalogExplorer.Applications["APP1"].SendPorts) { Console.WriteLine(sport.Name); }

_

Example 2, changing the transporttype of a port.

_

BtsCatalogExplorer btsCatalogExplorer; btsCatalogExplorer = new BtsCatalogExplorer(); btsCatalogExplorer.ConnectionString = "Integrated Security=SSPI;database=BizTalkMgmtDb;server=VS_BIZDEVSQL1";

btsCatalogExplorer.Applications["APP1"].SendPorts["ThePort"].Status = PortStatus.Stopped; btsCatalogExplorer.Applications["APP1"].SendPorts["ThePort"].PrimaryTransport.TransportType = btsCatalogExplorer.ProtocolTypes["WCF-NetNamedPipe"]; btsCatalogExplorer.Applications["APP1"].SendPorts["ThePort"].Status = PortStatus.Started;

btsCatalogExplorer.SaveChanges();

Example 3, adding a new application with a receiveport and its receivelocation.

BtsCatalogExplorer btsCatalogExplorer; btsCatalogExplorer = new BtsCatalogExplorer(); btsCatalogExplorer.ConnectionString = "Integrated Security=SSPI;database=BizTalkMgmtDb;server=VS_BIZDEVSQL1";

Application application; application = btsCatalogExplorer.AddNewApplication(); application.Name = "APP1";

btsCatalogExplorer.SaveChanges();

btsCatalogExplorer.Refresh();

application = btsCatalogExplorer.Applications["TestApp"]; ReceivePort receivePort = application.AddNewReceivePort(false); receivePort.Name = "ThePort"; receivePort.Authentication = AuthenticationType.NotRequired; receivePort.RouteFailedMessage = false; receivePort.Description = "test"; ReceiveLocation receiveLocation; receiveLocation = receivePort.AddNewReceiveLocation(); receiveLocation.Name = "TheReceiveLocation"; receiveLocation.ReceivePipeline = btsCatalogExplorer.Pipelines["Microsoft.BizTalk.DefaultPipelines.XMLReceive"]; receiveLocation.ReceiveHandler = btsCatalogExplorer.ReceiveHandlers[1]; receiveLocation.TransportType = btsCatalogExplorer.ProtocolTypes["FILE"]; receiveLocation.Address = @"C:\temp\DROPS\IN";

btsCatalogExplorer.SaveChanges();

This article is part of the GWB Archives. Original Author: Kurt Claeys

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.