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 searching for a way to have a task list view where AssignedTo column contains user profile image just as i can in User Info List.

By looking at hows its done in User Info List, i see a PictureDisp calculated column with custom DisplayPattern that renders the image. This is schema for the field:

<?xml version="1.0" encoding="utf-16"?>
<Field ID="{cd01f312-731b-4711-97f8-a18c37b1eeb5}" Type="Computed" ReadOnly="TRUE" Name="PictureDisp" DisplayName="Attēls" Sortable="FALSE" Filterable="FALSE" EnableLookup="FALSE" Hidden="TRUE" AuthoringInfo="(attēls)" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="PictureDisp">
  <FieldRefs>
    <FieldRef Name="Title" />
    <FieldRef Name="Picture" />
  </FieldRefs>
  <DisplayPattern>
    <HTML><![CDATA[<a ONCLICK="GoToLink(this);return false;" href="]]></HTML>
    <URL />
    <HTML><![CDATA[">]]></HTML>
    <HTML><![CDATA[<IMG width="62" height="62" border="0" SRC="]]></HTML>
    <Switch>
      <Expr>
        <Column Name="Picture" />
      </Expr>
      <Case Value="">
        <HTML><![CDATA[/_layouts/images/person.gif" ALT="]]></HTML>
        <HTML HTMLEncode="TRUE">Attēla vietturis:</HTML>
        <HTML><![CDATA[ ]]></HTML>
        <Column Name="Title" HTMLEncode="TRUE" />
        <HTML><![CDATA[ " > ]]></HTML>
      </Case>
      <Default>
        <Column Name="Picture" HTMLEncode="TRUE" />
        <HTML><![CDATA[" ALT="]]></HTML>
        <HTML HTMLEncode="TRUE">Attēls:</HTML>
        <HTML><![CDATA[ ]]></HTML>
        <Column Name="Title" HTMLEncode="TRUE" />
        <HTML><![CDATA[">]]></HTML>
      </Default>
    </Switch>
    <HTML><![CDATA[</a>]]></HTML>
  </DisplayPattern>
</Field>

So it uses the "Picture" column to get the value of user profile picture URL to render the image.

Obviously, for a task list i don't have a "Picture" column. Is there any way i can make for a task list a PictureDisp field with custom DisplayPattern and lookup that information from Site User Info List?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

If you add a column of type Person or Group, you get the option to add the column Name (with picture).

If you check the fields feature in the 14 hive, there is a property on the Field definition called ShowField:

<Field ID="{078B9DBA-EB8C-4ec5-BFDD-8D220A3FCC5D}" 
        FieldRef="Editor" 
        RowOrdinal="0" 
        ReadOnly="TRUE" 
        Type="User" 
        List="UserInfo" 
        Name="MyEditor" 
        SourceID="http://schemas.microsoft.com/sharepoint/v3"
        DisplayName="$Resources:core,Modified_By;" 
        StaticName="MyEditor" 
        FromBaseType="TRUE" 
        Required="FALSE" 
        Group="" 
        ShowField="NameWithPicture" 
        AuthoringInfo="$Resources:core,picture_and_name;"/>

If you have a User type field with Showfield="NameWithPicture" you should get the users picture. Is this sufficient, or is it a problem that you get the name as well?

share|improve this answer
    
Thank you, i'll take a look at this. And having a name is no problem, i need that too. And anyway I suspect if you change ShowField to "PictureDisp" it will only show picture. By the way for WSS3 i have only a 12 hive :) –  Janis Veinbergs Jan 13 '12 at 16:11
    
Thank you, this works. I actually modified existing AssignedTo field and set ShowField="NameWithPicture" to make it work. Thank you for solution. However if i choose to add a new field with similar schema and a FieldRef attribute, it won't show picture, but i can choose to show simple text fields like email, etc. –  Janis Veinbergs Jan 17 '12 at 12:08

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.