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

Domanda

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?

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top