문제

새 사이트가 프로비저닝 될 때 최소한의 다운로드 전략 기능을 자동으로 비활성화하기 위해 실행되어야하는 다음 코드가 있습니다.불행히도 아무 일도 일어나지 않습니다.오류가 로그에 캡처되지 않으며 예외 파일에 아무 것도 출력되지 않습니다.

    public override void WebProvisioned(SPWebEventProperties properties)
    {
        //base.WebProvisioned(properties);
        using(SPWeb web = properties.Web)
        {
            try
            {
                Guid mdsGuid = new Guid("87294c72-f260-42f3-a41b-981a2ffce37a");
                // also tried with SPFeature
                SPFeatureCollection mdsFeature = web.Features;

                if (mdsFeature[mdsGuid] != null)
                {
                    // tried this with .Remove(mdsGuid, false) as well
                    web.Features.Remove(mdsGuid);
                    web.Update();
                }

            }
            catch(Exception ex)
            {
                using (System.IO.StreamWriter file = new System.IO.StreamWriter("s:\\exceptions\\fail-" + DateTime.Today + ".txt", false))
                {
                    file.WriteLine(ex);
                    file.Close();
                }
            }
        }
    }
.

실행되지 않는 아이디어는 무엇입니까?

도움이 되었습니까?

해결책

코드를 사용해 보았습니다. 제공된 GUID와 함께 해당 기능을 찾을 수 없습니다.그래서 나는이 속성을 설정하고 작동했습니다 :

web.EnableMinimalDownload = false;
web.Update()
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top