Skip to main content

Cloud

A custom Document Library Feature for Office 2007:

Custom Document Library:

This blog is a follow on from the previous ‘Custom Content Type’ where we look at the ability to create and deploy a custom document library as a feature. The custom document library can also include custom columns and views which will be covered in future blogs.

The basic steps are:

1.Add a custom content type for the library’s items.

2.Copy an existing document library feature to use as our template.

3.Customize the library’s schema.xml

4.Customize PBCCustomLibray.xml

5.Deploy and test.

Step 1 Create a custom content type

Refer to the previous blog for details:

  • If you created the Visual Studio project SPSFeatures described the previous blog open it up or else create a new Class Library project.
  • Create the following folder structure:

Features

PBCLibraryContentType

Feature.xml

Contents (subfolder)

PBCLibraryContentType.xml

Contents of Feature.xml:

<FeatureId="A0BCA6B4-CCDD-43f4-B006-3EC967033B19"

Title="PointBridge Custom Library content type Ver 1.0.0.1"

Description="Custom library content type for PointBridge Blogs"

Version="1.0.0.1"

Scope="Site"

Hidden="FALSE"

DefaultResourceFile="core"

xmlns="http://schemas.microsoft.com/sharepoint/">

<ElementManifests>

<ElementManifestLocation="ContentsPBCLibraryContentType.xml"/>

</ElementManifests>

</Feature>

Contents of PBCContentType

<Elementsxmlns="http://schemas.microsoft.com/sharepoint/">

<ContentTypeID="0x010100960FDB4DF37E47ceB7036C96E2EE24F4"

Name="PBC Document"

Group="PBC Content Types"

Description="PBC document for PointBridge Library"

Version="0">

</ContentType>

</Elements>

Install and activate feature.

Step 2 Copy Document library.

The custom document library used by the system as the base for libraries will be our template. Copy the contents of this directory to a newly created folder called PBCCustomLibrary.

Features folder – base folder:

C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12

Document Library:

…FeaturesDocumentLibrary copy contents to

…FeaturesPBCCustomLibrary

The contents of PBCCustomLibrary folder are:

Feature.xml

Subfolder: ListTemplate

Subfolder: doclib

Rename the doclib folder to pbclib.

Step 3 Customize schema.xml

  • Either copy the folder structure described above to the project’s Featutes folder or just open the files directly.
  • Open the pbclib/schema.xml and because the base type is a document library we can remove the DocumentTemplates section.

Change the List element to the following:

<Listxmlns:ows="Microsoft SharePoint"

Name="PBCLibrary"

Title="PBC Custom Library"

Direction="LTR"

Url="PBC Documents"

BaseType="1"

EnableContentTypes="TRUE">

  • Add the following to the ContentTypes section:

<ContentTypeRefID="0x010100960FDB4DF37E47ceB7036C96E2EE24F4"/>

The ID is the value used to in the custom content type above.

Step 4 Customize PBCCustomLibrary

<Elementsxmlns="http://schemas.microsoft.com/sharepoint/">

<ListTemplate

Name="pbclib"

Type="1500"

BaseType="1"

OnQuickLaunch="TRUE"

SecurityBits="11"

DisplayName="PBC Custom Library"

Description="PointBridge library contains PBC customm docs"

Image="/_layouts/images/itdl.gif"

DocumentTemplate="101">

</ListTemplate>

<ListInstance

Id="PBCCustomLibrary"

Title="PBC Library"

Description="PBC Library"

TemplateType="1500"

Url="PBCDocs">

</ListInstance>

</Elements>

Step 5 – Deploy and test

Copy the PBCCustomLibray folder structure to …Features folder if necessary.

Install using STSAdm.exe:

Activate the feature in the Site Actions>Site Settings>Site Collection Administration section, Site collection features and Activate.

Test the library:

Site Actions >Create>Libraries>PBC Custom Library

Give the library an appropriate name and keep the remaining default options.

Click Ok and the custom library is ready to use.

In upcoming blogs I will be showing how to further customize this library.

Download source.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

PointBridge Blogs

More from this Author

Follow Us