September 2005 - Posts - Greg Collins

InfoPath Dev

This Blog


Greg Collins

September 2005 - Posts

  • Use the SharePoint '[Me]' Filter with a Promoted Property

    When saving InfoPath forms to SharePoint document libraries you might need to limit the forms users see. For example, if you have an established workflow, you might want to limit users to see only those forms that are assigned to them.

    SharePoint provides a special filter so that users can see, for example, only those items that they created or modified, for example. This is known as the 'Me' filter. Attempting to use this filter with promoted properties, such as the user name, fails, and the SharePoint view renders the text <!-- #RENDER FAILED -->. This is because the 'Me' filter only works with SharePoint user IDs, not user names.

    In this task, we will create a simple InfoPath form that will present a list of SharePoint users and promote the selected user name and ID. We will publish the form to a SharePoint form library and then modify the default view to filter the list based on the logged in user. You will need access and rights to an available SharePoint to complete this task.


    First we will create a very basic InfoPath form that allows you to assign the form to a SharePoint user. To get the list of SharePoint users we need to manually modify the form manifest as the SharePoint user list is not available via the designer. Let's start by designing a new blank form.

    Create the schema:

    1. Open the Data Source task pane.
    2. Add a two Text fields named FormTitle, AssignedTo.
    3. Select AssignedTo, and add a Text Attribute field named id.

    Create the view:

    1. Right-click FormTitle, choose Text Box, and then press Enter.
    2. Right-click AssignedTo, and then choose Drop-Down List Box.

    Add a SharePoint list data connection:

    1. Double-click the drop-down list box.
    2. Select Look Up Values In A Data Connection, and then click Add.
    3. In the Data Connection Wizard, select SharePoint Library Or List, and then click Next.
    4. Type the URL to your SharePoint site, and then click Next.
    5. Select any list or library, and then click Next.

    It does not matter which list or library you select as we will be manually modifying it later to get the list of SharePoint users.

    1. Ensure that only the ID and Title check boxes are selected, and then click Next.
    2. Name the data connection SharePoint Users, and then click Finish.

    Populate the drop-down list box using the new data connection:

    1. Click the Select XPath button to the right of the Entries text box.
    2. Select :Title, and then click OK.

    Set the ID when Assigned To changes:

    1. Click Rules, and then click Add.
    2. Name the rule Set ID, and then click Add Action.
    3. In the Action dialog box, select Set A Field's Value from the Action drop-down list.
    4. Click the Select XPath button to the right of the Field text box, select AssignedTo/id, and then click OK.
    5. Click the Insert Formula button to the right of the Value text box, and then click Insert Field Or Group.
    6. In the Select A Field Or Group dialog box, select SharePoint Users from the Data Source drop-down list.
    7. Select :ID, click Filter Data, and then click Add.
    8. In the Specify Filter Conditions dialog box, select Title from the first drop-down list, and then select Select A Field Or Group from the third drop-down list.
    9. In the Select A Field Or Group dialog box, select Main from the Data Source drop-down list, and then select AssignedTo.
    10. Click OK nine times to close all the open dialog boxes.

    Promote the form fields to SharePoint:

    1. Select Form Options from the Tools menu.
    2. On the Form Library Columns tab of the Form Options dialog box, click Add.
    3. Select FormTitle, and then click OK.
    4. Click Add, select AssignedTo, name the column Assigned To, and then click OK.
    5. Click Add, select AssignedTo/id, and then name the column Assigned To ID.
    6. Click OK twice to close all to close the open dialog boxes.

    Extract the form files:

    1. Choose Extract Form Files from the File menu.
    2. Select a location to save your extracted form files to, and then click OK.
    3. Close InfoPath to release the lock it places on your form files.
    4. Using a text editor, open your manifest.xsf file.
    5. Search for the text sharepointGuid.

    This is an attribute on an xsf:sharepointListAdapter object with the attribute name="SharePoint Users".

    1. Change the value of the sharepointGuid attribute to UserInfo. The updated attribute should look like the following:


    1. Save the manifest.xsf file, and then close the text editor.
    2. Reopen your form template by right-clicking the manifest.xsf file and choosing Design.

    You have now a drop-down list box populated with a list of SharePoint users. Preview your form to test it. You might find some systems users such as NT AUTHORITY\NETWORK SERVICE in your list. These can be hidden by adding a filter to your drop-down list box.

    Publish your form to your SharePoint, close your form, and then open your form from its published location.


    Fill out the form a few times, assigning each to different users and saving back to the form library. Finally, click All Forms to refresh the view. You should now see each of the forms you just saved, including the promoted properties for Title, Assigned To and Assigned To ID. Now let's update the default view so that it does not show the Assigned To ID field and only displays forms assigned to you.

    Update the default SharePoint view:

    1. Click Modify Settings And Columns.
    2. Click All Forms in the Views section.
    3. In the Columns section, clear the Assigned To ID check box.
    4. In the Filter section, select Assigned To ID from the first drop-down list, and then type [Me] in the text box.
    5. Click OK, and then click the Go Back To link at the top of the page.

    The default SharePoint view now automatically filters items to only show those assigned to the currently logged in user—you in this case.

    ©2005 Greg Collins. All rights reserved. Licensed to Autonomy Systems, LLC for display on

Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.