Re: DB Table of Receive Location Properties

Home Page Forums BizTalk 2004 – BizTalk 2010 DB Table of Receive Location Properties Re: DB Table of Receive Location Properties

#20901

 Hi,

You can write a small program to get Receive Location properties through WMI MSBTS_ReceiveLocation or Microsoft.BizTalk.ExplorerOM

 

 

Example:

Using WMI MSBTS_ReceiveLocation :

ReceiveLocationQuery= “SELECT * FROM MSBTS_ReceiveLocation”

 //Create the WMI search object.

 

 

 

 

Using Microsoft.BizTalk.ExplorerOM

Create the root object and set the connection string
                BtsCatalogExplorer catalog = new BtsCatalogExplorer();
                catalog.ConnectionString = ConfigurationManager.ConnectionStrings
                    [Constants.BIZTALK_MGTDATABASE_CONNECTION].ConnectionString;
                string receiveLocationName = string.Empty;
                foreach (ReceiveLocation receiveLoc in
                                catalog.ReceivePorts[inboundReceivePort].ReceiveLocations)
                {
                    if (inboundAddress == receiveLoc.Address)

                    {
                        receiveLocationName = receiveLoc.Name;

                        break;
                    }
                }

 

 

//Create the WMI search object.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ManagementObjectSearcher Searcher = new ManagementObjectSearcher

();

 

 

// create the scope node so we can set the WMI root node correctly.

 

 

ManagementScope scope = new ManagementScope(Constants

.MGT_SCOPE);

Searcher.Scope = scope;

 

 

// Build a Query to enumerate the MSBTS_ReceiveLocation instances if an argument

 

 

// is supplied use it to select only the matching RL.

 

 

SelectQuery query = new SelectQuery

();

query.QueryString = ReceiveLocationQuery;

 

 

// Set the query for the searcher.

Searcher.Query = query;

 

 

// Execute the query and determine if any results were obtained.

 

 

ManagementObjectCollection

queryCol = Searcher.Get();

 

 

//Get the Recive Location Name from InboundTransportURL property

 

 

foreach (ManagementBaseObject envVar in

queryCol)

{

 

 

PropertyDataCollection

envVarProperties = envVar.Properties;

 

 

 

foreach (PropertyData envVarProperty in

envVarProperties)

{

 

 

if ((envVarProperty.Name.Equals(Constants

.INBOUND_TRANSPORT_URL)) &&

(inboundAddress.Equals(envVarProperty.Value)))

{

 

 

//Set the reciveLocationName from the InboundTransportURL property

receiveLocationName = envVar[

 

“Name”

].ToString();

 

 

break

;