One of the new features in BizTalk 2009 EDI is the possibility to create multiple batch configurations for each party.
Each batch will have a specific name and specific batchID and can be managed individually.

For a specific batch name you can get the corresponding batch ID. For example you may need this for an external trigger message for that batch.

If you want to do that programmatically, you may expect you can just call Partner.GetBatchIdForBatchName method by passing the batch name.
http://msdn.microsoft.com/en-us/library/microsoft.biztalk.edi.partneragreementmanager.partner.getbatchidforbatchname.aspx

But looking at the signature of that method, it is probably not what you want. Instead of expecting just a string for the batch name, this method wants two int, the partyID and the messageType. But if you just want to pass in the batch name, you do not get very far with that method.

To get the batch ID for a batch name, we have a stored procedure you can call from code: edi_GetBatchIdForBatchName .
Calling 
  exec edi_GetBatchIdForBatchName 'MyBatch'
will return the ID of the batch name MyBatch.


Note: both calling GetBatchIdForBatchName and edi_GetBatchIdForBatchName directly is not supported.

 

Manuel Stern