how i can set the “Allow this site to appear in search results?” for a site to be equal to No inside my event receiver

sharepoint.stackexchange https://sharepoint.stackexchange.com/questions/225720

Question

I am working on an item updated event receiver, and i want to set the "Allow this site to appear in search results?" for a site to No. now using the UI i can set it as follow:-

enter image description here

but i am note sure how i can do so using c# inside my event receiver?

Was it helpful?

Solution

You need to set the NoCrawl property of SPWeb to true.

The code would be as below:

web.NoCrawl=true;
web.Update();

Reference - SPWeb.NoCrawl

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top