Wenn ich einen Wert mal non-standard formatiert ausgeben will, muss ich regelmäßig die MSDN rauf und runter suchen, weil mir der richtige Formatstring fehlt.
Jetzt habe ich ein schönes cheat sheet gefunden, was dies auf wenigen Seiten zusammenfasst.
Wenn ich einen Wert mal non-standard formatiert ausgeben will, muss ich regelmäßig die MSDN rauf und runter suchen, weil mir der richtige Formatstring fehlt.
Jetzt habe ich ein schönes cheat sheet gefunden, was dies auf wenigen Seiten zusammenfasst.
There are several locations on the web where you are told how to send emails and also how to send attachments with them as well.
I had a working piece of code doing exactly this but I had to redo it using a pipeline componentan instead of an orchestration.
Everything is straightforward. If you had set the context value in your orchestration like this:
EmailOut(SMTP.MessagePartsAttachments) = 2;
you would take a look in the msdn to get the values right and then translate it to the following code in your pipeline component:
inmsg.Context.Write(“MessagePartsAttachments”,
“http://schemas.microsoft.com/BizTalk/2003/smtp-properties”, 2);
I did this with every context value and tested it. It worked well but there was no attachment?! But there was also no error!
Finding the solution took me more time then I am willing to admit…
If you take a sharp look in the MSDN then you might find this:
[SerializableAttribute]
[GuidAttribute("9EE763F5-ECE7-42f6-BE97-38EA64FB7607")]
[IsSensitivePropertyAttribute(false)]
[PropertyGuidAttribute("9EE763F5-ECE7-42f6-BE97-38EA64FB7607")]
[PropertyTypeAttribute("MessagePartsAttachments",
"http://schemas.microsoft.com/BizTalk/2003/smtp-properties",
"unsignedInt", "System.UInt32")]
public sealed class MessagePartsAttachments : MessageContextPropertyBase
I was desperate at best and tried everything and this one worked:
inmsg.Context.Write(“MessagePartsAttachments”,
“http://schemas.microsoft.com/BizTalk/2003/smtp-properties”, (UInt32)2);
You cannot see any difference at all if you take a look at a suspended/tracked message but this was the cause of the missing attachments. I hope this might save you some time!
Sitzt man mal wieder vor dem Debugger und interessiert sich, was nun eigentlich für Daten in diesem Stream stehen, dann hilft das Immediate Window. Aber selbst damit ist es mir bisher nicht unbedingt einfach gefallen.
Folgendes Snippet erfüllt den Job aber als Einzeiler:
File.WriteAllText("c:\\streamOut.txt", new StreamReader(meinStream).ReadToEnd());
Zu beachten ist, dass je nach Typ von meinStream die Position anschließend zurück gesetzt werden muss oder auch, das dies gar nicht möglich ist und daher die weitere Programmausführung fehlerhaft wird.