获取MOSS个人站点的SPWeb对象

public SPWeb GetPersonalWeb(string strAccount)
        {
            string strUrl = "http://site:9000/";
            SPSite spSite = new SPSite(strUrl);
            ServerContext serverContext = ServerContext.GetContext(spSite);
            UserProfileManager userProfileManager = new UserProfileManager(serverContext);
            UserProfile userProfile = userProfileManager.GetUserProfile(strAccount);

            SPSite mySite = userProfile.PersonalSite;
            return mySite.OpenWeb();
        }
posted @ 2011-05-05 21:53  China2008  阅读(202)  评论(0编辑  收藏  举报