Thought this was worth a post its something that pretty easy to do with EWS but not something that maybe initially obvious. If you want to add an X-header to a message your sending via Exchange you need to add this via the PS_INTERNET_HEADERS namespace. With EWS you do this when using the MessageType class by adding an Extended property. Eg if you take the basic send message via EWS example from MSDN http://msdn2.microsoft.com/en-us/library/bb408521.aspx and all you need to do is add the following to add your own custom X-header
message.Sensitivity = SensitivityChoicesType.Normal;
// Start X-header Code
PathToExtendedFieldType epExPath1 = new PathToExtendedFieldType();
epExPath1.DistinguishedPropertySetId = DistinguishedPropertySetType.InternetHeaders;
epExPath1.DistinguishedPropertySetIdSpecified = true;
epExPath1.PropertyName = "x-myheader";
epExPath1.PropertyType = MapiPropertyTypeType.String;
ExtendedPropertyType xhXheaderProp = new ExtendedPropertyType();
xhXheaderProp.ExtendedFieldURI = epExPath1;
xhXheaderProp.Item = "blah";
message.ExtendedProperty = new ExtendedPropertyType[] { xhXheaderProp };
// End X-header Code
// Add the message to the array of items to be created.
createItemRequest.Items.Items = new ItemType[1];
message.Sensitivity = SensitivityChoicesType.Normal;
// Start X-header Code
PathToExtendedFieldType epExPath1 = new PathToExtendedFieldType();
epExPath1.DistinguishedPropertySetId = DistinguishedPropertySetType.InternetHeaders;
epExPath1.DistinguishedPropertySetIdSpecified = true;
epExPath1.PropertyName = "x-myheader";
epExPath1.PropertyType = MapiPropertyTypeType.String;
ExtendedPropertyType xhXheaderProp = new ExtendedPropertyType();
xhXheaderProp.ExtendedFieldURI = epExPath1;
xhXheaderProp.Item = "blah";
message.ExtendedProperty = new ExtendedPropertyType[] { xhXheaderProp };
// End X-header Code
// Add the message to the array of items to be created.
createItemRequest.Items.Items = new ItemType[1];