1

I'm doing an SPQuery on the 'Modified By' (Editor) column of a SPList.

While my SharePoint list displays names like #Doe, John, my query result for this column is 1;#Doe John. Where does the 1; come from ?

0

It is the default SharePoint behavior.

When you get any user value field from the list, it will return always in this format: 1;#Doe John

where ;# is the delimiter to separate the username which is Doe John and 1 is the ID of the username for that site.

Look at the below code for example:

SPFieldUserValue userValue = new SPFieldUserValue(web, item["Editor"].ToString());
SPUser author = userValue.User;

Above code gets the whole value (1:#Doe John) in SPFieldUserValue object and parse the value to get other details of the user like login name, email etc..

Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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