Yossi Dahan [BizTalk]

Google
 

Wednesday, January 10, 2007

XLANGMessage.GetPropertyValue()

Reading a context property of a message in an orchestration is straight forward; however, when passing the message to an external assembly, although still very easy, the approach may be somewhat confusing at first.

The XlangMessage class has a GetProeprtyValue method to return the value of a context property.

The method takes in a type as a parameter and returns an object.
Returning an object makes perfect sense as the type of the context property you're reading can vary, but what is the type as the input parameter?

It is not obvious at first but when you create a property schema, as with pretty much everything in BizTalk that compiles into a class. The class would reside in a .net namespace defined in the namespace property of the property schema. The name of the class would be the name you set in the type name property. (both exist in the property page accesible by slecting the xsd file of the property schema and switching to the properties pane.

Further more, in the case of property schemas, each property is compiled into a class as well. These classes will reside in the same .net namespace as the property schema and have a class name as the name of the element.

This is, of course, true for your own custom context properties as well as the system context properties such as the various adapter's context properties.

Most of the system context properties are defined in the assembly Microsoft.BizTalk.GlobalPropertySchemas. You can easily see the various namespaces and classes if you look it up in Visual Studio's object browser.

So - back to GetProeprtyValue - it all comes together now - the parameter to the function is the .net type of the property it's value you want to get - if you want to use the File adpaters ReceivedFileName property add a reference to Microsoft.BizTalk.GlobalPropertySchemas and pass typeof(FILE.ReceivedFileName) as the paremeter.

If you have created a property called MyProperty in a property schema called MyContext than you will need to pass in typeof(MyContext.MyProperty) as the parameter

Labels:

3 Comments:

  • Checking for the existence of a property in a BizTalk Server 2006 Message

    http://blogs.neudesic.com/blogs/enterprise_integration/archive/2007/03/04/BizTalk_Server_2006_Promoted_Property_checking.aspx

    They have provided a feature to support this....

    By Anonymous Thomas E. Canter, at 09/04/2007, 03:15  

  • Hi Thomas, you are, of course, abvsolutely right, as have posted 2 days after this post - http://www.sabratech.co.uk/blogs/yossidahan/2007/01/checking-if-context-property-exists_12.html

    what I did not do, and should have, is update this post.

    Thank you very much for your comment.

    By Blogger Yossi Dahan, at 09/04/2007, 08:44  

  • This is what I'm looking for!
    Thank you very much :)

    By Blogger Khem Amnueilaph, at 29/11/2013, 08:37  

Post a Comment

<< Home