SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In IAlertNotifyHandler implementation I need name of the user who created/add the current item/document to the list (for which this alert is being sent). What is the way to do this?

share|improve this question
up vote 3 down vote accepted

When you create your OnNotification method you can access the list item with code similar to this.

public bool OnNotification(SPAlertHandlerParams ahp)


      SPSite site = new SPSite(ahp.siteUrl+ahp.webUrl);

      SPWeb web = site.OpenWeb();

      SPList list=web.Lists[ahp.a.ListID];

      SPListItem item = list.GetItemById(ahp.eventData[0].itemId);

      String user = item("Author");


Not sure on your requirements but you may need to add some additional code to then get a domain\username if this is what you require.

Note: This is sub-optimal code to highlight only the code needed to get the list item. I know there are dispose issues here.

share|improve this answer
@Charles I'm usint SPFieldUserValue oUser = item["Created By"] as SPFieldUserValue;. Will this pose a problem? – TheVillageIdiot Apr 1 '10 at 21:47
Not if it works no. Are you getting an appropriate value back? – Charles Lee Apr 2 '10 at 8:46
Remember to dispose SPSite/SPWeb you create yourself – Anders Rask Apr 3 '10 at 17:17
I did mention that in my last note, but I suppose its worth another mention in the comments. – Charles Lee Apr 3 '10 at 19:05
Definitely @Anders and @Charles i'm opening site and web using using constructs – TheVillageIdiot Apr 4 '10 at 18:28

No Need for Code or anything, Add the Fields Created By and Modified By and you see all.

share|improve this answer
He needs the info in C#, not in the GUI – Robert Lindgren May 27 '14 at 8:16

Your Answer


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.