Add a my link into specifically group of my link(代码增加一个“个人链接”到一个特定的组)

       /// <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;
        }

你可能感兴趣的:(group)