문제

사용자는 사용자가 개인보기에서 페이지에 웹 파트를 제거, 추가 또는 재정렬 할 수있게하는 사용자 정의 코드를 제공합니다.템플릿을 사용하여 모듈에 의해 생성 된 게시 웹 파트 페이지입니다.

어떻게이 페이지를 업데이트 할 수 있습니까? 웹 파트를 제거 하시겠습니까?(분명히 IgnoreIfalReadyExists= True Web Parts가 페이지에 추가됩니다.) 우리는 지금까지 페이지를 삭제하고 다시 만들었습니다.이것은 사용자가 수행 한 웹 파트 개인화를 파괴하며, 이제는 생산 중에 더 이상 허용되지 않습니다.

페이지를 삭제하고 다시 만들고 다시 만들면 사용자의 개인보기를 백업하고 복원하는 방법이 있습니까?

도움이 되었습니까?

해결책

In simple terms doing something like (important here is of course PersonalizationScope.User):

        SPLimitedWebPartManager webPartManager = SPContext.Current.Web.GetLimitedWebPartManager(this.Request.Url.ToString(), PersonalizationScope.User);
        int wpCounter = webPartManager.WebParts.Count; //get counter
        /*either start looping or for a single web part use*/        
WebPart webPart = webPartManager.WebParts[wpId];
         /*do something with the web part*/

But this has 1 important limitation - it only works for Web parts placed in Web part zone. In addition there is a method (actually part of the ASP.NET Web part infrastructure) called SavePersonalizationState via the Personalization property on each Web part, see more here (http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.personalizationprovider.savepersonalizationstate(v=vs.90).aspx). I haven't really been in a situation to try myself!

The biggest challenge would be maybe to collect personalization data for all users. Maybe the fact that it uses the Provider pattern could help, by using the FindState method (http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.personalizationprovider.findstate(v=vs.90).aspx) to extract all data.

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