Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
{
    get
    {
        return this._personNameWithPicture;
    }
    set
    {
        if ((value != this._personNameWithPicture))
        {
            this.OnPropertyChanging("PersonNameWithPicture", this._personNameWithPicture);
            this._personNameWithPicture = value;
            this.OnPropertyChanged("PersonNameWithPicture");
        }
    }
}

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

Thanks

share|improve this question

1 Answer 1

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

 
discard

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.