现在的位置: 首页 > 综合 > 正文

获取MOSS个人站点的SPWeb对象

2012年08月07日 ⁄ 综合 ⁄ 共 441字 ⁄ 字号 评论关闭
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();
        }

抱歉!评论已关闭.