Discussing the nuts and bolts of software development

Friday, September 12, 2008


Bridge SharePoint - User Profiles and User Profile Properties (part 2 of 2)

As we have found out in part 1, SharePoint can manipulate data using the user profile management objects and can accept data from external sources. Using these two features apart we have two limited tools with limited usage, but using them together gives us a powerful, flexible and efficient method of storing and using data from any internal or external resource.

It’s time to see this solution to our problems in action.

Code example of getting/setting the profile property from a C# application

The concept is the same for any source of information (web services, web applications, etc.):
Get the user’s profile->Get the required profile property->Get/Set profile property value

Code example: (note that to access profile properties, this code must run with elevated privileges)

string value;

// Change the site address for different deployment environments
// Note: WIN2003STD is a place holder for your environment, usually your server name
SPSite site = new SPSite("http://WIN2003STD/");
SPWeb web = site.OpenWeb();

// Get the profile manager object for the site
UserProfileManager profileManager = new UserProfileManager(ServerContext.GetContext(site));

// Use the username from the User Information Item to get the full profile of an user
UserProfile user_profile = profileManager.GetUserProfile(System.Web.HttpContext.Current.User.Identity.Name);

// Get the required profile property value from the profile
value = user_profile["MyProperty"].Value.ToString();

catch (Exception e)
return "Error getting user info: " + e.Message.ToString();

user_profile["MyProperty"].Value gets or sets the profile property value.

This is a very convenient way of using profile properties to store required information for each user. Properties can be set as read-only or not to appear in the user’s profile, which gives you even more control.

System.Web.HttpContext.Current.User.Identity.Name returns the username (the login username) and it is used in the code example above to get the profile of the currently logged-in user.

Tools You Never Knew You Had… (and what to do with them now that you’ve wised up!)

With this simple solution to getting/setting a user’s profile property value, endless opportunities are now at hand. This small code snippet helps developers control, validate and use values stored for each user, without corrupting the database or resorting to other more complex and error-prone solutions.
For those not needing to use an external application to get information from the users, a custom SharePoint web application can be developed and deployed on SharePoint. This way all the controls offered by ASP .NET or custom controls can be used to perform required operations on the data before it’s stored.

External applications running on the server can access this information the same way, so a bridge between SharePoint and applications like web sites, game servers, messaging apps, etc. can be easily created.

SharePoint Complications, As Usual

Watch out that the profile property might be set as read-only in SharePoint. Even if it’s the case however, the above code should still be able to access the profile because it’s running with elevated privileges. So if there is a situation in which the user is allowed to see the data but only modify it by using a service (like a web application or web service), this is a good way of doing it.

Another gotcha is that the code above can only be used on the SharePoint server machine. This is due to the framework that SharePoint uses. To get information or to change data from a network on internet location, a SharePoint custom web service or web application can come in handy. Other ways of passing information will work too, like server-client applications, as long as the part running the above code is on the SharePoint server machine.

So we now have a way to store data and manipulate it according to our needs. We can control it, we can validate it and most important of all, we decide how the user interacts with the data.

We’re now ready to start doing some serious SharePoint development!

Labels: , , , , ,

By the way, this information will be useful for college students. It will help you to learn more about PhD
We are here to provide top quality assignment help service. You can always get connected to us and we will make sure that you are able to complete your assignment in the most promising manner. The best part is you will be getting quality approved assignments at very reasonable pricing. Get connected to us now and avail the best of grades without any kind of hassle at all! Yes, you can reach out to our Economics assignment help writing experts anytime and get connected as per your convenience. They will respond back to your right away and make sure that all your queries and doubts are resolved.
This comment has been removed by the author.

Wow, awesome blog layout! How long have you been blogging for?
you made blogging look easy. The overall look of your
site is magnificent, let alone the content!

my web page :: 안마

Put more information on your website like this one, I really like these types of blogs.I am also wanted to write blog kindly guide me if my topic is seismic sensor manufacturers then what should I do first and how will I create new and unique content on this topic
If you want to Buy Economics Essay online that is a great fusion of information that can be a reference document for your upcoming projects as well
The top rated canadian essay writing service is engaged with these activity to sort out the changes to be done

This is it guys! If some of you really need help with essay adn you dont want to waste your money adn time you can use this beautiful letter of recommendation writer service for essayadn homewrok! This guys really know how to do it so check this essay writer and be the best! Good luck!
Wish you all the best for your upcoming comments. I am also wanted to write a blog kindly guide me if my topic is control cable manufacturers then what should I do first and how will I create new and unique content on this topic
I`d also be grateful if you advise something to improve my writing skills, as recently I needed to write my essay I want to contact the nursing discussion post services
스포츠토토 Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely helpful for me


I was very hapρy to discover thiѕ site. I need tօ
to tһank you for oneѕ time jᥙst foг this fantastic гead!!
I definiteⅼy loved eѵery рart оf it and i also
hɑve you book marked tօ look ɑt new stuff on ʏour site.


his article is very effective and valuable. I am very glad to read your blog. I hope you will soon share your next post about this discussion. Thanks for sharing and keep sharing

This is a great opportunity for you too as you get to check out the best of the best!


Such well detailed and informative are helpful and extremely beneficial to the individuals worldwide. They can get immense help, tips and guidance from the informative articles and threads. The Best Assignment Help UK also provided over the web and through online sites and virtual platforms is reliable and extremely authentic.
All these articles and blogs are very well written and detailed. The content delivery style of the writers and other content creators is extremely good and they do an incredible job with that. The writers working for the platforms like Voot in Australia also are extremely talented and have great content delivery style and delivers the content which is unique and competitive.
I really enjoyed reading your blog post on Bridge SharePoint - User Profiles and User Profile Properties (part 2 of 2). I found the information to be very helpful and informative. I am currently working on an assignment for my class on SharePoint, and I am struggling with the user profile portion. I was wondering if you could recommend a service where I can pay someone to write my assignment for me? I have tried using a few different services, but I have not been happy with the quality of the work. I am looking for a service that can provide me with high-quality work that is plagiarism-free.

SharePoint consulting involves seeking professional guidance and expertise to leverage the capabilities of SharePoint in your organization. SharePoint consultants are experienced professionals who understand the platform's intricacies and help businesses make the most of its features. They work closely with clients to assess their needs, plan the implementation, and provide ongoing support and maintenance

Informative articles and blogs are liked by everyone. The content which deliver information and knowledge regarding fashion and other trendy slippers are liked by everyone. Women, from all over the world consider buying stylish yet comfortable slippers from brands to look good.
Wow, you give the best information about users' profiles and user profile properties thanks for posting this and keep it up this is very helpful for me.
The advise in this particular post is quite useful! The biggest changes are brought about by the smallest adjustments. I appreciate you sharing! I invite you to visit my website.
mejores abogados de divorcio en nueva jersey
"Bridging SharePoint User Profiles and User Profile Properties" is a strategy for optimizing user profiles and their properties within the SharePoint platform. This resource is crucial for organizations to maximize SharePoint's potential for collaboration, information management, and user engagement. By synchronizing user profiles and properties, businesses can streamline workflows, improve user experiences, and boost productivity. However, assessing specific insights and strategies is challenging without more details. Hudson County reckless driving attorney
Bridge SharePoint effectively links user profiles and user profile properties. This integration streamlines the management of user data, enhancing the user experience and administrative efficiency within the SharePoint platform. uncontested divorce lawyer virginia beach
var userProfile = GetUserProfile(); // Replace with actual method
var profileValue = userProfile.GetProperty("propertyName");
Setting profile property
userProfile.SetProperty("propertyName", "newValue");

Ensure you're using Whizlabs certification to enhance your C# skills! Whizlabs certificationprovides a solid foundation for mastering C# and staying updated.
The exploration of bridging SharePoint User Profiles and User Profile Properties is a comprehensive and insightful guide. The review highlights the clarity and depth with which the author navigates the intricacies of connecting these essential elements in SharePoint. Practical tips and step-by-step instructions make the process accessible for users at varying levels of expertise. The content offers valuable solutions for optimizing user management within the SharePoint environment, making it an indispensable resource for administrators and developers. Overall, this review emphasizes the effectiveness of the guide in streamlining the integration of User Profiles and User Profile Properties in SharePoint. dui lawyer emporia va
That was really a great Article ethical hacking certification trainingThanks for sharing information. COntinue doing this.
Part 2 brings clarity on bridging SharePoint with user profiles and properties. The code example provides insight into retrieving and setting profile property values, unlocking endless opportunities for developers. Ready for SharePoint development!
Nueva Jersey Orden Protección Riesgos Extremos
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?