0

Working on a specific list that contains images as attatchments. How could I display them as image in infopath or list it self? Currently getting it as a link. I need it to be as a image for report purposes

0

By using below steps you can set image in your out of the box List.

1.Create "Picture" type Column in your list.

2.Create one Event Handler with ItemAttachmentAdded event like below:

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["PictureFieldName"] = attachmentUrl;

           item.Update();
      }

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

similar issue post for your reference:

https://social.technet.microsoft.com/Forums/office/en-US/2cb2f1d0-f8d8-4c7d-8ae0-83cbc3e81b0c/display-attached-image-as-picture?forum=sharepointgeneral

  • Yes, that is my post. Creating a multiple line collum helped me with inserting the picture. Would it be possible to do it automatically when attachment was added? – Lukas Šliužas Jan 31 at 6:43
  • Would it be showed as image? – Lukas Šliužas Jan 31 at 8:19
  • 1
    It cannot be automatically displayed as an image when attachment was added. – Lisa Chen MSFT Jan 31 at 8:40

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.