Gorgo.Live.ToString()

Mariusz, Gorzoch tech Blog

Archive for December 2009

BizTalk 2006R2 + Moss 2007 + InfoPath 2007 integration

with 3 comments

Today I found a task where I needed to create “error” InfoPath form on SharePoint, where this form will be created on the fly by BizTalk. On the beginning I just didn’t know where to start as I wasn’t sure if I should start by creation of InfoPath form, or maybe I should start by creating schema inside BizTalk and then base on that create InfoPath form. On the end I manage to do so, so have look here and find all necessary steps to achieve that.

1. Create your schema. This should be done on BizTalk, so go to Visual Studio and create new schema.

2. Go to InfoPath and start designing new form template based on schema you have created in visual studio

 

3. When you finish designing your template then you are publishing it to the destination form library. To do so you can use “Publish form template” wizard in InfoPath

4. Design your orchestration. This is the step where you are coming back to visual studio and creating orchestration, which in some point will emit document to SharePoint library. In my case I’ve created really simple one, where I just getting a message from message box, transforming it into destination schema (created in point 1), and…

…and here we are getting to really important point. Transforming input message into output SharePoint/InfoPath document is not only about converting input document into output. To make your document work properly you need to perform one additional step. So first, we are transforming out document to the output one, and then we need to adjust default namespace name used inside document created by BizTalk to be “ns0” instead of “ns1” (default one created by BizTalk). If you will not go for that, then you will not see promoted field on the SharePoint list. Here is some good post and solution for that (look into comments): http://seroter.wordpress.com/2007/10/25/problem-with-infopath-2007-and-sharepoint-namespace-handling/ 

To adjust namespaces you need to place new “Assign message” shape and fill it with (please notice that this block is already placed on the picture above under name “AdjustSharepointDocument”):

where,

  • WSSForm = System.Xml.XmlDocument
  • WSSNodeList = System.Xml.NodeList
  • WSSNode = System.Xml.Node
  • WSSForm_Internal <- InfoPath message created by transforming orchestration input message into our SharePoint message
  • WSSForm_ToSend <- InfoPath message which we are going to send to SharePoint site

Now, build, compile and deploy.

5. Set-up “Windows SharePoint service adapter” (WSS adapter). Go to BizTalk administration console, open your application and create new “Send port” based on “WSS adapter”

and configure it as fallow:

  • Destination Folder URL = “Name of you SharePoint library, where you published you InfoPath template”
  • FileName = “Name of the file BizTalk should use to create file name”
  • Overwrite = “Yes” (so BizTalk will overwrite file if it exists)
  • SharePoint Site URL = “URL of you SharePoint site”
  • Microsoft Office Integration = “Yes (InfoPath Form Library)
  • Templates Document Library = Destination Folder URL
  • Templates Namespace Column = “NameSpace”

When you do so, then go and bind this port to your orchestration.

If you did everything as described above then after your orchestration will get message your should get new file on SharePoint created based on the template created in point 2.

If you need Visual Studio project for that, then you can get it from here

Advertisements

Written by Mariusz Gorzoch

15 December 2009 at 11:53

Posted in BizTalk

The description for Event ID (0) is Source…

leave a comment »

Did you ever wrote your application and tried to log something into event log, and then get in addition to your message, something like that:

I did and as you can see I get this error. Happy solution to get rid of this is quite simple:

1. Open regedit and navigate to the node : “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\” + {Your event source name}

2. Check if you have a string key named “EventMessageFile” and if so, adjust his value to : “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll”. If you don’t then create new key and assign to you mentioned value.

DONE. This should remove not needed text from your “Description” window.

Written by Mariusz Gorzoch

14 December 2009 at 12:58

Posted in Bez kategorii