A SharePoint Library event handler to automatically link a picture to a MOSS 2007 User Profile.
The file names must be of the following format: [accountName].[ext]
- The event handler extracts the account name from the new file
- The Profile Picture URL property of the corresponding User Profile is updated
- In case of an error an entry will be written to the machine's event log
- The event handler does not allow a file to be renamed
- The event handler resets the Profile Picture URL property of the correspondingg User Profile
- In case of an error no additional actions are undertaken (just the file deletion)
This event handler uses User Profiles and thus requires MOSS 2007.
Visual Studio 2005 Project + compiled assembly
Register this event handler for a SharePoint Library (Document Library, Picture Library, ...) or Content type using the SharePoint Object Model, my EventHandlerManager or any other tool.
Feel free to modify and improve this project.
The original version of this Event Handler included additional checks in the ItemAdding event returning an informational message to the user. However my experience of synchronous event handling (and UI messages) in combination with a Picture Library haven't been very good: WSS 3.0 Event Handler- pre-event cancelling issues, so I have omitted that functionality.