SharePoint Blogs / SharePoint University
SharePoint Blogs and SharePoint University - all in one place!
Need SharePoint Training? Attend a SharePoint Bootcamp!

Please delete cookies related to sharepointblogs.com and sharepointu.com to resolve login issues!

Creating a Custom Document Library Feature in WSS V3 / MOSS 2007

This blog has moved.  Click here to open this post on my new blog.

Features are a powerful new set of functionality that MOSS 2007 comes with out of the box. Features allow you to deploy functionality inside your MOSS 2007 portal in a granular and loosely coupled fashion. The Document Library that many of the out of the box site definitions come with in MOSS 2007 is implemented as a feature. Building on this out of the box Document Library Feature you can create your own custom Document Library Features as well.

Feature Basics

To begin, let’s take a look at the directories and files that make up a Feature.

Features are stored on the SharePoint Server at the following location:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES

Each Feature on the SharePoint Server has its own sub directory that is created in the directory listed above.

Inside each Feature sub directory you will find a file named Feature.xml.

The Feature.xml file holds metadata about the Feature.

Document Library Features

Here is the Feature.xml file that is used to create the DocumentLibrary Feature that comes with MOSS 2007:

<?xml version="1.0" encoding="utf-8" ?>

<!-- _lcid="1033" _version="12.0.4017" _dal="1" -->

<!-- _LocalBinding -->

<Feature Id="00BFEA71-E717-4E80-AA17-D0C71B360101"

Title="$Resources:core,documentlibraryFeatureTitle;"

Description="$Resources:core,documentlibraryFeatureDesc;"

Version="1.0.0.0"

Scope="Web"

Hidden="TRUE"

DefaultResourceFile="core"

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

<ElementManifests>

<ElementManifest Location="ListTemplates\DocumentLibrary.xml" />

</ElementManifests>

</Feature>

The following metadata about the feature is contained in the Feature element in this XML file.

ID: The GUID that uniquely identifies the Feature

Title: The name of the feature. You will see the name of the Feature displayed on the Site Features web page inside the Site Settings section for a given SharePoint Site.

Description: The description of the feature. You will see the description of the Feature displayed on the Site Features web page inside the Site Settings section for a given SharePoint Site.

Version: The version of the Feature.

Scope: Web or Site are acceptable values here. The scope specifies if the Feature can span an entire site collection, or if the Feature will just be used for an individual sub web.

Hidden: TRUE or FALSE are acceptable values here. This setting specifies if the Feature is visible in the list of Features on the Site Features web page mentioned above. You will notice in the XML below that the DocumentLibrary Feature has its Hidden attribute set to TRUE, this is why you do not see the Document Library in the list of Features on the Site Features web page. Therefore the ability to create a Document Library is not able to be turned off by an end user who has access to the Site Features web page.

DefaultResourceFile: This is the name of the Resource file the feature relies on to provide it with additional configuration information. (More on Resource files later in this document).

You will notice the <ElementManifests> element in the Feature.xml file. This element contains the location of another XML file that contains the different <Elements> this Feature implements.

The <ElementManifest> element specifies that the Feature utilizes a file in the ListTemplates sub directory called DocumentLibrary.xml. The path to sub directories and files is a relative path.

Here is the DocumentLibrary.xml file that holds the <Elements> implemented by the DocumentLibrary Feature:

<?xml version="1.0" encoding="utf-8" ?>

<!-- _lcid="1033" _version="12.0.4017" _dal="1" -->

<!-- _LocalBinding -->

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

<ListTemplate Name="doclib"

Type="101"

BaseType="1"

OnQuickLaunch="TRUE"

SecurityBits="11"

Sequence="110"

DisplayName="$Resources:core,doclibList;" Description="$Resources:core,doclibList_Desc;"

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

DocumentTemplate="101" />

</Elements>

Notice the <ListTemplate> element? This should look familiar to those who have edited the ONET.XML file in the last version of SharePoint.

The <ListTemplate> element specifies the information needed to make a particular list available on a SharePoint site. The only change to this element you see in this particular example is the addition of the Sequence attribute. As far as I can tell this attribute controls the order of the list on the Create page within a SharePoint site.

Closer inspection reveals some incredibly powerful technology that has been baked into MOSS 2007 – Resource files. This leads us to the topic of Resource files.

Resource Files

The DisplayName and Description attributes have an interesting item in their values. Let’s examine the DisplayName attribute.

The value for this attribute is $Resources:core,docLibList. This value specifies that the doclibList value is read from the core Resource file.

Resource files are stored in the following directory on the SharePoint server:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\Resources

Resource files contain key value pairs of information and are used to provide localization capabilities to SharePoint. I believe we will see many developers using Resource files for more than localization in the future because of the power and flexibility they provide.

The $Resources:core part of the value corresponds to the core.en-US.resx resource file.

The docLibList part of the value corresponds to the docLibList <Data> element within the core Resource file.

The XML inside the core resource file that is used to populate the DisplayName and Description attributes of the <ListTemplate> element looks like this:

<Data Name="doclibList">

<Value>Document Library</Value>

</Data>

<Data Name="doclibList_Desc">

<Value>Create a document library when you have a collection of documents or other files that you want to share. Document libraries support features such as folders, versioning, and check out.</Value>

</Data>

At this time I have not been able to find any documentation regarding these files, so I don’t recommend editing the core resource file, instead, make your own.

Another Benefit Of Features

In the last version of SharePoint the ONET.XML file was very big and contained a large amount of information. With the advent of Features the ONET.XML file shrinks because Features are used to componetize the contents of the ONET.XML file. As we have seen here, the <ListeTemplate> element, previously found in the <ListTemplates> element inside the ONET.XML file has been moved into the Document Library Feature. Other out of the box MOSS 2007 lists utilize this same approach.

Creating You Own Document Library Feature

Creating you own custom Document Library Feature is a simple task once you figure out all the pieces of the puzzle. Here is a list of tasks that you will need to do in order to create your own custom Document Library Feature.

Step 1: Create a directory for the Feature.

Step 2: (Optional) Create a custom Resource file.

Step 3: Create the Feature.xml file for the Feature.

Step 4: (Optional) Create the <DocumentTemplate> element inside the ONET.XML file if you are using a custom Document Template for your custom Document Library.

Step 5: Create the ListTemplates sub directory under your new Feature directory.

Step 6: Create the CustomDocumentLibrary.xml file for the Feature.

Step 7: Copy the contents of the DocLib sub directory into your new Feature directory.

Step 8: (Optional) If you plan to use a custom Document Template and you performed Step 4 above - Create a custom Document Template.

Step 9: (Optional) Copy the custom Document Template you created that will server as the default Document Template for your new custom Document Library to the SharePoint server.

Step 10: (Optional) Add the Feature to the site definition you want the feature to be installed on by default when the site is created. (Please see the Adding a Document Library Feature to a Site Definition in WSS V3 / MOSS 2007 article.)

Step 11: Register the Feature with a SharePoint site via the STSADM.EXE command line utility.

Step 12: Reset IIS.

Step 13a: (Assuming you did not do Step 10) Browse to the SharePoint site you registered the feature with. Browse to the Create web page and the custom Document Library will be available in the list of items to create.

Step 13b: (Assuming you did perform Step 10) Create a new SharePoint site with the site definition you edited in Step 10. Browse to the new site to see the custom Document Library already created for you.

*Note: In both cases the custom Document Library Feature will be available on the site.

Step 1: Create a directory for the Feature.

Create a new directory for your Feature in the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES directory.

This example will use the directory named CustomDocumentLibrary.

Step 2: (Optional) Create a custom Resource file.

Take advantage of the ability to store all your display settings and other items whose values may change frequently in your own Resource file by creating one.

Create a new file named customDocumentLibrary.en-US.resx in the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\Resources directory.

Inside the file put the following XML:

<?xml version="1.0" encoding="utf-8"?>

<!-- _lcid="1033" _version="12.0.4017.1004" _dal="1" -->

<!-- _LocalBinding -->

<root>

<Data Name="customDocumentLibrary_Title">

<Value>Custom Document Library</Value>

</Data>

<Data Name="customDocumentLibrary_Folder">

<Value>Custom Document Library</Value>

</Data>

<Data Name="customDocumentLibraryDisplayName">

<Value>Custom Document Library</Value>

</Data>

<Data Name="customDocumentLibraryDescription">

<Value>Create a custom document library when you have a collection of documents or other files that you want to share. Custom document libraries support features such as folders, versioning, and check out.</Value>

</Data>

</root>

Save the file.

Step 3: Create the Feature.xml file for the Feature.

Create a GUID for your feature. You will need to insert this GUID into some of the XML in this document where you see <YOUR GUID HERE>.

You can create a GUID inside VS.NET 2005 or run the following SQL SELECT statement to return a new GUID. SELECT NewID()

Create a file named Feature.xml and place it in the CustomDocumentLibrary directory you just created.

If you performed Step 2 put the following XML in the file:

<?xml version="1.0" encoding="utf-8" ?>

<!-- _lcid="1033" _version="12.0.4017" _dal="1" -->

<!-- _LocalBinding -->

<Feature Id="<YOUR GUID HERE>"

Title="$Resources:customDocumentLibrary,customDocumentLibrary_Title;"

Description="$Resources:customDocumentLibrary,customDocumentLibraryDescription;"

Version="1.0.0.0"

Scope="Web"

Hidden="FALSE"

DefaultResourceFile="customDocumentLibrary"

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

<ElementManifests>

<ElementManifest Location="ListTemplates\CustomDocumentLibrary.xml" />

</ElementManifests>

</Feature>

If you did not perform Step 2 put the following XML in the file:

<?xml version="1.0" encoding="utf-8" ?>

<!-- _lcid="1033" _version="12.0.4017" _dal="1" -->

<!-- _LocalBinding -->

<Feature Id="<YOUR GUID HERE>"

Title="Custom Document Library"

Description="Create a custom document library when you have a collection of documents or other files that you want to share. Custom document libraries support features such as folders, versioning, and check out."

Version="1.0.0.0"

Scope="Web"

Hidden="FALSE"

DefaultResourceFile="core"

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

<ElementManifests>

<ElementManifest Location="ListTemplates\CustomDocumentLibrary.xml" />

</ElementManifests>

</Feature>

Remember to replace <YOUR GUID HERE> with the GUID you created!

Save the file.

Step 4: (Optional) Create the <DocumentTemplate> element inside the ONET.XML file if you are using a custom Document Template for your custom Document Library.

Open the ONET.XML file for a custom site definition you have created (Please see the Creating a custom Site Definition in MOSS 2007 article for more details on how to create a custom site definition in MOSS 2007.)

Inside the ONET.XML file create a new <DocumentTemplate> element inside the <DocumentTemplates> element.

If you performed Step 2 use the following XML:

<DocumentTemplate

Path=“SAMPLE”

DisplayName="$Resources:customDocumentLibrary,customDocumentLibraryDisplayName;"

Type="4000"

Default="TRUE"

Description="$Resources:customDocumentLibrary,customDocumentLibraryDescription;">

<DocumentTemplateFiles>

<DocumentTemplateFile Name="doctemp\word\custom.dot"

TargetName="Forms/template.doc"

Default="TRUE"/>

</DocumentTemplateFiles>

</DocumentTemplate>

If you did not perform Step 2 use the following XML:

<DocumentTemplate

Path=”SAMPLE”

DisplayName="Custom Document Library"

Type="4000"

Default="TRUE"

Description=" Create a custom document library when you have a collection of documents or other files that you want to share. Custom document libraries support features such as folders, versioning, and check out.">

<DocumentTemplateFiles>

<DocumentTemplateFile Name="doctemp\word\custom.dot"

TargetName="Forms/template.doc"

Default="TRUE"/>

</DocumentTemplateFiles>

</DocumentTemplate>

Step 5: Create the ListTemplates sub directory under your new Feature directory.

In the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\CustomDocumentLibrary directory create a directory named ListTemplates.

Step 6: Create the CustomDocumentLibrary.xml file for the Feature.

Create a file named CustomDocumentLibrary.xml and place it in the ListTemplates directory you just created.

If you performed Step 2 use the following XML:

<?xml version="1.0" encoding="utf-8" ?>

<!-- _lcid="1033" _version="12.0.3820" _dal="1" -->

<!-- _LocalBinding -->

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

<ListTemplate

Name="doclib"

Type="4000"

BaseType="1"

OnQuickLaunch="FALSE"

SecurityBits="11"

DisplayName="$Resources:customDocumentLibrary,customDocumentLibraryDisplayName;"

Description="$Resources:customDocumentLibrary,customDocumentLibrary_Folder;"

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

DocumentTemplate="4000"/>

</Elements>

If you did not perform Step 2 use the following XML:

<?xml version="1.0" encoding="utf-8" ?>

<!-- _lcid="1033" _version="12.0.3820" _dal="1" -->

<!-- _LocalBinding -->

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

<ListTemplate

Name="doclib"

Type="4000"

BaseType="1"

OnQuickLaunch="FALSE"

SecurityBits="11"

DisplayName="Custom Document Library"

Description="Custom Document Library"

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

DocumentTemplate="4000"/>

</Elements>

*Note: You can add multiple <ListTemplate> elements here if you wish to create a Feature that deploys multiple document libraries at a time.

Step 7: Copy the contents of the DocLib sub directory into your new Feature directory.

In the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\CustomDocumentLibrary directory create a directory named DocLib.

Copy the contents of the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\DocumentLibrary\DocLib directory to the new DocLib directory you just created.

Step 8: (Optional) If you plan to use a custom Document Template and you performed Step 4 above, create a custom Document Template.

Open Microsoft Word.

Type in “Sample document template” into the document.

Click File | Save As

In the dropdown list that says Save as type: select Document Template (.dot)

Name the file custom.dot

Click the Save button.

Step 9: (Optional) Copy the custom Word Document Template you create that will server as the default Document Template for your new custom Document Library to the SharePoint server.

Copy the custom.dot file to the following directory on the SharePoint server:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\<NAME OF CUSTOME SITE DEFINITION>\DOCTEMP\WORD

Step 10: (Optional) Add the Feature to the site definition you want the feature to be installed on by default when the site is created. (Please see the Adding a Document Library Feature to a Site Definition in WSS V3 / MOSS 2007 article.)

Step 11: Register the Feature with a SharePoint site via the STSADM.EXE command line utility.

On the SharePoint server type the following command on the command line to change to the directory stsadm.exe resides in:

cd “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN”

Then type the following command to install the feature on the SharePoint server:

stsadm -o installfeature -filename "CustomDocumentLibrary\feature.xml"

This example assumes you have created a SharePoint site at the following URL:

http://SharePointServerName/SiteDirectory/CustDocLib

To activate the feature on the SharePoint site mentioned above site use the following command:

stsadm –o activatefeature –filename “CustomDocumentLibrary\feature.xml” –url “http://SharePointServerName/SiteDirectory/CustDocLib”

*Note: You can also uninstall and deactivate features using the stsadm utility.

Uninstall command line: stsadm -o uninstallfeature -filename "CustomDocumentLibrary\feature.xml"

Deactivate command line: stsadm –o deactivatefeature –filename “CustomDocumentLibrary\feature.xml” –url “http://SharePointServerName/SiteDirectory/CustDocLib”

Step 12: Reset IIS.

On the SharePoint server type iisreset on the command line and wait for IIS to reset.

Step 13a: (Assuming you did not do Step 10) Browse to the SharePoint site you registered the feature with. Browse to the Create web page and the custom Document Library will be available in the list of items to create.

Open Internet Explorer.

Browse to the http://SharePointServerName/SiteDirectory/CustDocLib site.

Click Site Settings

Click Create

Click Custom Document Library

Fill in the required information and to the Custom Document Library.

(If you created a custom Document Template) In the Document Template dropdown select Custom Document Library for the template.

Click Create.

If you created a custom Document Template clicking the new button on the Custom Document Library toolbar will open the custom Document Template you created.

Step 13b: (Assuming you did perform Step 10) Create a new SharePoint site with the site definition you edited in Step 10. Browse to the new site to see the custom Document Library already created for you.

Open Internet Explorer.

Create a new SharePoint site with the custom site definition you edited.

You will see the Custom Document Library already created for you and listed in the QuickLaunch Navigation on the left hand side of the site.

If you created a custom Document Template clicking the new button on the Custom Document Library toolbar will open the custom Document Template you created.

This blog has moved.  Click here to comment on this post on my new blog.


Posted 08-16-2007 3:12 PM by tbaginski

Comments

Judy wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 09-19-2007 4:07 PM

I want to add another field to the listtemplate, so I would have list title, list description, and a lookup field, this is for the list not items in a list.

I have tried to find this in the elements listtemplate for the lists xml and can;t find anything.

Do  you know how to add another field that is actually a lookup for the listtemplate

Pablo wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 09-26-2007 6:17 AM

I'm trying to do the same thing as Judy.

I would like to add a lookup column. Any clue?

Thanks

Jayanth wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 10-25-2007 1:31 AM

Hi Todd Baginski,

THis article is really nice. Right now I have different requirement.

I want to add a menu item in sharepoint 2007. If you open the sharepoint home page you can see the webparts available there. If you click document library link it will take you to the respective page. There you can see list of documents under related documents. If you click any document it will show a combobox with options as view properties, edit properties, manage permissions, edit in Microsoft office word, delete, sent to option as other location, e-mail a link, create document workspace, and download a copy. Here in this send to menu I want to add another item called Fax. I want to do this in C# 2.0. Should I create web application or website for this? How to do this? Please help me.

Abhishek Mishra wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 12-13-2007 6:09 AM

I need to add one more column to multiple documents upload page of SharePoint document library

Do you have any ideas how to do that

Abhishek Mishra wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 12-13-2007 6:16 AM

Let me be more specific.

The UI for multiple doc upload should have additional a additonal column for document to be added say  "Country"

Mindika wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 12-14-2007 12:35 AM

i did fallow this but i am getting a error : Exception from HRESULT: 0x81070201

feature get's deployed and can be active

Feature gets deployed and can be active.

We can see it the creation page also. But once I clicked it

gives this error ….

Can anyone help me

mindikadilan@yahoo.com

Jatuphum wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 01-02-2008 1:27 AM

If I have already form library. Can I use this solution with created form library? ...

Or I must create new site from new features.

Thank you

tj_yai@hotmail.com

drkaj wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 01-31-2008 2:44 AM

There is an error in the source above: The resource has capital letters in the tags and attributes.

<Data Name="customDocumentLibrary_Title">

<Value>Custom Document Library</Value>

</Data>

The tags and attributes must be lower case:

<data name="customDocumentLibrary_Title">

 <value>Custom document Library</value>

</data>

This is probably also what caused the HRESULT: 0x81070201 error that Mindika experienced.

Cheers,

Kaj

Hanif wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 02-07-2008 7:33 AM

Hi,

I want to create a custom document library to hold pdf documents and view them using a custom viewer only and should not be downloadable.

Any hints that anybody can provide.

Thanks in advance.

prabhu wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 03-05-2008 6:04 AM

i created one documentlibrary within the document libr

i have added new folder and i created one more column. now how can i enter some values?

Sam wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 03-07-2008 11:19 AM

This is a very interesting article. This will make it very easy to deploy a document library across sites. If I use this to create a document library feature it and then activate it in 5 sites, how then do I share the content between these 5 sites?

Can I add one custom document library as a web part in another team site?

Obieg Dokumentow wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 03-10-2008 4:38 PM

When placing <ListInstance ... OnQuickLaunch=True"/> in Onet.xml such instances do not show up automatically and throw an exception during feature activation. Anyone knows what is the problem or how should the URL look like?

Saud wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 03-14-2008 1:26 AM

Is it possoble to customize a Form Library to recieve more than one connections from filter web parts. Please repond.

Thanks in advance.

Veda wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 03-25-2008 3:15 AM

Hi,

I have followed the same steps for creating a custom Events List.

It is not throwing any error. But the custom field I have created in this Events List is not getting displayed in the Edit Form and New Form.

Please let me know what could be the reasons and solution.

Thanks in advance

Farrukh wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 04-09-2008 5:27 AM

Hi,

I have a added the feature to my custom site definition, but when i tried to create the site using that template, it ended in this error:  

"Feature '00ac67ae-b710-4b93-b688-69d30f55da89' is Web-scoped, and can not be added to the Site".

Any Help?

barhoom wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 05-03-2008 8:45 AM

is it possible to enable the document library to add new document with different format (say PDF) to an existing document (say MS Word) as a new version?

please reply and thanks in advance..

Aidan Garnish wrote Creating MOSS 2007 features - a reference
on 05-20-2008 5:12 AM

Creating MOSS 2007 features - a reference

Dhanyatha wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 06-02-2008 4:20 AM

Hi,

I have a document library. How do I link to title such that I dont have to display the file name and click on title to edit the entry.

Vijay wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 07-02-2008 4:07 PM

I would lke to change the message.

Once user clicks on the list item, I would like to display the message.

How we can write the event for this

Ram wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 10-01-2008 7:44 AM

How to remove the link for created by in document library

McKelt.com Blog wrote SharePoint development site
on 10-10-2008 11:26 AM

SharePoint development site

In the Trenches wrote InfoPath and MOSS 2007 Useful Links
on 10-11-2008 6:46 AM
Creating and deploying VSTO Documents inside SharePoint Document Libraries | Microsoft Sharepoint Server 2007 Space wrote Creating and deploying VSTO Documents inside SharePoint Document Libraries | Microsoft Sharepoint Server 2007 Space
on 11-03-2008 1:09 AM

Pingback from  Creating and deploying VSTO Documents inside SharePoint Document Libraries | Microsoft Sharepoint Server 2007 Space

Adding a Document Library Feature to a Site Definition in WSS V3 / MOSS 2007 | Microsoft Sharepoint Server 2007 Space wrote Adding a Document Library Feature to a Site Definition in WSS V3 / MOSS 2007 | Microsoft Sharepoint Server 2007 Space
on 11-03-2008 1:12 AM

Pingback from  Adding a Document Library Feature to a Site Definition in WSS V3 / MOSS 2007 | Microsoft Sharepoint Server 2007 Space

McKelt.com Blog wrote Links
on 11-26-2008 4:09 AM

Links

Monique Sauvageau wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 12-10-2008 4:32 PM

This is a nice tutorial about how features work. I used it to try and create a Custom Document Library with a Custom Template (I really just needed a custom template applied to a document library). After going through all the work of setting this feature up, I realized I didn't need to do this because MOSS 2007 lets you set a custom Template in your document library. If this is all you need to do, then follow these steps:

1. Under Actions, choose Open with Windows Explorer.

2. Open the Forms folder and add your custom template to the Forms folder (drag and drop from another window, copy from another window and paste it, etc., etc).

3. Close Windows Explorer.

4. Go to Setttings > Document Library Settings.

5. Under General Settings, choose Advanced Settings.

6. Under Template URL, change the template file name to your custom file name.

7. Click OK.

Vishal wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 01-06-2009 4:34 AM

Hello,

I have created one Custom Document Library. Everything is working fine but  am facing a simple problem like, when I save this Document Library as Template, I am not able to see this template on Create Page to use it.

Can some one please help me on this?

Ciaran Colgan wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 01-12-2009 8:57 AM

Hi Todd! thanks for your article.

I have a problem with documenttemplates in that i have deployed my document template as part of my custom content type feature as follows:

<Elements xmlns="schemas.microsoft.com/.../">

 <ContentType ID="GUID" Name="My Document" Group="My Content Types" Description="Core Document Type" Version="0">

   <FieldRefs>

     <FieldRef ID="GUID" Name="Title" DisplayName="Title" Required="TRUE" ReadOnly="FALSE" Hidden="FALSE"/>

     <FieldRef ID="GUID" Name="DocumentStatus" DisplayName="Document Status" Required="TRUE" ReadOnly="FALSE" Hidden="FALSE"/>

   </FieldRefs>

   <DocumentTemplate TargetName="NormalDoc.dotx"></DocumentTemplate>

 </ContentType>

 <Module Name="My Document"

   SetupPath="Features\MyContentTypes\Templates"

   Path=""

   Url="_cts/My Document">

     <File Url="NormalDoc.dotx" />

 </Module>

</Elements>

As you can see, i'm deploying my templates to the _cts folder in the site collection.

I can't figure out exactly what i should have in my onet.xml.

Currently i have:

<DocumentTemplateFile Name="_cts\My Document\NormalDoc.dotx" TargetName="Forms/NormalDoc.dotx" Default="TRUE"/>

Which doesnt work. Any thoughts? Thanks, Ciaran

Ciaran Colgan wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 01-13-2009 2:35 AM

As an addendum to my last post; I have done the following:

Associated a custom document template to a custom content type (and deployed both as a single feature),

Associated the custom content type with a custom document library (using this post).

The custom content type works fine, it is shown in the library under the 'New' dropdown.

BUT i want my custom template to be opened when i click on my content type here. It currently isn't - it is the default 'template.doc'.

I assume this is because i am including: <DocumentTemplate="101"> in my list manifest. This however cannot be left blank, and as i do not want to have to modify onet.xml, i have no documenttemplate number to reference.

My custom document templates are deployed to the _cts folder in the site definition.

In summary, is it possible to do this without having to either modify the onet.xml or copy this template to any location in the list itself or into the site definition folders (such as '/doctemp/word')?

It seems to me that for a perfectly modular deployment structure (in keeping with the feature framework) that it 'should' be possible to reference the document template solely through the content type but i cannot make it work, or find anyone else who has.

Any thoughts?

Thanks!

Ciaran

Versioning - enable by default on all document libraries | keyongtech wrote Versioning - enable by default on all document libraries | keyongtech
on 01-18-2009 10:31 AM

Pingback from  Versioning - enable by default on all document libraries | keyongtech

Himadrish Laha wrote re: Creating a Custom Document Library Feature in WSS V3 / MOSS 2007
on 01-19-2009 6:26 AM

Hi Todd,

Great article!

Well, I have one question in my mind. Can I implement the customize the new document library in such way that, whenever anyone access this document library, log will be created.

Can we implement this through the allitems.aspx in TEMPLATE folder.

Any ideas?

Thanks,

Himadrish

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Need SharePoint Training? Attend a SharePoint Bootcamp!
Posts (c) their respective authors. Everything else (c) 2009 SharePoint Experts, Inc.