Using PartContextPropertyBase in BizTalk Server

Every element in the Property schema should be of type as below.

Message Data Property Base and Message Context Property Base would be clear to everyone (incase if you are not clear with the difference, you can refer this link).

Where is this PartContextPropertyBase used ? This post will give you a simple demo on using PartContextPropertyBase.

PartContextPropertyBase is used for setting context properties for individual Message Parts of a Multipart Message. A multipart message can have more than one part.

A MessageContextPropertyBase property can be set at the message level, irrespective of how many parts it has. Also, MessageContextPropertyBase should be accessed at Message Level (eg: Message_1(your property) rather than Message_1.Part1(your property). Whereas PartContextPropertyBase can be set for individual parts with in a Message.

Consider the following sample:

1. Create a new BizTalk Project and a sample schema, just to initiate the Orchestration Instance. (It has no other purpose in this sample).

2. Create a Property Schema. Add two elements PartProperty , NormalContextProperty to it as shown below.

3. Set the Property Schema Base of the PartProperty to PartContextPropertyBase.

4. Similarly set the Property Schema Base of the NormalContextProperty to MessageContextPropertyBase.


5. Save all the stuff and create a new Orchestration. Add a receive shape and a receive port to receive a message of Schema Created in step1. (This is just to initiate an orchestration. This message is of no use for us in this sample.)

6. Now expand Multi-Part Message and create a new MultiPartMessageType.

7. Set the MessagePart_1 to the schema you created in step1. (This is again for sample. It is not related to out topic)

8. Create two more MessageParts and assign them to any data type like String, Datetime etc. (Just for demo)

Here comes the real application of PartContextPropertyBase.

9. Create a new Message called Message_2 and set its type to the Multipart Message created in above step.

10. Add a Message Assignment shape to the Orchestration and Set the Messages Constructed Property to Message_2. Add the following code to construct the Message.

11. Assign the Values to the properties created in Step 2. You can observe that only NormalContextProperty is available at the Message_2. Where as PartProperty is not available here.

12. In Order to use the PartProperty, you should apply that the Individual part of the message as shown below.

13. Complete the assignment of values as shown below.

14. Add an expression shape to the Orchestration to print the values you assigned just now to the Eventlog.

15. Deploy the Solution. Bind the Logical Port to physical file port. Drop a file of Schema1 in the physical folder.

16. Very soon you will see that all your values are printed to EventLog.

Hope this gives an idea on using PartContextPropertyBase.

– Shiv

Web Counters

#1 all-in-one platform for Microsoft BizTalk Server management and monitoring

Back to Top