How to display the Attachment(picture) on the list item page?

I have attached a picture to the list item and then when I click the item, there is a link of the attachment but not the picture graphics! I want to display the picture on the list item page and how to do it?

I am a beginner of SharePoint 2010 and my English is not very good! Thanks!


  • Edited by lsc0123 Tuesday, March 12, 2013 1:15 AM
March 11th, 2013 10:09am

This is not possible in OOTB. if you want to display attached image, need to customize Edit and Display item forms with the help jquery you can display the image.

The other way around is you can user image column instead attachment, the image column is OOTB field. If you want to try this, below are the steps.

1. Create a site column and the type is "Image with formatting and constraints for publishing"

2. Add this column in you list content type(Enable allow content type then add this column in to list content type)

3. Now upload the image then view it in Edit and in Display forms.

Note: The uploaded images resides on a SharePoint library(that is selected while uploading the image)

Hope this will help you.

Free Windows Admin Tool Kit Click here and download it now
March 11th, 2013 10:18am

Hi,

Using few easy steps you can set image in your out of the box List View, Edit and View Item Page.

1. Create one Picture type Column in your list.

2. Just create one Event Handler with Item

/// <summary>
       /// An attachment was added to the item.
       /// </summary>
       public override void ItemAttachmentAdded(SPItemEventProperties properties)
       {
           base.ItemAttachmentAdded(properties);

           SPListItem item = properties.ListItem;
           //SPAttachmentCollection attach = item.Attachments;
           string attachmentUrl = item.Attachments.UrlPrefix + item.Attachments[0];

           item["PictureColumnName"] = attachmentUrl;
           item.Update();
      }

Now, just add item with attachment and you will see attached image in Picture Column field.

March 11th, 2013 11:33am

Great! Thanks a lot!
Free Windows Admin Tool Kit Click here and download it now
March 13th, 2013 9:26am

Can you tell me if this will work for Office 365? If so, how do I create an event handler?

Thanks!
March 30th, 2015 11:17pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics