Get the content type of the message part when using the POP3 adapter.

If you are using the POP3 adapter and want to get the content type of the message part(body or attachments), you can do so by accessing the contenttype property below:

var fileContentType = messagePart.GetPartProperty(typeof(Microsoft.XLANGs.BaseTypes.ContentType))).ToString();

Various mime types are shown here.

Advertisements

Get the POP3 context properties in a .net component.

Ever wondered how to access the pop3 context properties like from, to, cc etc (in a .net assembly) called from BizTalk? Its quite simple really. All you need to do is add a reference to Microsoft.BizTalk.GlobalPropertySchemas assembly (found in the BizTalk Server 2009 folder under program files).

The Microsoft.BizTalk.GlobalPropertySchemas namespace contains property schemas that various BizTalk Server components use. This namespace contains system properties that the BizTalk engine uses along with transport specific properties that each transport uses for handling the configuration and properties for configuring pipeline components.

Once you have added the reference, you can get access to the POP3 context properties as under:

Using...
Using Microsoft.BizTalk.GlobalPropertySchemas;

Class MyComponent
{
public void SomeMethod(XLANGMessage msg)
{
var value=msg.GetPropertyValue(typeof(POP3.From));
}

}

Creating an event source using .reg files

Often you may feel the need to have your own source to log events when building BizTalk applications. Creating sources through code requires elevation. One simple way to do this is to use .reg files.

Lets assume you want to create a source called “MyApplicationSource”.

1) Open Wordpad.
2) Type the following:


Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\MyApplicationSource]
“EventMessageFile”=”C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\EventLogMessages.dll”

3) Save the file as txt (MSDOS format). This is important.
4) Double click on the file and the source will be created for you.

Important: Take extreme caution when modifying the registry. It always a good idea to create a restore point before making any changes to the registry.