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

I'm using SPMetal to generate a class for my lists to use in a Sandbox-solution (with Sandbox Visual WebParts).

However, when I generate the classes for a list column of type "Person or Group" with display value "Name with Picture", I only get the string for that person's name back (SPMetal only generates a string property for this field).

[Microsoft.SharePoint.Linq.ColumnAttribute(Name = "Person", Storage = "_personNameWithPicture", ReadOnly = true, FieldType = "User", IsLookupValue = true)]
public string PersonNameWithPicture
        return this._personNameWithPicture;
        if ((value != this._personNameWithPicture))
            this.OnPropertyChanging("PersonNameWithPicture", this._personNameWithPicture);
            this._personNameWithPicture = value;

Is there any way to get both the person's name and the profile picture, like it does in the default list view?


share|improve this question

i'm afraid you can't get the profile picture directly.

linq to sharepoint can retrieve only id or displayname from a User field (lookup field) by set the ColumnAttribute IsLookupValue = true or IsLookupId = true

so you can get a spuser object by the userid first, then get the profile picture.

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.