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

Hi I am trying to access the created by coloumn in item added event reciever.But when i debug it shows null value...below is the code

public override void ItemAdded(SPItemEventProperties properties)
   var CreatedBy = (string)properties.AfterProperties["Author"];
   // ....
share|improve this question
up vote 5 down vote accepted

Try using ListItem instead of AfterProperties

var CreatedBy = (string)properties.ListItem["Author"];

I believe the AfterProperties are for the synchronous events (end in ING - e.g. Adding, Deleting, etc.)

Furthermore you can get an SPUser object from this. Refer to the following site for details on how that might be done. Once you have an SPUser object you have access to all sorts of useful properties such as Name, Email, and more.

share|improve this answer
I i am getting the CreatedBy value as 9;#domain/username ..i am little confuse as to from where the value 9;# is coming from? – spStacker Jan 24 '12 at 22:34
A user field like that is essentially a lookup to the users list within the SharePoint Site Collection. 9 is the id of the user in the list, the ;# is a separator (and is the syntax used for all lookup fields) and domain\username is the value of the lookup. – SpartanDonut Jan 24 '12 at 22:38
hi, tyler it is the look up field..thanks! – spStacker Jan 24 '12 at 22:41
@spStacker you can parse lookup field by using following code fragments: var id = new SPFieldLookupValue(fieldValue).LookupId and var value = new SPFieldLookupValue(fieldValue).LookupValue – Andrey Markeev Jan 24 '12 at 22:42
No Problem! I updated my answer with a link on how you can get an SPUser object from that value as well. – SpartanDonut Jan 24 '12 at 22:42

are you trying to access the value in the specific field? if so, try something like this:

using (SPWeb web = SPContext.Current.Web)
                SPList list = web.Lists["yourListHere"];
                SPListItemCollection items = list.GetItems();
share|improve this answer

The better way is use the property UserLoginName, that returns the user login which fires the event, example below:

SPUser authorUser = web.EnsureUser(properties.UserLoginName);

//properties is the SPItemEventProperties properties
//SPWeb is properties.OpenWeb();
share|improve this answer

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.