Exclude list from crawl, disable attachments, disable folder creation – SharePoint 2010

fix

Monday, January 18th, 2010

In my last article you’ve seen how to set item level permissions on a list items for both read and write access. In this article I wanted to dive into 2 few more functions that you see on Advanced Settings page of the list, those are: disabling list item attachments, Specify whether the “New Folder” command is available, Specify whether this list should be visible in search results.

The last option that allows you to exclude list from search results is particularly great. Not that this option will overwrite permissions to the list; in other words users that have no access to the list won’t see it anyway. It’s still nice to be able to exclude list from crawl even if users have read only access to improve the cleniness of search results.

As yesterday, I will get a hold of the list using the explicit specification – so that you can run it in a console application project:

SPSite site = new SPSite(“http://localhost”);
SPList userList = site.OpenWeb().Lists["MyList"];

// Specify whether this list should be visible in search results
userList.NoCrawl = true;

// disabling list item attachments
userList.EnableAttachments = false;

// Specify whether the “New Folder” command is available
userList.EnableFolderCreation = false;
site.Dispose();

Hopefully this was clear. You will probably end up running this in a feature receiver or in some sort of a portal configuration script or application.

Enjoy!

news

Any information posted on this blog does not reflect views of respective product vendors unless explicitely stated.

featured