1

I have a user profile property called "PWResetMSG" The contents of that property display the following:

Password will Expire in x days

Where x is the number of days that remain until the user must reset his or her AD password. All I want to do is expose this property so that I can display it to the end user on a SharePoint Site. The property is updated every morning.

Is there an easy way for me to expose the custom property to the end user?

1 Answer 1

2

You can configure the property to show in their profile if you want to show it there.

Another option would be to load it into a user control added to the masterpage or a web part to display it on selected pages. You can then configure it to display the message you want to show.

Accessing the data is done through the UserProfileManager and UserProfile objects

SPServiceContext svcContext = SPServiceContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(svcContext);
UserProfile profile = profileManager.GetUserProfile(accountname);
string resetDays = profile["PWResetMSG"].Value;
3
  • Hi Mike-Thank you for your prompt answer! I am interested in getting it into a webpart if possible. The biggest challenge is that I am a SQL programmer and have no experience with SharePoint other than writing the SQL code that creates the custom properties.
    – kmdavisjr
    Jul 11, 2012 at 18:42
  • 3
    You should not be creating, reading, or writing to the user profile database directly. You must use the SharePoint web interface, powershell, or the API to interact with the system. Direct updates are not allowed/supported. To update your value you should be using the ProfileSync through a BDC connection or update it using custom code. Jul 11, 2012 at 20:56
  • Hi Mike-Thanks. I am using the shared services provider and a property generator supplied by the SharePoint Application vendor. I write a sql query, the app finds it and then generates the property based on a SQL view. I have now run into another issue. My SharePoint user profile property was originally a message to the user as noted above. The share point property was PWResetMsg and I selected users based on records containing the word 'Expire' in the property. Now PWRsetMsg no longer contains ANY data even after I delete and recreate the property and recompile the audience. Frustrating
    – kmdavisjr
    Jul 12, 2012 at 3:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.