Clayton's SharePoint Madness

All About SharePoint, InfoPath, and SharePoint Designer!

InfoPath – Allowing Anonymous users to Submit Forms in SharePoint 2010

Posted by Clayton Cobb on June 3, 2011


You all know how much I like InfoPath, so you probably know how much it pained me not to be able to provide InfoPath forms to anonymous users in SharePoint 2007. For one, you don’t want to use a Filler form, because it’s a guarantee that not every anonymous will have InfoPath installed locally. However, even if we used browser forms, anonymous users are not allowed to submit documents. There are some permissions hacks for working around that to some degree, but they are not recommended. There is another method where you can set up a web service submit to use the Lists.asmx web service for submitting the data from the form to a list without actually submitting the InfoPath document (XML). S.Y.M. Wong-A-Ton has a great article showing 5 ways to submit to lists from library form templates: 5 Ways to submit an InfoPath form to a SharePoint list.

So, the good news is that we now have a brand new feature in SharePoint 2010 that allows us to utilize InfoPath as LIST forms. This is an amazing new feature, because people have been customizing their ASPX list forms for years with SharePoint Designer, but it was nowhere near as easy nor as powerful as using InfoPath; however, there was no way to use InfoPath directly for list forms. That has all changed, because now we can do it. Because of this, we can also allow our anonymous users to submit customized InfoPath forms without any custom web services, without the need for code, without any permissions hacks, and generally without any fuss at all. In this blog post, I am going to show you how – it’s very easy.

***Warning: InfoPath list forms are ONLY available in SharePoint Server 2010 Enterprise, because they are considered browser forms. Of course, this is the same for library-based browser forms, so this would be no different if trying to use library forms.

Here are the major steps we’ll cover:

  1. Configure a SharePoint site to allow anonymous access
  2. Create a Customers List that allows anonymous submits
  3. Convert the list to InfoPath
  4. Create a custom page for anonymous user interaction with the InfoPath form

Configure a SharePoint site to allow anonymous access

  • First, you need to enable anonymous access at the Web Application level by browsing to Central Administration > Application Management > Manage Web Applications. In this example, I have a new web application named “Anonymous,” and I have set it to allow anonymous access (Fig. 1 and 2).

Figure 1 – Managing the “Anonymous” web application. Click Authentication Providers in the ribbon

Figure 2 – Enabling anonymous access for a specific zone in a web application

  • Next, you need to enable Anonymous Access on a site within the above web application. If you created a new web application, then create a new site collection. If you modified an existing web application, then either create a new site collection or browse to a site on an existing site collection. Once you decide where you want to test this, browse to that site and click Site Actions > Site Permissions. Then, click the Anonymous Access button in the ribbon (Fig 3).

Figure 3 – Enabling Anonymous access at the site level

Figure 4 – Choosing the scope of access for Anonymous users

  • At this point, you should be able to browse to this site without getting prompted to log in even if you do have the ability to authenticate. Instead of seeing your name in the top right corner of the page, you should see a link that says “Sign In.” (Fig. 5)

Figure 5 – Browsing to a SharePoint 2010 site anonymously

Figure 6 – Result of signing in to the same site as an authenticated user

Create a Customers List that allows anonymous submits

This is just an everyday activity in SharePoint, but we need it in order to show the solution.

  • On the site from above, create a new Contacts list named “Customers.” (Fig. 7)

Figure 7 – Creating a new Contacts list on the Anonymous site

  • Go to the List Permissions and stop inheriting permissions first (Fig. 8)

Figure 8 – Breaking permissions inheritance on the Customers list

  • Now, allow Anonymous users to Add items (edit and delete are optional, but not recommended). (Fig. 9, 10, and 11)

Figure 9 – Clicking the Anonymous Access ribbon button after breaking permissions inheritance

Figure 10 – Adding the “Add Items” permission for Anonymous users on the Customers list

Figure 11 – Results of giving Add Items permission to Anonymous users

  • Now, your anonymous user should be able to add an item to the Customers list (Fig. 12).

Figure 12 – View of Customers list as an anonymous user

Convert the list to InfoPath

  • Now, we get to use the awesome new feature of InfoPath Forms Services that allows us to modify list forms with InfoPath. You must be logged in as an authenticated user to do this, and you must use Internet Explorer to invoke it from the ribbon or from the List Settings > Form Settings page. You can also invoke this change from the list settings page in SharePoint Designer 2010. (Fig. 13, 14, and 15)

Figure 13 – Converting the list to InfoPath in the Customize List section of the List Tab of the List Tools ribbon

Figure 14 – Converting the list to InfoPath in the List Settings > Form Settings

Figure 15 – Converting the list to InfoPath in SharePoint Designer

  • When doing any of the above, a new InfoPath list form template opens on your local machine, so be sure you have InfoPath 2010 installed. The template will have a basic table with all the list columns displayed. Likewise, all the fields are visible in the data source pane on the right (Fig. 16).

Figure 16 – Default list form template for the Customers list

  • Now, you can customize the form to make it look how you want, and you can even add data connections, but just be sure the users have permissions to the source of those data connections. My form below has a banner image, a thinner table for the default fields, a custom submit button, and a few repeating tables for showing secondary data from other lists on the site (Fig. 17).

Figure 17 – Customized InfoPath list form template for the Customers list

  • Notice that the anonymous user is able to open this form by clicking “Add new item.” I purposely right-clicked and chose “open link in new tab” to avoid the modal dialog, because you wouldn’t be able to see that the user is anonymous (Fig. 18). Notice also that the two repeating tables on the right are both populated with data from other lists (tasks list and the same Customers list).

Figure 18 – Customized list form opened by an anonymous user

  • Notice below how I am an anonymous user, and I can see items submitted by both authenticated users and anonymous users (Created By is blank).

Figure 19 – Viewing list items submitted by authenticated and anonymous users in the Customers list

Create a custom page for anonymous user interaction with the InfoPath form

So, you can already see that anonymous users can easily submit to lists using InfoPath forms, but I’m going to show you one more step so that you see it can all be done through the InfoPath Form Web Part through a guided interface instead of the user going directly to the list.

First, let’s create a custom page with nothing on it except the InfoPath Form Web Part. This part of the blog is something I just now built to demonstrate, so it has no design elements at all – I’m just showing an example – but you can probably get very creative for your anonymous users so that they only see what you want them to see.

  • To create the type of page I’m using, open the site in SharePoint Designer 2010, click on the Site Pages Site Object (left navigation), and in the ribbon click New > Page > ASPX. This creates a new, blank page with nothing on it.
  • Click on the page to get to the page settings, and then click Edit File.
  • In the ribbon, click Web Part Zone in the Web Parts section
  • Put your cursor inside the Web Part Zone and click Web Part > More Web Parts. Search for the InfoPath Form Web Part and select it
  • Now, you should have a blank page with an InfoPath Form Web Part inside a Web Part Zone (Fig. 20)

Figure 20 – Blank ASPX page with a single Web Part Zone containing a single InfoPath Form Web Part

  • Now, right-click on the web part and click Web Part Properties
  • This will show you the InfoPath Form Web Part properties so that you can connect it to the Customers list. Notice that I have disabled the ribbon so that the user can only utilize my custom Submit button, and I have configured the submit behavior to open a new (blank) form upon submit. What this does is insert the data to the list and then present the user with a fresh, new, blank form (Fig. 21).

Figure 21 – Configuring the InfoPath Form Web Part to utilize the Customers list form

  • Now, you just save the form and send that page’s direct URL to the anonymous user.
  • When the anonymous user clicks on the link, this is the result (below). Notice the page opens in the browse with nothing else visible – no ribbon, no master page, no border or other miscellaneous indicators (Fig. 22). You could also add other web parts – either hidden or shown – that are connected to this form for input and/or output purposes, such as a Query String Filter Web Part that could read from the URL and insert that data to the form, which could then trigger rules and/or switch views to provide a personalized experience.

Figure 22 – Opening the Customers list form as an anonymous user through a custom page

Since there is no indicator in Figure 22 for which user that is, I am providing a bonus screenshot below that shows the same technique utilized on the Home page of my Anonymous site (Fig. 23).

That’s all there is to it. This is very easy to set up and works very, very well. Unfortunately, items submitted by anonymous users can’t automatically trigger workflows, so I’m hoping that will either be changed in the future or that we’ll be able to figure out a way (without code). Even so, this gives you a great way to provide a powerful, nice-looking interface to your anonymous users so that they can submit data using a logic-filled form without the need for custom code or any heavy customization.

15 Responses to “InfoPath – Allowing Anonymous users to Submit Forms in SharePoint 2010”

  1. Rob Wilson said

    Clay – This is *similar* to what I mentioned on Twitter the other day. We are at the next hurdle that you mentioned at the end: how to send the email without code. I am convinced that there is no way to complete our anonymous InfoPath form project without code, so we’re looking to use as little code as possible and to make what code we do write as generic as possible so it can be reused easily. I’ll blog about it when we’re done. It is a shame that there is not a good end-to-end solution for power users to develop anonymous InfoPath forms. Thanks for posting.

  2. srishaila.a said

    HI,

    how to Get SharePoint InfoPath Form Search Results to Open in browser?

  3. Hey Clayton, I found the reason why I did it the way I did it in my blog series. I don’t want anonymous users seeing the list contents. If you notice, you can’t set “Add Items” without setting “View Items”, therefore everyone can see the items in the list, which in my case is undesireable.

    • Clayton Cobb said

      MIchael, that makes sense, but it wasn’t the reason stated, so now you can mention that as the point of the blog, which was a good one.

    • Clayton Cobb said

      Michael, btw, if you just set the Item Level Permissions in the Advanced Settings to “read only their own,” then anonymous users cannot see any of the items. That’s about as easy as it gets.

  4. […] are plenty of good and easy ways to allow anonymous users to fill out InfoPath forms on a SharePoint site, however these ways […]

  5. Simon said

    Hey just tested using a workflow with an impersonate step to generate an email when a new item is created and it works!

    • Clayton Cobb said

      Simon, are you sure? I have tried that several times, and it has never worked for me or for anyone I know. There is no provision for starting a workflow on a list with an anonymous user, so are you sure that’s what you did?

      • T Binder said

        Hi all

        Any news wheter Simon got it to work with impersonate ?

        I am really looking for a solution to this, before putting to much effort in developing our new web with SP, InfoPath, CRM and using BCS!

        Hope to hear god news from you guys 🙂

      • Clayton Cobb said

        T Binder, I have never heard of it working and have never seen it work. Simon never backed up nor qualified his statement, so I don’t believe it until I see it.

      • T Binder said

        Hi again

        A bit shame that workflows can´t betriggered by anonymous in the SP list.

        But any of you guys knowing if using external list in SP for example against CRM, having the information within CRM, whether CRM then can trigger its workflows?

        Meant:
        1. A Infopath form filled by anonymous on a SP external list
        2. The SP external list then sends it´s information to a CRM entity
        3. The CRM entity has a workflow build in and will then be triggerede

  6. Just came across this post of yours Clayton. Great job in the step by step explanation to this seemingly complex issue that so many people talk about. I’ll definitely be forwarding people to this post.

    Asif

Leave a comment