Pergunta

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?

Foi útil?

Solução

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

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top