Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Due to the project requirement, we want to trace the user profile property changes (made through mysite) whenever they do.

Is it a good idea to insert a javascript (through a delegation control) and capture the page "beforeUnload" event. The "beforeUnload" function will call a "generic handler" with a current user login id and in which we can actually trace the profile changes using the class "UserProfileChangeQuery".

or is there an event to override like itemupdating?

or what would be the simplest method?

also does the class "UserProfileChangeQuery" return a updated information or the old data?

share|improve this question

2 Answers 2

up vote 9 down vote accepted
+50

Gary Lapointe and Mathew McDermott recently published an article on this topic in SharePointPro magazine. It is available online here:

http://www.sharepointpromag.com/article/sharepoint/monitor-sharepoint-user-profile-changes-129846

Synopsis of the article:

First you enable logging via the STSADM tool (no PS available for this)

stsadm -o profilechangelog -userprofileapplication "My User Profile Service App" -daysofhistory 28

You gain access to the objects in Microsoft.Office.Server.UserProfiles namespace (which you are already aware of).

The UserProfileManager class contains the GetChanges method.

This method has three overloads:

  • GetChanges(), which retrieves all changes
  • GetChanges(UserProfileChangeToken), which retrieves all changes from a given date or event
  • GetChanges(ProfileBaseChangeQuery), which retrieves specific changes given a query object

All the GetChanges overloads return a UserProfileChangeCollection object. This object contains all the changes stored as either a UserProfileChange object or one of its derivative types:

  • UserProfileColleagueChange
  • UserProfileCustomChange
  • UserProfileLinkItemChange
  • UserProfileMembershipChange
  • UserProfileOrganizationMembershipChange
  • UserProfilePropertyValueChange
  • UserProfileWebLogChange
share|improve this answer
    
a very good answer! Good find! –  Anders Rask Sep 24 '11 at 9:56
    
Thank you for your answer, my intention is to trace the profile changes before the page is getting redirected to the "person.aspx". I have to update a certain user profile property if user has updated a certain list of properties before the "editprofile.aspx" page is getting redirected. is there a way to achieve it? –  Karthikeyan Sep 25 '11 at 15:48
    
once again, thank you for the answer...the below url can also give you additional info in regards to this..directsharepoint.com/2011/05/monitor-user-profile-changes.html –  Karthikeyan Sep 27 '11 at 8:30

Sharepoint 2010 has the ability to log just about everything ranging from your dog barking to the server has crashed.

Not all of it as activated by default though.

Have a look at Monitoring > Configure diagnostic logging in your Central Admin.

Under SharePoint Portal Server there are a couple which you need to tick:

SPS People User Profiles Personal Sites

At the bottom of the page, you can specify where you want to log everything: Sharepoint Trace Log, or Windows App Logs. Id go for Trace Logs.

Take note of the other settings which will WIPE the old logs at a certain stage.

Next, up, you'd have to get something like ULSViewer to monitor it.

Hope this help.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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