But accessing my site programmatically is not an easy task.
There is always a big question that “How to access my site personalize data programmatically?”
Here is the solution.
First you have to import
Microsoft.Office.Server.dll
We are not using it normally. (At least not me)
Then you have to set
ServerContext context = = ServerContext.Current;
UserProfileManager profilmanager = new UserProfileManager(context);
UserProfile profile = profilmanager.GetUserProfile(SPContext.Current.Web.CurrentUser.LoginName);
This is the way you can find profile of current user.
After getting profile you can use personalize data.
My links
QuickLinkManager qlmanager = new QuickLinkManager(profile);
QuickLink[] ql = qlmanager.GetItems();
Or
profile.QuickLinks.get ;
My Colleague
ColleagueManager colmanager = new ColleagueManager(profile);
Colleague[] cl = colmanager.GetItems();
Or profile.Colleagues.GetItems();
My Membership
MembershipManager memmanager = new MembershipManager(profile);
Membership[] memship = memmanager.GetItems();
Or
profile.Memberships.GetItems();
It works for me.
Try it out.
3 comments:
Hi Parth,
Great work man,it works for me.
-Jayesh
how can i access detail link information like phone number, picture and all other details.
Thanks in advance
can you please help me out, how to get detail information of personal site. like picture, phone number and other details
Thanks in advance
Post a Comment