Is there a way to automate the turning on or off of a Receive Location in BizTalk? It seems like there should be some kind of API or some such for this kind of thing. I woul
In response to Alhambraeidos comment. Here's is some excerpts of code I used in a Windows app to disable a Receive Location remotely:
///
/// Gets or sets the biz talk catalog.
///
/// The biz talk catalog.
private BtsCatalogExplorer BizTalkCatalog { get; set; }
///
/// Initializes the biz talk artifacts.
///
private void InitializeBizTalkCatalogExplorer()
{
// Connect to the local BizTalk Management database
BizTalkCatalog = new BtsCatalogExplorer();
BizTalkCatalog.ConnectionString = "server=BiztalkDbServer;database=BizTalkMgmtDb;integrated security=true";
}
///
/// Gets the location from biz talk.
///
/// Name of the location.
///
private ReceiveLocation GetLocationFromBizTalk(string locationName)
{
ReceivePortCollection receivePorts = BizTalkCatalog.ReceivePorts;
foreach (ReceivePort port in receivePorts)
{
foreach (ReceiveLocation location in port.ReceiveLocations)
{
if (location.Name == locationName)
{
return location;
}
}
}
throw new ApplicationException("The following receive location could not be found in the BizTalk Database: " + locationName);
}
///
/// Turns the off receive location.
///
/// Name of the vendor.
public void TurnOffReceiveLocation(string vendorName)
{
ReceiveLocation location = Locations[vendorName].ReceiveLocation;
location.Enable = false;
BizTalkCatalog.SaveChanges();
}
You'll notice that there is some I left out, like I was creating a dictionary of receive locations called "Locations", but you should be able to get the idea. The pattern pretty much holds true for any BizTalk object you want to interact with.