Disable a List Field When Adding/Editing in 2010

SharePoint 2010 now uses InfoPath 2010 forms for adding and editing list items. You can customize these forms to meet your needs which includes changing the order of the fields, removing fields and hiding fields for certain users. In this example I’ll show you how to disable a field if the user is not added to a custom security list. This allows you to control who has ability to maintain the data in a specific field.

  1. Create a new custom list called “Secure Users”
  2. Add a Person column called “User”
  3. Change the column to display the field called “User name”
  4. Go to your primary list where you want to disable the field and click “Customize Form” on the ribbon
  5. The following steps are in InfoPath 2010
  6. Add a new data source for the Secure Users custom list
  7. Add a Form Load rule to filter the Secure Users data source on the current user
    1. Add an Action Rule to “Set a field’s value”
    2. Select the User field in the list of queryFields for the Secure Users data source
    3. Set the value to the function userName()
    4. Add another rule to query the list with the new filter
  8. Add a rule to the appropriate controls you want disabled
    1. Select the field and add a new formatting rule
    2. Set condition – Select AccountID in the Secure Users dataFields
    3. Select “Number of occurrences of AccountID” in the “Select:” dropdown
    4. Select “is equal to” and enter zero as the value
    5. Select “Disable this control”
  9. Quick Publish the form and you’re done!

You’ve created a form that checks the Secure Users list for the current logged in user. If the user is not in the list the selected field will be disabled.


Access Denied With InfoPath Content Types

One of the options for publishing an InfoPath form to a MOSS Forms Server is as a Content Type. When you publish the form, InfoPath asks for a location to publish it. The Content Type is published to entire site collection. When the form template is published to a forms library, the template and the columns in the content type are added to the form library. The form will automatically update the columns that correspond to the content type. The benefit of using a content type is that you can assign multiple form templates to the same form library.

The problem that we ran across was the location selected for publishing the content type. Even though the content type is published to the entire site collection and can be used anywhere in the site, the users appeared to need Contributor rights to the original published location of the content type. So if you published the content type to the a http://site/subsite then the user would need contributor rights to that sub-site or they would get an “Access Denied” when the form was submitted.

The key is to publish the Content Type to the exact location where you’re going to use it and make sure your users have contributor rights. For us it was a forms library.

Fix “Edit this task” In Outlook 2007

If you’ve used some of the out of box workflows in MOSS you’ve probably seen the email sent to approvers. The workflow creates a task, assigns it to the user and sends an email notification. When viewing the email in Outlook 2007 there is a button on the toolbar for editing the task. Viewing the email in any other email program will display the “Edit this task” as a link in the body of the email.

The problem is that the “Edit this task” button in Outlook 2007 doesn’t work some of the time. Clicking the button does nothing. This is apparently related to Outlook 2007 using InfoPath to display the approve/reject form. This form contains a CLSID of {00000000-0000-0000-0000-000000000000}. This CLSID is apparently “kill bitted” on some systems and is prevented from being displayed.

What’s the fix? Delete the registry key for that CLSID.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\{00000000-0000-0000-0000-000000000000}

Login Required on Anonymous Site

If you have a public web site you might have the ViewFormPagesLockDown feature turned on. This restricts access for anonymous users so they can’t access the pages in your libraries “Forms” folders. There’s a good description of the feature here http://technet.microsoft.com/en-us/library/cc263468.aspx.

If you’re accessing a libraries “Forms” pages, for example by using InfoPath Forms Services, you might need anonymous users to have access to the library.

With the following configuration the user could be prompted for credentials on an anonymous site when trying to access an InfoPath Forms Services form.

  • Browser-based InfoPath Form published to a Forms Library
  • Site has anonymous access set to “Entire Web Site”
  • ViewFormPagesLockDown feature is activated


You can fix this by deactivating the ViewFormPagesLockDown feature
stsadm -o deactivatefeature -url “<site URL>” -filename ViewFormPagesLockDown\feature.xml


Now toggle the anonymous access setting on the site from “Entire Web Site” to “None” and back to “Entire Web Site”.


Then activate the ViewFormPagesLockDown feature again

stsadm -o activatefeature -url “<site URL>” -filename ViewFormPagesLockDown\feature.xml


InfoPath Links

Using the Contact Selector Control in InfoPath

How To: Add SharePoint Workflow Support to an InfoPath Form
Displaying SharePoint List Value in InfoPath field

Pulling CRM Data into InfoPath 2007 Browser Forms

Returning Data to InfoPath using a Web Service

Hosting the InfoPath 2007 Form Editing Environment in a Custom Web Form