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

Вопрос

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?

Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top