BruceLee
DocumentDiscussion

导航

 

       /// <summary>
       /// Author:(Bruce Lee)
       /// Created Time:2008-9-10
       /// Description:manager my link.
       /// Mender:
       /// Modify Time:
       /// Modify Description:
       /// </summary>
       /// <param name="strAccount">personal account,for example:"brucelee\\Administrator",(个人账号,例如:"satyambrucelee\\Administrator")</param>
       /// <param name="strPersonalSiteHostURL">personal site host url,for example:"http://brucelee:8086",(个人站点的宿主URL,例如:"http://brucelee:8086")</param>
       /// <param name="strLinkTitle">link title,for example:"21CN",(个人链接标题,例如:"21CN")</</param>
       /// <param name="strLinkURL">link url,for example:"http://www.21cn.com",(个人链接URL,例如:"http://www.21cn.com")</</param>
       /// <param name="strlinkGroup">link group,for example:"Insternet",(个人的组,例如:"互联网")</</param>
       /// <returns></returns>

        public bool ManagerMyLink(string strAccount, string strPersonalSiteHostURL, string strLinkTitle, string strLinkURL, string strlinkGroup)
        {
            bool boolReturn = false;
            SPSite spPersonalSite = null;
            try
            {
                spPersonalSite = new SPSite(strPersonalSiteHostURL);
                ServerContext serverContext = ServerContext.GetContext(spPersonalSite);
                UserProfileManager userProfileManager = new UserProfileManager(serverContext);
                UserProfile userProfile = userProfileManager.GetUserProfile(strAccount);
                QuickLinkManager quickLinkManager = userProfile.QuickLinks;
                quickLinkManager.Create(strLinkTitle, strLinkURL, QuickLinkGroupType.UserSpecified, strlinkGroup, Privacy.Public);
                boolReturn = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                spPersonalSite.Dispose();
            }
            return boolReturn;
        }

posted on 2008-09-16 20:49  Bruce Lee  阅读(358)  评论(1编辑  收藏  举报