Since we are determining at run time the location of the
document in SharePoint, we will use a dynamic port in the Orchestration. This
will be determined based on the content of the message. This type of routing
is referred to as Content Based Routing in BizTalk 2006.
Add a new BizTalk project. You will need to add some shapes
to the orchestration; below is a sample snapshot of all of the shapes being used
for this demo.
Notice that on the orchestration, we are only routing on the
Category of the document being submitted. However, in a real world
application, there might be more than one field to be used to determine where
the final destination might be.
This is what the finished orchestration looks like:
Figure 11
Here is a snapshot of the Orchestration tab:
Figure 12
Explanation:
Inside the Construct message we will have the following
code.
Listing 1
1 //Messages are immutable
2 outMsg = InMsg;
3
4 //if the form is found on the library, then overwrite it with this new one.
5 outMsg(WSS.ConfigOverwrite) = "yes";
6
7 //turn this off, if you are to insert the InfoPath PI's to the form.
8 outMsg(WSS.ConfigOfficeIntegration) = "no";
9
10 //set the filename in here
11 outMsg(WSS.Filename) = InMsg.Book.ISBN + ".xml";
12
13 //set the base library in here:
14 sWSS_SiteLocation = @"wss://evo/BookReview/";
For the PI that you are dynamically creating, add the
following.
Listing 2
//adjust the file attachment PI
outMsg(XMLNORM.ProcessingInstructionOption) = 1;
outMsg(XMLNORM.ProcessingInstruction) =
"<?mso-infoPathSolution PIVersion=\"1.0.0.0\"
href=\"http://evo/BookReview/Forms/template.xsn\"?><?mso-application
progid=\"InfoPath.Document\"?><?mso-infoPath-file-attachment-present?>";
Inside the medical of the Expression shape, we execute this
code:
Listing 3
//add the location of the folder in here.
sWSSTargetPathLocation = sWSS_SiteLocation + "Medical";
Then on the last expression shape, labeled Dyn WSS Address,
we dynamically set the address where this document is going to be sent.
Listing 4
//set the destination of the dynamic form based on the criteria above.
WSS_BookReview(Microsoft.XLANGs.BaseTypes.Address) = sWSSTargetPathLocation;