Walkthrough: Module 3 - Accessing SharePoint Properties from an Orchestration
This walkthrough is a continuation of Walkthrough: Module 2 - Integrating Office with the Windows SharePoint Services Adapter and shows you how to access the Windows SharePoint Services context properties of an incoming message at run time and then determine the destination of that message based on a property using dynamic ports in an orchestration. For an introduction to the Windows SharePoint Services adapter see What Is the Windows SharePoint Services Adapter?.
Prerequisites
The following are prerequisites for performing the procedures in this topic:
You must have a single server deployment with a complete installation of BizTalk Server running on Windows Server 2008 SP2 or Windows Server 2008 R2.
You must complete the following walkthroughs: Walkthrough: Module 1 - Sending and Receiving Messages with the Windows SharePoint Services Adapter and Walkthrough: Module 2 - Integrating Office with the Windows SharePoint Services Adapter
For information about using the Windows SharePoint Services Adapter in a multi server deployment, see Setting Up and Deploying the Windows SharePoint Services Adapter.
Modify the BizTalk project
In this procedure you modify the PurchaseOrder schema from Walkthrough: Module 2 - Integrating Office with the Windows SharePoint Services Adapter. This procedure illustrates how to promote a schema property for easy access in a BizTalk orchestration.
Modify the PurchaseOrder.xsd schema
Start Microsoft Visual Studio.
Click File, click Open, and then click Project/Solution.
Browse to the
OrderProcess.sln
file, and then click Open.In Solution Explorer, right-click the
OrderProcessSchema.xsd
file, and then click Open.In BizTalk Editor, expand
PurchaseOrder
.Right-click
Amount
, click Promote, and then click Quick Promotion.Click OK.
Note
Visual Studio creates a property schema for this in the current project.
Save
PurchaseOrder.xsd
.
Create an orchestration
In this procedure you create a new BizTalk orchestration. This procedure creates the orchestration that is used to process a message received by the Windows Sharepoint Services adapter.
Add a BizTalk orchestration
In Solution Explorer, right-click the
OrderProcess
project, click Add, and then click New Item.Under Categories, select Orchestration Files.
Under Templates, select BizTalk Orchestration.
Type
MyCompanyOrderProcessing
in the Name field, and then click Add.
Create receive information
In this procedure you create a new message, receive port, and receive shape for the orchestration. This procedure illustrates how to configure an orchestration to receive a message from BizTalk Server.
Create a new message
In Orchestration View, right-click Messages, and then click New Message. This will generate a new message with the name
Message_1
.Right-click
Message_1
, click Rename, and then typeMessage_PO
.Right-click
Message_PO
, and then click Properties Window.In the Message Type property, expand Schemas, and then select
OrderProcess.OrderProcessSchema
schema.
Add a receive port to the orchestration
Under BizTalk Orchestrations in the Toolbox, drag a Port shape to the Port Surface. The Port Configuration Wizard will start.
On the Welcome screen, click Next.
Type
ReceivePurchaseOrder
in the Name field, and then click Next.Select Create a new Port Type.
Type
PurchaseOrderPT
in the Port Type Name field, and then click Next.On the Port Binding screen, leave the default values, and then click Next.
Click Finish.
In Orchestration View, under Port Types, expand the
PurchaseOrderPT
port type.Right-click
Operation_1
, click Rename, and then typePurchaseOrderOperation
.
Add a Receive shape to the orchestration
Under BizTalk Orchestrations in the Toolbox, drag a Receive shape to the Orchestration.
Right-click the Receive shape, and then click Properties Window.
Set the Activate property to
True
.Note
If the activate property is set to false, you will get the following error: "error X2214: you must specify at least one already-initialized correlation set for a non-activation receive that is on a non-selfcorrelating port"
Type
Receive_PO
in the Name field.In the Properties Window, select
Message_PO
for the Message property.Select
ReceivePurchaseOrder.PurchaseOrderOperation.Request
for the Operation property. This will tie the port to the Receive shape in the Orchestration Designer.
Create send information
In this procedure you create a new message, send ports, and decision structure to the orchestration. This procedure illustrates how to configure an orchestration with decision logic and how to configure an orchestration to send a message to a send port.
Create a new message
In Orchestration View, right-click Messages, and then click New Message. This will generate a new message with the name
Message_1
.Right-click
Message_1
, click Rename, and then typeMessage_Task
.Right-click
Message_Task
, and then click Properties Window.In the Message Type property, expand Schemas, and then select
OrderProcess.OrderProcessSchema
schema.
Add a send port to the orchestration
Under BizTalk Orchestrations in the Toolbox, drag a Port shape to the Port Surface. The Port Configuration Wizard will start.
On the Welcome screen, click Next.
Type
SendPurchaseOrder
in the Name field, and then click Next.Select Use an existing Port Type.
Under Available Port Types, select
OrderProcess.PurchaseOrderPT
, and then click Next.On the Port Binding screen, under Port direction of communication, select
I'll always be sending messages on this port
, and then click Next.Click Finish.
Add a Send shape to the orchestration
Under BizTalk Orchestrations in the Toolbox, drag a Send shape to the Orchestration Designer. Place it below the
Receive_PO
Receive shape.Right-click the Send shape, and then click Properties Window.
Type
Send_PO
in the Name field.Select
Message_PO
for the Message property.Select
SendPurchaseOrder.PurchaseOrderOperation.Request
for the Operation property. This will tie the port to the Send shape in the Orchestration Designer.
Add a Decide shape to the orchestration
Under BizTalk Orchestrations in the Toolbox, drag a Decide shape to the Orchestration Designer. Place it below the
Send_PO
Send shape.Right-click the Decide shape, and then click Properties Window.
Type
NeedsApproval
in the Name field.In Orchestration Designer, click Rule_1 on the Decide shape.
In the Properties Windows, type
ApprovalRequired
for the Name property.Click the Expression property field, and then click the ellipsis (…) button.
In the BizTalk Expression Editor, type or copy the following:
Message_PO(OrderProcess.PropertySchema.Amount) > 1000
Click OK.
Add another send port to the orchestration
Under BizTalk Orchestrations in the Toolbox, drag a Port shape to the Port Surface. The Port Configuration Wizard will start.
On the Welcome screen, click Next.
Type
SendToTasksList
in the Name field, and then click Next.Select Use an existing Port Type.
Under Available Port Types, select
OrderProcess.PurchaseOrderPT
, and then click Next.On the Port Binding screen, under Port direction of communication, select
I'll always be sending messages on this port
.Under Port binding, select
Dynamic
, and then click Next.Click Finish.
Add a Send shape to the Decide shape
Under BizTalk Orchestrations in the Toolbox, drag a Send shape to the Orchestration Designer. Place it below the
ApprovalRequired
shape.Right-click the Send shape, and then click Properties Window
Type
CreateApprovalTask
in the Name field.Select
Message_Task
for the Message property.Select
SendToTasksList.PurchaseOrderOperation.Request
for the Operation property. This will tie the port to the Send shape in the Orchestration Designer.
Create an expression
In this procedure you add an Expression shape to your solution which assigns the Tasks path value to a variable. This procedure illustrates how to add logic to an orchestration to modify the properties of a dynamic send port.
Create a new expression
Under BizTalk Orchestrations in the Toolbox, drag an Expression shape before the
CreateApprovalTask
Send shape.Right-click the Expression shape, and then click Properties Window.
Type
SetPortDestination
in the Name field.Click the Expression property field, and then click the ellipsis (…) button.
In the BizTalk Expression Editor, type the following:
SendToTasksList(Microsoft.XLANGs.BaseTypes.Address) = "wss://localhost/sites/WSSAdapterWalkthrough/Lists/Tasks/";
Click OK.
Construct a new message
In this procedure you add a Construct shape to the solution which will construct a new instance of a message type within the orchestration. This procedure illustrates how to create a new message that is a copy of the inbound message and then modify the context properties of the new message. This step is required because messages are immutable in BizTalk; that is, once you have constructed it, you cannot modify the original.
Add a Construct Shape
Under BizTalk Orchestrations in the Toolbox, drag a Construct Message shape before the
SetPortDestination
Expression shape.Right-click the Construct Message shape, and then click Properties Window.
Type
ConstructTaskMessage
in the Name field.Select
Message_Task
for the Messages Constructed property.Under BizTalk Orchestrations in the Toolbox, drag a Message Assignment shape into the
ConstructTaskMessage
Construct Message shape.In the Properties Window, type
InitTaskMessage
in the Name field.Click the Expression property field, and then click the ellipsis (…) button.
In the BizTalk Expression Editor, type or copy the following:
Message_Task = Message_PO; Message_Task(WSS.ConfigOverwrite) = "no"; Message_Task(WSS.ConfigNamespaceAliases)= "orchns='http://OrderProcess.PurchaseOrder'"; Message_Task(WSS.ConfigPropertiesXml) = "<ConfigPropertiesXml><PropertyName1>Title</PropertyName1><PropertySource1>Approve %XPATH=//orchns:PurchaseOrder/orchns:PurchaseOrderID%</PropertySource1><PropertyName3>Status</PropertyName3><PropertySource3>Not Started</PropertySource3><PropertyName4>Priority</PropertyName4><PropertySource4>(1) High</PropertySource4></ConfigPropertiesXml>";
Important
These values supplied for these context properties are case sensitive. When setting configuration values for a dynamic port with context properties you must ensure that you use the proper case or an error will occur when BizTalk attempts to route the document to the designated send port.
Click OK.
Click File, and then click Save All.
Build the BizTalk project
In this procedure you build and deploy the BizTalk project. This step is required to create and deploy the assembly that BizTalk Server uses at runtime.
Build and deploy the solution
Click Build, and then click Build OrderProcess.
Click Build, and then click Deploy OrderProcess.
Close Microsoft Visual Studio.
Modify the receive location and send port
In this procedure you modify the existing receive location and send port to use XML processing for the pipelines. The receive XML pipeline persists message properties used during orchestration processing and the send XML pipeline persists the message properties that were applied in the orchestration which are subsequently used for message routing.
Modify the receive location
Click Start, point to All Programs, point to Microsoft BizTalk Server, and then click BizTalk Server Administration.
Expand Microsoft BizTalk Server Administration SnapIn, expand BizTalk Group, expand Applications, expand BizTalk Application 1, and then click the Receive Locations node.
Right-click
SourceLocation
, and then click Properties.In the Receive Location Properties dialog box, under General, select
XMLReceive
for the Receive pipeline property.Click OK.
Modify the send port
Click the Send Ports node.
Right-click
SendToDestination
, and then click Properties.In the Send Port Properties dialog box, under General, select
XMLTransmit
for the Send pipeline property.Select the Filters tab.
Select the existing condition, press DELETE, and then click OK.
Start a new send port
Click the Send Ports node.
Right-click
OrderProcess_1.0.0.0_OrderProcess.MyCompanyOrderProcess_SendToTasksList_<GUID>
, and then click Start.
Note
You may have to refresh the console if this is not visible.
Bind the orchestration
In this procedure you bind the orchestration to the specified ports. This procedure is required to tie physical ports to the orchestration that you built and deployed.
Bind the orchestration
In the BizTalk Server Administration console, click the Orchestrations node.
Right-click the
OrderProcess.MyCompanyOrderProcessing
orchestration, and then click Properties.Select the Bindings tab.
Under Host, select
BizTalkServerApplication
in the Host field.Under Bindings, select
FromSource
for theReceivePurchaseOrder
Inbound Logical Port.Under Bindings, select
SendToDestination
for theSendPurchaseOrder
Outbound Logical Port.Click OK.
Right click
OrderProcess.MyCompanyOrderProcessing
orchestration, and then click Start.
Send a message through the system
In this procedure you create an InfoPath form and upload it to the Windows SharePoint Services Web site. The Windows SharePoint Services adapter will take that message, archive it in the Archive document library, and then send it to the Destination document library. During the processing of this message, Windows SharePoint Services context properties will be accessed that help determine the destination.
Create an InfoPath form to send through the system
Open a Web browser and navigate to the URL of the site you created. For example,
http://<server_name>/sites/WSSAdapterWalkthrough
.In the Quick Launch menu, click
InfoPathSolutions
.Click the
PurchaseOrder
file to display the File Download dialog box, and then click Open. InfoPath will load the form.In the Purchase Order ID field, type
1003
.In the Bill To field, type
John Doe
.In the Amount field, type
1750
.In the Purchase Order Date field, type
1/3/2005
.Click Save.
In the Save As dialog box, type
http://<server_name>/sites/WSSAdapterWalkthrough/Source
in the file name field, and then press ENTER.Type
PurchaseOrder3.xml
in the file name field, and then click Save.Close InfoPath.
In the Web browser, click Documents and Lists.
Under Document Libraries, click Destination.
In the Destination document library, you will now see your message listed in this library. You will also find a copy archived in the Archive document library.
Click Home.
Under Lists, click Tasks.
In the Tasks list you will see the newly created approval task.
Note
Since the amount of the purchase order was over $1,000.00, the task was created.
Summary
In this walkthrough you have seen how to access the Windows SharePoint Services context properties and how to determine the destination of messages going through dynamic ports.
Next Steps
Continue to review the rest of the Windows SharePoint Services adapter section. For more information, see the topics in See Also.
See Also
What Is the Windows SharePoint Services Adapter?
Windows SharePoint Services Adapter Walkthroughs