Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

In WSS 3.0, there's an option under "Advanced Settings" for a List as follows:

Search

Specify whether this list should be visible in search results. Users who do not have permission to see these items will not see them in search results, no matter what this setting is.

Every option on the advanced settings has an SPList property that corresponds to it (EnableAttachments, WriteSecurity, AllowContentTypes...) except for this property. And this property happens to be the one I want to enable on deployment. The SDK has proven unusually fruitless in trying to figure this out.

Is it possible to enable this "do not show items in this list on search" property programmatically, and if so, how?

share|improve this question

2 Answers 2

up vote 4 down vote accepted
SPList list = ...    
list.NoCrawl = true;    
list.Update();

See http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.nocrawl.aspx

share|improve this answer
    
So simple, and yet so easy to overlook because all of the documentation seems to go all the way to avoiding the word "Search" on a setting that, in the UI, only says "Search". –  Grace Note May 23 '11 at 17:00

Not sure about Programatically but you can set this in the Site using the Library Settings/Advanced Settings and set the Search "allow items in the document library to appear in search results" to be no.

Do you have that many sites that you can't set this in the Site Collection root?

share|improve this answer
    
Quite, it's also across multiple site collections and new collections that will be deployed in the future. It's something I'd really like to enable as part of the automated portion of the deployment. –  Grace Note May 19 '11 at 18:06
    
So if you do not want to have any pages crawled, why not just uninstall the Search Service Instance? Are you trying to assure at the Site level some pages will never get crawled but some may at a future date? –  MichaelF May 19 '11 at 19:31
    
I want to stop 1 specific list that's deployed on each site. It's a single list that's used purely as a lookup table. The rest of the stuff we do need to be searched, I just don't want all of the lookup table stuff showing up amidst the results (which they do, currently, should I not disable it). –  Grace Note May 19 '11 at 20:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.