3

Created By Field Returns the following:

1073741823;#System Account

I want the following without string manipulation (i.e. without using substring to remove all of the characters before ";#"):

System Account

How can I do the above programmatically in a visual webpart?

string Author = item["Created By"].ToString(); 

The above is what I am currently using to get the author, but I want the login name to be the author

Any ideas on how I can achieve this?

I am fairly new to SharePoint and could really use the assistance.

1 Answer 1

7

Try:

SPFieldUserValue userValue = new SPFieldUserValue(web, item["Created By"].ToString());
string Author = userValue.LookupValue;
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.