Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

UserProfileManager

  Asked By: Tracey    Date: Jan 11    Category: Sharepoint    Views: 1649

I'm trying to simply connect to a users profile and list there links.
I'm hoping I can figure out the details after which that I need. What
my problem is - is I can't even find a way to get the quicklink values
at all!

Here's the code I've got working so far:

SPSite site = new SPSite("http://intranet");
SPWeb web = SPControl.GetContextWeb(this.Context);
web.AllowUnsafeUpdates = true;
ServerContext context = ServerContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(context);

//Getting the current user
UserProfile u = profileManager.GetUserProfile(true);

//Displaying Users Profile Properties
writer.Write(u[PropertyConstants.FirstName].Value);

//Getting Lost here..
writer.Write(u[PropertyConstants.QuickLinks].Value + "<BR>");
QuickLinkManager qlm = u.QuickLinks;

//Adding a link to the profile
qlm.Create("Test", "http://www.test.com", QuickLinkGroupType.General,
null, Privacy.Private);



So I'm able to connect to the user profile and list out whatever
property I'd like, except for the quicklinks.. If someone knows of a
good reference for this? I'm even able to add to the links, but not
list them. I know by looks at msdn it states that the code is
obsolete, but it works - and when I try and use what they mention in
VS it says those are obsolete..

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Lynette Sawyer     Answered On: Jan 11

Of course, once I asked I finally was able to figure  it out myself,
here's code if anyone's interested:

QuickLinkManager qlm = u.QuickLinks;

foreach (QuickLink userlinks in qlm.GetItems())
{
writer.Write("<a href='"+userlinks.Url+"'>" + userlinks.Title +
"</a><BR>");
}

 
Answer #2    Answered By: Shelton Dickson     Answered On: Jan 11
 
Didn't find what you were looking for? Find more on UserProfileManager Or get search suggestion and latest updates.

Related Topics:




 

Related Post