Friday 22 March 2013

Practical Steps to Create Picture Library

Create Content Type

  • Create new content type inherited from Picture content type
  • Add your own fields, if there are
  • Provision this content type to the site
  • Restart Visual Studio before you start the next steps

Create Document Library

Add Document Library

  • Add new item to the folder where you'd like to have new picture library
  • Choose List item and give the name to your library
  • When "SharePoint Customization Wizard" popup, set the name for the list and choose first option with Document Library in dropdown list
  • Click Finish

Add Content Type

  • Open new created document library in Visual Studio
  • Click Content Types button in Columns tab
  •  Delete Document content type from the list
  • Add your custom type to the list of the content types
  • Make it default and click OK

Convert Document Library to Picture Library

Add Picture Library Element Files

  •  Remove all html and aspx files from the library
  • Go to [15 hive]\Template\Features\PictureLibrary\PicLib
  • Add all aspx files from this folder to picture library in Visual Studio
  • Change the Deployment Type of those files to the ElementFile

Change List Definition File

  • Open Elements.xml
  • Set Type to 109
  • DocumentTemplate to 100
  • Save it

Change Schema File

  • Open Schema.xml
  • In the List node add next attributes ThumbnailSize="160" WebImageWidth="640" WebImageHeight="480"
  • Add Node to your default Content Type reference
    <Folder TargetName="Forms/Picture" />
  • Keep Fields node as is
  • Open file Schema.xml from [15 hive]\Template\Features\PictureLibrary\PicLib
  • Replace Views and Forms nodes with the ones from this definition file

Change List Instance Definition File

  • Open Elements.xml of list instance
  • Set TemplateType to 109
  • Save it


9 comments:

  1. Hi,
    Thanks for your post, it is save my day.

    In the step "Change Schema File >> open file PictureLibrary.xml", i think that the right file you should open is schema.xml not PIctureLibrary.xml, really it is that has the forms and views.

    ReplyDelete
    Replies
    1. Tino,

      You are right. I have been mistaken here.

      Delete
  2. Hi,

    Thanks for your post.

    In the step "Change Schema File >> open file PictureLibrary.xml",

    What should I replace in Views and Forms nodes.. I struct at this position..

    Please provide details

    ReplyDelete
  3. Its grt......... and Thxs

    Can we able to create custom "Video Library" like picture library. If possible please share steps.

    Thank You

    ReplyDelete
  4. the URL 'Lists/xxxx/yyyy.png' is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web.

    ReplyDelete
  5. Nice Artical ,

    Same u Added List From Visual Studio, M trying to add image in pic lib through Visual Studio that u Created above through Visual Studio?

    ReplyDelete
  6. m not able to see columns within libryary its showing me
    page not found
    The page you're looking for doesn't exist.
    where i follwd exact steps

    ReplyDelete