Dec 16, 2015

How to upload Images to SharePoint List from another library with OOB feature


Guys,

Recently I got a small requirement to give an option to the user to select images from another library in to SharePoint list while adding a new item. Basically the default attach file option of a list item opens you the windows explorer to choose the items.

Firstly I thought, I should go for list form customization and a script injection by creating a file upload control and save the selected image in to the item with sp modal dialogue and the call back options.

But later I found that, this can be achieved using the OOB site column called “Image with formatting and constraints for publishing”, which is available with the Publishing Infrastructure Feature.

Steps to use this:
·          Create a site column called “Image with formatting and constraints for publishing”.

Site Actionsà Site Settingsà Create Site Column à Give some name “Product Image” of type “Image with formatting and constraints for publishing “






·        Add the site column to your list where you want the image upload feature.
List Settingsà Add from existing site columns à Select the above created site column

·        In the New Form you can see this column like this




              
      On clicking of the link, it will open a popup to select an image from a library. On click of browse, it will list all the lists and libraries throughout the site collection, from where you can choose an image and insert.






Once you say insert, it will ask you to provide other properties like size, layout, alternate text etc. like below




It will added to your list item like this




In Edit form, on selection of Image it will highlight the respective ribbon options to update the image.

Really this saves lot of time in developing a custom feature to upload image in new and edit forms…

Hope this helps…!!!!

No comments:

Post a Comment