Microsoft InfoPath 2010
The official blog of the Microsoft InfoPath team

January, 2010

  • Microsoft InfoPath 2010

    Create a SharePoint list using InfoPath 2010

    • 14 Comments

    This week’s “5 for forms” video demo continues the theme of SharePoint list customization. In the 1st video in this series, Daniel Broekman showed how you can take an existing list on SharePoint and customize the form for that list in InfoPath.

    In this week’s video demo, Ines Khelifi, a developer on the InfoPath team shows how you can create a new SharePoint list and custom form directly from InfoPath Designer.

    Get Microsoft Silverlight

     

    Enjoy and please send us your feedback!

    The InfoPath Team

  • Microsoft InfoPath 2010

    Create tabbed navigation using picture button controls

    • 9 Comments

    In the 2nd installment of our "5 for Forms" video demo series, Charlie Han, a program manager intern on the InfoPath team shows how you can use our new picture button control to create tabs to more easily navigate your forms.


    Get Microsoft Silverlight

    (There are additional steps required to create tabs in display views. Click here to find out more.)

    Enjoy!

  • Microsoft InfoPath 2010

    Introduction to Sandboxed Solutions - Sort data in repeating tables using managed code

    • 10 Comments
    Hi. My name is Phil Newman and I'm a program manager on the InfoPath team. In this post, I'd like to introduce you to one of my favourite new features in InfoPath 2010 - Sandboxed Solutions. In InfoPath 2010, forms with code can now be published directly to SharePoint without requiring the farm administrator to approve and upload them! These forms run in a sandboxed environment which protects other resources on the SharePoint server from malicious code.

    In this short video demo, I show how you can add the ability to sort repeating tables in your forms using code.  I use picture buttons in the heading of the repeating table to trigger the code which sorts the table based on the values in the columns. 

    Get Microsoft Silverlight

    About the Code

    In a nutshell, the code puts the XML from the repeating table into an array, sorts the array using built-in .Net functionality, and then writes back into the XML to update the table.

    //Sorts a repeating table.  Takes the parent group node and the index of the column to sort by.

    private void SortTable(string xpathToSort, int columnToSortBy)

    {

    //get the values in an array

    string[][] ValuesToSort = GetRepeatingTableValues(xpathToSort);

    //sort the array

    Array.Sort(ValuesToSort, new StringArrayComparer(columnToSortBy));

    //write the values back to the xml

    SetRepeatingTableValues(xpathToSort, ValuesToSort);

    }

    //Takes an array of arrays and inserts it into a repeating table

    //Assumes that the array and table are the same size

    private void SetRepeatingTableValues(string xpathToSet, string[][] tableValues)

    {

    //Create a navigator on main node supplied in the parameters

    XPathNavigator mainGroup = this.CreateNavigator().SelectSingleNode(xpathToSet, this.NamespaceManager);

    //Clone the first child node of the main navigator and populate it with data

    XPathNodeIterator tableRows = mainGroup.SelectChildren(XPathNodeType.Element);

               

    //iterate through the existing XML and update the values from the sorted array

    for (int i = 0; i < tableValues.Length; i++)

    {

    tableRows.MoveNext();

    XPathNodeIterator thisRow = tableRows.Current.SelectChildren(XPathNodeType.Element);

    for (int j = 0; j < tableValues[0].Length; j++)

    {

    thisRow.MoveNext();

    thisRow.Current.InnerXml = tableValues[i][j];

    }

    }

    }

    //Returns an array of arrays of strings representing the values in a repeating table

    private string[][] GetRepeatingTableValues(string xpathToGet)

    {

    XPathNavigator myNav = this.CreateNavigator();

    int rows, cols;

    XPathNodeIterator tableNodes;

    //figure out the dimensions of the table

    tableNodes = myNav.SelectSingleNode(xpathToGet, this.NamespaceManager).SelectChildren(XPathNodeType.Element);

                rows = tableNodes.Count;

               

    //move to the first row to count the columns

    tableNodes.MoveNext();

    cols = tableNodes.Current.SelectChildren(XPathNodeType.Element).Count;

    //create an array to store the values

    string[][] tableValues = new string[rows][];

    //get all the rows in the table

    tableNodes = myNav.SelectSingleNode(xpathToGet, this.NamespaceManager).SelectChildren(XPathNodeType.Element);

    //iterate through the rows and write the inner xml of each element in each row to the array

    for (int i = 0; i < rows; i++)

    {

    tableNodes.MoveNext();

    XPathNodeIterator childNodes = tableNodes.Current.SelectChildren(XPathNodeType.Element);

    string[] rowValues = new string[cols];

    for (int j = 0; j < cols; j++)

    {

    childNodes.MoveNext();

    rowValues[j] = childNodes.Current.InnerXml;

    }

    tableValues[i] = rowValues;

    }

    return tableValues;

    }

    //Comparison implementation for array or arrays

    class StringArrayComparer : IComparer

    {

    private int iColumn;

    public StringArrayComparer(int iColumn)

    {

    this.iColumn = iColumn;

    }

    int IComparer.Compare(Object x, Object y)

    {

    string[] xAsString = (string[])x;

    string[] yAsString = (string[])y;

    return xAsString[iColumn].CompareTo(yAsString[iColumn]);

    }

    }

    Requirements for publishing your forms with code as Sandboxed solutions:

    • The Sandboxed code service need to be enabled on the farm
    • You must be a site collection administrator on the site collection you’re publishing to
    • Your form must be domain trust
    • Your form template must be an InfoPath 2010 template
    • InfoPath 2007 form code needs to be upgraded to InfoPath 2010 form code

    Complete sandboxed solution documentation is available here.  Note that InfoPath takes care of packaging and activating the solution, all you need to do is publish your form to a document library or as a site content type.

    I look forward to hearing your comments about this new feature. Let me know what you think!

    Phil

  • Microsoft InfoPath 2010

    Manage data in your SharePoint Lists using the InfoPath Form Web Part

    • 6 Comments

    One of the powerful new features in InfoPath 2010 is the InfoPath Form Web Part.

    This is the 1st in a series of videos where we will show how to use the InfoPath Form Web Part to create rich mashups on portal pages in SharePoint, without writing a single line of code. In this video, Nick Dallett, a program manager lead on the InfoPath team, will demo two simple scenarios for managing data in your SharePoint lists using the InfoPath Form Web Part.

     

    Get Microsoft Silverlight

    Enjoy!

  • Microsoft InfoPath 2010

    Manage data in your SharePoint Lists using the InfoPath Form Web Part

    • 2 Comments

    One of the powerful new features in InfoPath 2010 is the InfoPath Form Web Part.

    This is the 1st in a series of videos where we will show how to use the InfoPath Form Web Part to create rich mashups on portal pages in SharePoint, without writing a single line of code. In this video, Nick Dallett, a program manager lead on the InfoPath team, will demo two simple scenarios for managing data in your SharePoint lists using the InfoPath Form Web Part.

     

    Get Microsoft Silverlight

    Enjoy!

  • Microsoft InfoPath 2010

    Sign up now for the InfoPath 2010 Academy Live Series!

    • 0 Comments

    Registration is now open for the 1st session in the InfoPath 2010 Academy Live Series, An Introduction to SharePoint Applications using InfoPath 2010, presented by Bojana Duke.

    In this series, you will hear directly from InfoPath product team members who will talk in-depth about  InfoPath and Forms Services 2010 and how you can quickly and  easily build applications in SharePoint without writing a line of code.

    Click the link below to sign up for this free event.

    Event Title: An Introduction to SharePoint Applications using InfoPath 2010 (INP02AL)
    Date/Time: Wed Feb 10, 2010, 8:30 AM, USA Pacific
    Event Registration URL: https://www.eventbuilder.com/event_desc.asp?p_event=e0b96f2a

  • Microsoft InfoPath 2010

    Announcing the InfoPath 2010 Academy Live Series!

    • 0 Comments

    Do you want to hear about the exciting, new features and scenarios that have been added in InfoPath and InfoPath Forms Services 2010? Then, sign up for our upcoming Academy Live series.

    In this series, you will hear directly from InfoPath product team members who will talk in-depth about  InfoPath and Forms Services 2010 and how you can quickly and  easily build applications in SharePoint without writing a line of code.

    The series will consist of 4 sessions presented by members of the InfoPath product team. We will present 1 session a month, starting with an “Introduction to InfoPath and InfoPath Forms Services 2010”, presented by Bojana Duke from the InfoPath program management team. This session will take place on Wednesday, February 10th at 8:30 AM (PST).

    Whether you are an InfoPath newbie or an experienced InfoPath user, we encourage you to sign up for these free sessions. Stay tuned for more details on how to sign up.

    Thanks!

    The InfoPath team.

Page 1 of 1 (7 items)