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