<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.dotnetmafia.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Corey Roth [MVP] : Feature, Document Library</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Feature/Document+Library/default.aspx</link><description>Tags: Feature, Document Library</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>How to: Create a Custom Document Library</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/06/11/how-to-create-a-custom-document-library.aspx</link><pubDate>Wed, 11 Jun 2008 13:53:58 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:607</guid><dc:creator>CoreyRoth</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dotnetmafia.com/blogs/dotnettipoftheday/rsscomments.aspx?PostID=607</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/06/11/how-to-create-a-custom-document-library.aspx#comments</comments><description>&lt;p&gt;Not too long ago, I talked about how to remove the &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/05/29/how-to-remove-the-explorer-view-from-a-document-library-template.aspx"&gt;Explorer View&lt;/a&gt; from a document library.&amp;nbsp; As part of the post, I mentioned that I would post how to build a custom document library in the near future.&amp;nbsp; That is what I am covering today.&amp;nbsp; I really don&amp;#39;t know what the best practice is on how to create a document library, I am just going to show you how I have done it in the past.&lt;/p&gt; &lt;p&gt;Usually, the way I start is by taking a copy of the existing builtin SharePoint DocumentLibrary feature and add it to a new Visual Studio solution.&amp;nbsp; Typically I would put this in a 12 hive folder (i.e. TEMPLATE\FEATURES).&amp;nbsp; The next step is I rename the DocumentLibrary feature folder (i.e. CustomDocumentLibrary).&amp;nbsp; The next thing you will want to do is edit the &lt;em&gt;Feature.xml&lt;/em&gt; file.&amp;nbsp; We have to make some basic changes so that this is considered a new feature.&amp;nbsp; Therefore, you will want to pick a new GUID for the Id and give it a new Title and Description.&amp;nbsp; You may also want to change Hidden to False so that you can activate it and deactivate it through the UI.&lt;/p&gt; &lt;p&gt;Next, we need to edit the &lt;em&gt;ListTemplates/DocumentLibrary.xml&lt;/em&gt; file.&amp;nbsp; This file defines the list template itself.&amp;nbsp; The first thing you need to change is the &lt;em&gt;Type&lt;/em&gt;.&amp;nbsp; The Type number for a Document Library is 101.&amp;nbsp; It is recommended that user defined list templates start with 10000, so pick any number in that range that isn&amp;#39;t used.&lt;/p&gt; &lt;p&gt;The next file you need to modify is the &lt;em&gt;DocLib/Schema.xml &lt;/em&gt;file.&amp;nbsp; On the root List element, you will want to change at the minimum the Title element.&amp;nbsp; You may also want to set &lt;em&gt;EnableContentTypes&lt;/em&gt; to true if you want to use custom content types.&amp;nbsp; Set &lt;em&gt;FolderCreation &lt;/em&gt;to false if you have a custom folder type and set &lt;em&gt;VersioningEnabled&lt;/em&gt; to true if you want versioning enabled in the document library.&amp;nbsp; The Url property I believe is the default URL that you document library will use when created.&amp;nbsp; It is specified as a relative path (usually just the folder name).&amp;nbsp;&amp;nbsp; Here is what a typical root list element looks like.&lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;List&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;xmlns:ows&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;Microsoft SharePoint&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Title&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;My Custom Document Library&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Direction&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;$Resources:Direction;&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Url&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;My Custom Documents&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;BaseType&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;1&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;xmlns&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;http://schemas.microsoft.com/sharepoint/&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;EnableContentTypes&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;True&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;FolderCreation&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;false&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;VersioningEnabled&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;true&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;/p&gt;&lt;/div&gt; &lt;p&gt;I have been leaving the &lt;em&gt;BaseType &lt;/em&gt;attribute set to 1 and things have been working fine.&amp;nbsp; However, I have a feeling that it should probably be set to 101 so that Document Library is the base type.&amp;nbsp; In the MetaData section, you can override the folder and document content types.&amp;nbsp; I discussed how to properly do that in this &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/01/28/how-to-adding-a-content-type-to-a-list-the-correct-way.aspx"&gt;post&lt;/a&gt;.&amp;nbsp; You just need to reference the content types you are using and then also add Field elements for each custom site column you are using in those content types.&amp;nbsp; Again, the post mentioned above describes how to do that.&amp;nbsp;&amp;nbsp; The Scema.xml file is also where you can remove (or create) different views for your document library.&amp;nbsp; This is where you would go to remove the &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/05/29/how-to-remove-the-explorer-view-from-a-document-library-template.aspx"&gt;explorer view&lt;/a&gt; that I mentioned a while back.&lt;/p&gt; &lt;p&gt;Once you have made these changes, you are ready for deployment.&amp;nbsp; There are other files in the DocLib folder, but I typically don&amp;#39;t mess with them.&amp;nbsp; Your custom document library can be deployed by copying out the feature and using stsadm or you can create a solution file for it.&amp;nbsp; Once the feature is activated you are ready to create instances of your new document library.&amp;nbsp; Also note that the &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/06/04/wss-3-0-tools-visual-studio-extensions-1-2-running-under-windows-vista.aspx"&gt;Visual Studio Extensions for SharePoint&lt;/a&gt; can also create a lot of these files for you, but you will still need to go through and customize your various XML files.&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=607" width="1" height="1"&gt;</description><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Document+Library/default.aspx">Document Library</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Content+Type/default.aspx">Content Type</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Feature/default.aspx">Feature</category></item><item><title>Creating a Content Type based Folder in SharePoint via Feature Receiver</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/01/14/creating-a-content-type-based-folder-in-sharepoint-via-feature-receiver.aspx</link><pubDate>Mon, 14 Jan 2008 21:40:06 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:15</guid><dc:creator>C-Dog's .NET Tip of the Day</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dotnetmafia.com/blogs/dotnettipoftheday/rsscomments.aspx?PostID=15</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/01/14/creating-a-content-type-based-folder-in-sharepoint-via-feature-receiver.aspx#comments</comments><description>I have been working a lot with document libraries again and in this particular implementation, I had a need to create a pre-determined set of folders upon document library creation that were based upon a custom content type. I couldn&amp;#39;t find a way...(&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/01/14/creating-a-content-type-based-folder-in-sharepoint-via-feature-receiver.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=15" width="1" height="1"&gt;</description><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Document+Library/default.aspx">Document Library</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Content+Type/default.aspx">Content Type</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Feature/default.aspx">Feature</category></item></channel></rss>