Sometimes when we try to build or deploy BizTalk solution, you may get the following error message:
“Use of Unconstructed Message ‘MessageName’”
I get this error when I try to construct a multi-part message for sending an email with body and attachment.
There is a common issue when we are developing a BizTalk Server project in Visual Studio. And the reason is that Visual studio is trying to use message which has not yet been initialized, or it will “think”, that based on your flow, maybe situations that it will not be initialized.
Check if you have a reference to the message before its initialize, for example:
myMessage.Body(Microsoft.XLANGs.BaseTypes.ContentType) = "text/plain"; myMessage.Body = new …;
myMessage.Body = new …; myMessage.Body(Microsoft.XLANGs.BaseTypes.ContentType) = "text/plain";
My suggestion is, first initialize both types of the multi-part message, in my case:
myMessage.Body = new Microsoft.XLANGs.CustomFormattersSDK.RawString(“”); myMessage.Attachment = new System.Xml.XmlDocument();
and then I define other properties of the message:
myMessage(SMTP.Subject) = …;
and magic appends!! Problem solved.
I suggest not to use, but, if you’re positive that your response message will always have a value, you could instantiate the message, inside a construct shape, using:
myMessage.Body = null; myMessage.Attachment = null