Access message properties inside custom pipeline component
Just recently I was looking for some default message properties and how to read and write them inside a custom pipeline component. While searching I stumbled over a great post listing all the default message properties and how to read them.
If you want to access the properties in your custom pipeline component, you have to get the IBaseMessageContext object from the IBaseContext and use the Read method to get a value or the Write method to substitute a value with your own.
For example:
public IBaseMessage Execute(IPipelineContext pContext, IBaseMessage pInMsg)
{
IBaseMessageContext context = pInMsg.Context;
string value = context.Read(property, namespace).ToString();
context.Write(property, namespace, value);
}
To make your life a little easier, here’s the full list of properties:
Receive pipeline properties:
**** | **Property** | **Namespace** |
1 | ReceivedFileName | http://schemas.microsoft.com/BizTalk/2003/file-properties |
2 | InboundTransportLocation | http://schemas.microsoft.com/BizTalk/2003/system-properties |
3 | InterchangeID | http://schemas.microsoft.com/BizTalk/2003/system-properties |
4 | ReceivePortID | http://schemas.microsoft.com/BizTalk/2003/system-properties |
5 | ReceivePortName | http://schemas.microsoft.com/BizTalk/2003/system-properties |
6 | WasSolicitResponse | http://schemas.microsoft.com/BizTalk/2003/system-properties |
7 | AuthenticationRequiredOnReceivePort | http://schemas.microsoft.com/BizTalk/2003/system-properties |
8 | InboundTransportType | http://schemas.microsoft.com/BizTalk/2003/system-properties |
9 | LRPMsgBodyTracking | http://schemas.microsoft.com/BizTalk/2003/system-properties |
10 | MessageExchangePattern | http://schemas.microsoft.com/BizTalk/2003/system-properties |
11 | PortName | http://schemas.microsoft.com/BizTalk/2003/messagetracking-properties |
12 | ReceivePipelineID | http://schemas.microsoft.com/BizTalk/2003/system-properties |
13 | MessageType | http://schemas.microsoft.com/BizTalk/2003/system-properties |
14 | SchemaStrongName | [http://schemas.microsoft.com/BizTalk/2003/system-properties](http://schemas.microsoft.com/BizTalk/2003/system-properties) |
**** | **Property** | **Namespace** |
1 | CopyMode | http://schemas.microsoft.com/BizTalk/2003/file-properties |
2 | LTPMsgBodyTracking | http://schemas.microsoft.com/BizTalk/2003/system-properties |
3 | ReceivedFileName | http://schemas.microsoft.com/BizTalk/2003/file-properties |
4 | SPID | http://schemas.microsoft.com/BizTalk/2003/system-properties |
5 | ActualRetryCount | http://schemas.microsoft.com/BizTalk/2003/system-properties |
6 | FileName | http://schemas.microsoft.com/BizTalk/2003/file-properties |
7 | PartyName | http://schemas.microsoft.com/BizTalk/2003/messagetracking-properties |
8 | ReceivePortName | http://schemas.microsoft.com/BizTalk/2003/system-properties |
9 | WasSolicitResponse | http://schemas.microsoft.com/BizTalk/2003/system-properties |
10 | AllowCacheOnWrite | http://schemas.microsoft.com/BizTalk/2003/file-properties |
11 | RetryInterval | http://schemas.microsoft.com/BizTalk/2003/system-properties |
12 | OutboundTransportCLSID | http://schemas.microsoft.com/BizTalk/2003/system-properties |
13 | SPName | http://schemas.microsoft.com/BizTalk/2003/system-properties |
14 | InboundTransportLocation | http://schemas.microsoft.com/BizTalk/2003/system-properties |
15 | InterchangeID | http://schemas.microsoft.com/BizTalk/2003/system-properties |
16 | ReceivePortID | http://schemas.microsoft.com/BizTalk/2003/system-properties |
17 | SPTransportID | http://schemas.microsoft.com/BizTalk/2003/system-properties |
18 | TransmitPipelineID | http://schemas.microsoft.com/BizTalk/2003/system-properties |
19 | AuthenticationRequiredOnReceivePort | http://schemas.microsoft.com/BizTalk/2003/system-properties |
20 | InboundTransportType | http://schemas.microsoft.com/BizTalk/2003/system-properties |
21 | LRPMsgBodyTracking | http://schemas.microsoft.com/BizTalk/2003/system-properties |
22 | MessageExchangePattern | http://schemas.microsoft.com/BizTalk/2003/system-properties |
23 | OutboundTransportLocation | http://schemas.microsoft.com/BizTalk/2003/system-properties |
24 | PortName | http://schemas.microsoft.com/BizTalk/2003/messagetracking-properties |
25 | ReceivePipelineID | http://schemas.microsoft.com/BizTalk/2003/system-properties |
26 | SourcePartyID | http://schemas.microsoft.com/BizTalk/2003/system-properties |
27 | MessageType | http://schemas.microsoft.com/BizTalk/2003/system-properties |
28 | OutboundTransportType | http://schemas.microsoft.com/BizTalk/2003/system-properties |
29 | PartNames | http://schemas.microsoft.com/BizTalk/2003/messageagent-properties |
30 | RetryCount | http://schemas.microsoft.com/BizTalk/2003/system-properties |
31 | SchemaStrongName | http://schemas.microsoft.com/BizTalk/2003/system-properties |