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

Frage

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?

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit sharepoint.stackexchange
scroll top