Was-a-golfer
Was-a-golfer

Reputation: 11

Sharepoint List Item Alerts to Item creator

I'm trying to set up alerts to go to the item creator whenever the item is edited. Can anyone point me in the right direction.

Upvotes: 1

Views: 3671

Answers (2)

Rich Bennema
Rich Bennema

Reputation: 10335

Create an Event Receiver that handles ItemAdded. Use the following code to get the author of the item:

SPWeb web = properties.Web;
SPListItem item = properties.ListItem;
SPFieldUserValue userValue = 
    new SPFieldUserValue(web, item[SPBuiltInFieldId.Author].ToString());
SPUser user = userValue.User;

You can then add a new SPAlert to the user for the current item.

Upvotes: 0

Related Questions