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