Display a list view in InfoPath

If you want to display all entries from a SharePoint list inside your InfoPath form, browser enabled or not, then do the following.

You have a list in SharePoint already, right..
Add a data connection to that list the usual way in InfoPath
Open the “Data source” in the right task pane and select the list (it is listed as a Secondary):

Right click it and select “Repeating table” and drag and drop it to your form

The list is displayed with all entries:

Share this blog post:

Use a SQL data connection in InfoPath

If you want to receive data from a SQL table directly into a field in InfoPath then do the following. First, create a new library in your SharePoint site using the template ”Data connections library”:

Name the library like “SQLConnections” or something. (Choose not to display it in your QuickLaunch if you want to hide this library):

Open InfoPath and open the form in which you want your new data connection (or you can open a blank form and do the same thing there). Click on “Tools” and “Data connections” and create a new SQL database connection:

Connect to your SQL server:

Select the database:

Finish and your data connection is added. Now, click on “Convert” button:

Enter the URL of your SharePoint site and the Data Connection library that you created before. Remove the “Forms/Allitems.aspx” at the end of the URL and replace that with a filename instead, for example “myconnection.udcx”:

When you finish, you’ll see that the “Convert” button is grey. Press Close to return to the form:

Go to your field where you want to display data from the data connection source:

Publish it and test it in your browser:

Share this blog post:

Collect user information from AD through InfoPath

I wanted a webpart in SharePoint that displays certain user information from the AD. Looked at a couple of webparts Bamboo, SharePoint Boost, etc but all of those are directly connected to the AD and I did not want the user to be able to push information back into the AD. Only display it so that the user can send a request to change the information through a simple list.
So I thought that InfoPath might be able to do some lookups for me, and yes the webservice that calls on UserProfiles was perfect for this! And since I am used to InfoPath and how you can perform lookups inside the form using one specific field I thought that it could not be that hard to get all information using the “Username” field. All fields in the form are read-only and it is published as a web form. The result is the following webpart:

Mail me if you want some more explanation or instructions!

I love that you can use InfoPath without any code… Powerful!
Share this blog post:

Deep dive into InfoPath

I am on new and thrilling territories right now, not really sure what I am doing but it’s getting clearer and clearer… My mission is to place a button in an InfoPath form, with code behind that transforms the xml file into a PDF file and then inserts itself into a mail and of course – sends the mail 🙂 Easy I thought, someone must have done that before. Googled it, found one article. And I have tried to follow it, but since I am not a developer there were some “issues” that needed to be understood first. Finally I have produced some code thanks to VS, VSTA, Notepad (i love Notepad btw :)), and some hacking into web.config and other shit. So now, wow, tried to execute my code and – nothing happens. Or, something happens, but it just seems to reload or tries to run the code but no PDF is created. So I think I have to make sure that the dll files are listed in web.config and that my itext-dll is registered. To be continued, the whole code will be published here if I ever make it 🙂 I really miss my dev pro’s at work now….

Share this blog post:

Character settings in mail from InfoPath

I don’t really know how to explain this error correctly but what happens is that when you receive a mail via InfoPath Forms Services it is not presented with any swedish characters “ÅÄÖ” but instead it uses like wing dings or something. It looked like this:

But after changing the setting “Web application outgoing email settings” in Central Administration (on “Application management”) it displays correctly. Every web app was set to Unicode so I change it to 1252 Western European Windows, and voila – you can now read the mail without having to change the coding:

Thank you Scott Heim at Microsoft!
Share this blog post:

Remove the “Powered by…” in InfoPath forms

In this folder (the one and only.. right?) “C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12TEMPLATELAYOUTSINC” is a file that is called “ifsmain.css”. This stylesheet file controls how a web form built by InfoPath is displayed. If you want to remove the logo “powered by InfoPath services” that is displayed in the bottom of every web form then write “display:none” or color the text tag to the same as your background color.

Share this blog post:

Error message in InfoPath after MUI installation of swedish lang files for Office

After the installation of the MUI swedish language files on our Sharepoint server, the following error occurs:
if you have any multiline fields in your InfoPath forms, like RTF fields, you are no longer able to mail those forms!
Really strange error, I know – but my world is full of strange errors…. I am so sick of it. The entire message reads:

Reference to undeclared entity ‘nbsp’. Line 85, position 6559.
System.Xml.XmlException: Reference to undeclared entity ‘nbsp’. Line 85, position 6559.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.HandleGeneralEntityReference(String name, Boolean isInAttributeValue, Boolean pushFakeEntityIfNullResolver, Int32 entityStartLinePos)
at System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos)
at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
at System.Xml.XmlTextReaderImpl.FinishPartialValue()
at System.Xml.XmlTextReaderImpl.get_Value()
at Microsoft.Office.InfoPath.Server.Xml.SafeXmlReader.get_Value()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlDocument.Load(XmlReader reader)
at Microsoft.Office.InfoPath.Server.Xml.SafeXmlDocument.Load(XmlReader reader)
at Microsoft.Office.InfoPath.Server.Xml.SafeXmlDocument.LoadXml(String xml)
at Microsoft.Office.InfoPath.Server.SolutionLifetime.DataAdapterEmail.GetViewHtml(XmlDocument input, String viewName, XsltContext xsltContext, Solution solution, Boolean cleanUpFormatting, String intro, String introSubmittedBy, ImageAttachmentHelper imageAttachmentHelper)
at Microsoft.Office.InfoPath.Server.SolutionLifetime.DataAdapterEmail.Execute(XPathNavigator input, String to, String cc, String bcc, String subject, String intro, String attachmentFileName, String viewName, Boolean sendAsInfoMail, EmailAttachmentType emailAttachmentType, XsltContext xsltContext, String xsnUrl)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DataAdapterEmail.ExecuteInternal(XPathNavigator input)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DataAdapterEmail.Execute()
at Microsoft.Office.InfoPath.Server.SolutionLifetime.RuleAction.EvaluateExpression(Document document, XPathNavigator currentTarget)
at Microsoft.Office.InfoPath.Server.SolutionLifetime.RulesRuleSet.<>c__DisplayClass7.b__4()
at Microsoft.Office.InfoPath.Server.SolutionLifetime.RulesRuleSet.EvaluateExpression(Document document, XPathNavigator targetNavigator)
at Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonFormCode.<>c__DisplayClass2.b__0()
at Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonFormCode.Click(Document document, XPathNavigator container)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.EventClick.Play(Document document, BindingServices bindingServices, EventLogProcessor eventLogProcessor)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.Event.PlayEvent(Document document, BindingServices bindingServices, EventLogProcessor eventLogProcessor)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.EventLogProcessor.<>c__DisplayClass1.b__0()
at Microsoft.Office.InfoPath.Server.DocumentLifetime.EventLogProcessor.ExecuteLog(Int32 expectedEventLogID)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.Document.<>c__DisplayClass6.b__3()
at Microsoft.Office.Server.Diagnostics.FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock)

And the simple solution to this error is to replace your multiline field and replace them with “common” plain text fields. And, tada, you are able to mail the form again!

Share this blog post: