<?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] : Content Type</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Content+Type/default.aspx</link><description>Tags: Content Type</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>A look at content type hubs in SharePoint Online (Office 365)</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2012/02/20/a-look-at-content-type-hubs-in-sharepoint-online-office-365.aspx</link><pubDate>Tue, 21 Feb 2012 02:29:02 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:5559</guid><dc:creator>CoreyRoth</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dotnetmafia.com/blogs/dotnettipoftheday/rsscomments.aspx?PostID=5559</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2012/02/20/a-look-at-content-type-hubs-in-sharepoint-online-office-365.aspx#comments</comments><description>&lt;p&gt;For those of you familiar with SharePoint 2010, the content type hub is nothing new to you.&amp;#160; However, in SharePoint Online, the content type hub works a little differently.&amp;#160; The first thing to know is that a content type hub has been set up automatically for you.&amp;#160; You just have to know where to find it.&amp;#160; You can’t get to it from Tenant Administration like you might expect.&amp;#160; Instead, you can find the location by going to the Site Settings page of any site collection and then the &lt;em&gt;Content Type Publishing&lt;/em&gt; link.&amp;#160; You will see a screen like the one below which links directly to the content types of a site collection containing your hub.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/SPOContentTypePublishing_3619A6BB.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="SPOContentTypePublishing" border="0" alt="SPOContentTypePublishing" src="http://www.dotnetmafia.com/blogs/dotnettipoftheday/SPOContentTypePublishing_thumb_66607B71.png" width="604" height="324" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;From here you will learn that your content type hub is located in a site collection named &lt;em&gt;/sites/contentTypeHub&lt;/em&gt;.&amp;#160; Clicking on the link from this page will allow you to view the content types in the hub.&amp;#160; One issue I have noticed here though is that only the original Office 365 account creator has access to the site collection.&amp;#160; Accessing it with another user will get you an access denied error message even if you are a global administrator.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/SPOContentTypeHubAccessDenied_76F8765F.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="SPOContentTypeHubAccessDenied" border="0" alt="SPOContentTypeHubAccessDenied" src="http://www.dotnetmafia.com/blogs/dotnettipoftheday/SPOContentTypeHubAccessDenied_thumb_35E9F6FB.png" width="403" height="184" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Unfortunately, you cannot fix this yourself from the tenant administration page because this site collection does not show up on the list.&amp;#160; This means you need to get the person who created the original Office 365 account to go to this site collection and add you as a site collection administrator.&amp;#160; It’s easy to fix but it requires you to involve whomever set up the account to begin with.&lt;/p&gt;  &lt;p&gt;Once you get into the content type hub, you can create and publish your desired content types just like you would in SharePoint 2010.&amp;#160; When you publish a content type, you should see it in the other site collections within a few minutes.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/SPOContentTypeHub_1080038D.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="SPOContentTypeHub" border="0" alt="SPOContentTypeHub" src="http://www.dotnetmafia.com/blogs/dotnettipoftheday/SPOContentTypeHub_thumb_1A64F4F8.png" width="477" height="264" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Working with the content type hub is easy.&amp;#160; Try it out with your account today.&amp;#160; These examples were demonstrated with an E3 account.&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=5559" 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/Content+Type/default.aspx">Content Type</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/SharePoint+2010/default.aspx">SharePoint 2010</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/ECM/default.aspx">ECM</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Office+365/default.aspx">Office 365</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Office+365+Grid/default.aspx">Office 365 Grid</category></item><item><title>A quick look at the content type editor in Visual Studio 11</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2012/02/06/a-quick-look-at-the-content-type-editor-in-visual-studio-11.aspx</link><pubDate>Mon, 06 Feb 2012 16:52:10 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:5508</guid><dc:creator>CoreyRoth</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dotnetmafia.com/blogs/dotnettipoftheday/rsscomments.aspx?PostID=5508</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2012/02/06/a-quick-look-at-the-content-type-editor-in-visual-studio-11.aspx#comments</comments><description>&lt;p&gt;Visual Studio 11 introduces a new content type editor that you might find useful when building your next content type.&amp;#160; It starts with a SharePoint Project Item that you can pick from the New Item menu.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11DPContentTypeSPI_0B0D976D.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="VS11DPContentTypeSPI" border="0" alt="VS11DPContentTypeSPI" src="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11DPContentTypeSPI_thumb_022D6954.png" width="591" height="353" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;From this screen, give your new content type a name and then you’ll be presented with this next screen allowing you to pick a content type to inherit from.&amp;#160; This pulls a list of every content type currently on the site collection that you have your Visual Studio project associated with.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11DPContentTypeInherit_7B6A3A03.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="VS11DPContentTypeInherit" border="0" alt="VS11DPContentTypeInherit" src="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11DPContentTypeInherit_thumb_5A76C75C.png" width="427" height="341" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Pick the content type you want to inherit from and you will then see the new content type editor.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11DPContentTypeEditor1_3264183D.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="VS11DPContentTypeEditor1" border="0" alt="VS11DPContentTypeEditor1" src="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11DPContentTypeEditor1_thumb_38AAEECB.png" width="432" height="143" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;From here you can begin adding exiting site columns to your new content type.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11DPContentTypeEditor2_29940FF1.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="VS11DPContentTypeEditor2" border="0" alt="VS11DPContentTypeEditor2" src="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11DPContentTypeEditor2_thumb_219C6D8F.png" width="438" height="297" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Selecting one will bring over the type automatically.&amp;#160; Unfortunately the only option you get here is whether the column is required or not.&amp;#160; However, you can click on the elements.xml file in the solution explorer to edit the XML directly.&amp;#160; I’ve tested and it will preserve any additional attributes you add to your site column references there.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11ContentTypeEditorXml_6E603425.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="VS11ContentTypeEditorXml" border="0" alt="VS11ContentTypeEditorXml" src="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11ContentTypeEditorXml_thumb_548BFDF6.png" width="458" height="172" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;You might be wondering what about site columns that have not been created yet.&amp;#160; The editor is actually smart and knows to look at any site columns defined in the same project as well.&amp;#160; For example, I created this new site column below.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11DPSiteColumnEditor_45751F1C.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="VS11DPSiteColumnEditor" border="0" alt="VS11DPSiteColumnEditor" src="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11DPSiteColumnEditor_thumb_1DCEA2F2.png" width="400" height="181" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Unfortunately, creating site columns still requires XML, but Visual Studio at least gets you started.&amp;#160; After you save your new site column, you will find the site column in the list.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11DPContentTypeEditor3_15D70090.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="VS11DPContentTypeEditor3" border="0" alt="VS11DPContentTypeEditor3" src="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11DPContentTypeEditor3_thumb_42EBED5E.png" width="432" height="197" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;You can also set some of the common properties such as the group and description of the content type itself by clicking on &lt;em&gt;Common Properties&lt;/em&gt;.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11ContentTypeEditorCommon_3AF44AFC.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="VS11ContentTypeEditorCommon" border="0" alt="VS11ContentTypeEditorCommon" src="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11ContentTypeEditorCommon_thumb_212014CD.png" width="447" height="307" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;What about inheriting from your own content type in the same project?&amp;#160; That actually works as well.&amp;#160; However, you will have to look for it at the top of the content type list.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11DPContentTypeInherit2_3F1E22C1.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="VS11DPContentTypeInherit2" border="0" alt="VS11DPContentTypeInherit2" src="http://www.dotnetmafia.com/blogs/dotnettipoftheday/VS11DPContentTypeInherit2_thumb_6C330F8F.png" width="452" height="174" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;That’s a quick look at what Visual Studio offers for content type editing.&amp;#160; I think the SharePoint Designer still has a few more features, but the main difference is what you create here can actually be deployed elsewhere.&amp;#160; This will work with SharePoint Online as well.&amp;#160; Just use the new &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2012/01/10/how-to-use-visual-studio-11-to-publish-solutions-to-sharepoint-online.aspx"&gt;publish&lt;/a&gt; feature I have talked about earlier.&lt;/p&gt;  &lt;p&gt;For more information on Visual Studio 11, go to the &lt;a href="http://msdn.microsoft.com/en-us/vstudio/hh127353"&gt;Developer Preview&lt;/a&gt; site.&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=5508" 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/Content+Type/default.aspx">Content Type</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/SharePoint+2010/default.aspx">SharePoint 2010</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/ECM/default.aspx">ECM</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/SharePoint+Online/default.aspx">SharePoint Online</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Visual+Studio+11/default.aspx">Visual Studio 11</category></item><item><title>Using CAML to deploy a lookup column via Feature</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/09/02/using-caml-to-deploy-a-lookup-column-via-feature.aspx</link><pubDate>Wed, 02 Sep 2009 21:47:49 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:962</guid><dc:creator>CoreyRoth</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dotnetmafia.com/blogs/dotnettipoftheday/rsscomments.aspx?PostID=962</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/09/02/using-caml-to-deploy-a-lookup-column-via-feature.aspx#comments</comments><description>&lt;p&gt;This week, I needed to deploy lookup columns to some of my lists and as usual I wanted to avoid writing code at all costs.&amp;#160; As some of you may know, &lt;a href="http://www.dotnetmafia.com/blogs/kylekelin/default.aspx"&gt;Kyle Kelin&lt;/a&gt; and I &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/05/12/code-samples-from-our-caml-vs-api-talk-at-tulsa-sharepoint-interest-group.aspx"&gt;debate&lt;/a&gt; this topic often as he prefers a code approach.&amp;#160; I figured it had to be possible with CAML, but many claimed it was not even possible.&amp;#160; A few approaches showed up out there involving using code to modify the elements.xml file with your GUID, but that just wasn’t going to cut it for me.&amp;#160; One popular post on the topic by &lt;a href="http://blogs.msdn.com/joshuag/archive/2008/03/14/add-sharepoint-lookup-column-declaratively-through-caml-xml.aspx"&gt;Josh Gaffey&lt;/a&gt;, started me in the right direction, but there were a few hurdles I ran into as I was trying to implement it.&amp;#160; It would create the list, show the content type, and site columns, but when I tried to create a new item, the lookup column was not there.&amp;#160; The basic technique is that you specify the path to the list in the form of (Lists/MyListName) in the &lt;em&gt;List &lt;/em&gt;attribute of the &lt;em&gt;Field&lt;/em&gt; element in both your schema.xml file of your document library template as well as the definition of the site column.&amp;#160; The first thing I learned here is that you cannot simply omit declaring site columns and a content type out and go with list level columns.&amp;#160; It simply will not work (no idea why).&lt;/p&gt;  &lt;p&gt;   &lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt; Here is how I ended up getting everything to work.&amp;#160; I created my initial lists, content types, and site columns through the SharePoint UI.&amp;#160; I then used &lt;a href="http://spsource.codeplex.com/"&gt;SPSource&lt;/a&gt; (seriously a great tool) to export the content type, site columns, and lists (both the source list and the one that contained the lookup column).&amp;#160; My goal was to deploy these items to another site collection.&amp;#160;&amp;#160; I recommend creating separate features for your content types and the list definition.&amp;#160; This way you can ensure the content type is deployed first.&amp;#160; To export your content type / site columns, create a new stub feature.xml file as described on their site and then create an .spsource file with just the content type in it like this (no need to specify columns).&lt;/p&gt;   &lt;div style="font-family:consolas;background:black;color:white;font-size:13pt;font-weight:bold;"&gt;   &lt;p style="margin:0px;"&gt;&amp;lt;&lt;span style="color:#cc7832;"&gt;Elements&lt;/span&gt; &lt;span style="color:silver;"&gt;xmlns&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;http://schemas.microsoft.com/sharepoint/&lt;/span&gt;&amp;quot;&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160; &amp;lt;&lt;span style="color:#cc7832;"&gt;ContentType&lt;/span&gt; &lt;span style="color:silver;"&gt;Name&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;Test&lt;/span&gt;&amp;quot; /&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;lt;/&lt;span style="color:#cc7832;"&gt;Elements&lt;/span&gt;&amp;gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;In my example, my content type was called &lt;em&gt;Test&lt;/em&gt;.&amp;#160; Create a separate feature folder for your list template and instance.&amp;#160; Create another feature.xml and an .spsource file for the list which looks something like this.&amp;#160; My list is also named &lt;em&gt;Test&lt;/em&gt; in this case.&lt;/p&gt;   &lt;div style="font-family:consolas;background:black;color:white;font-size:13pt;font-weight:bold;"&gt;   &lt;p style="margin:0px;"&gt;&amp;lt;&lt;span style="color:#cc7832;"&gt;Elements&lt;/span&gt; &lt;span style="color:silver;"&gt;xmlns&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;http://schemas.microsoft.com/sharepoint/&lt;/span&gt;&amp;quot;&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160; &amp;lt;&lt;span style="color:#cc7832;"&gt;ListTemplate&lt;/span&gt; &lt;span style="color:silver;"&gt;Name&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;Test&lt;/span&gt;&amp;quot; /&amp;gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;lt;/&lt;span style="color:#cc7832;"&gt;Elements&lt;/span&gt;&amp;gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;SPSource does a good job when it exports my list definition and properly specifies the list using a path instead of a guid in my lookup column as shown below (from schema.xml). &lt;/p&gt;   &lt;div style="font-family:consolas;background:black;color:white;font-size:13pt;font-weight:bold;"&gt;   &lt;p style="margin:0px;"&gt;&amp;lt;&lt;span style="color:#cc7832;"&gt;Field&lt;/span&gt; &lt;span style="color:silver;"&gt;Type&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;Lookup&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;DisplayName&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;DocumentCategory&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;Required&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;FALSE&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;List&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;Lists/Categories&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;ShowField&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;Title&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;UnlimitedLengthInDocumentLibrary&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;FALSE&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;Group&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;My Group&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;ID&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;{9266e0fa-ae49-438c-acdc-73063684ac8f}&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;SourceID&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;{50b253e5-e90e-4781-8fce-cece417b185e}&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;StaticName&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;DocumentCategory&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;Name&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;DocumentCategory&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;Customization&lt;/span&gt;=&amp;quot;&amp;quot; &lt;span style="color:silver;"&gt;ColName&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;int1&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;RowOrdinal&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;0&lt;/span&gt;&amp;quot; /&amp;gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;We don’t actually have to change a thing in this file.&amp;#160; What I did have to change is the List attribute of the file it generated for my site columns.&amp;#160; As Josh’s post above stated, we have to change the &lt;em&gt;List&lt;/em&gt; attribute from a GUID to the path of the list.&amp;#160; His post also mentioned you might want to set the PrependId attribute but I have since learned that this is only used when you are using the &lt;em&gt;LookupMulti &lt;/em&gt;type (although I can’t remember the source I got this from).&lt;/p&gt;   &lt;div style="font-family:consolas;background:black;color:white;font-size:13pt;font-weight:bold;"&gt;   &lt;p style="margin:0px;"&gt;&amp;lt;&lt;span style="color:#cc7832;"&gt;Field&lt;/span&gt; &lt;span style="color:silver;"&gt;Type&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;Lookup&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;DisplayName&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;DocumentCategory&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;Required&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;TRUE&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;List&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;Lists/Categories&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;ShowField&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;Title&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;UnlimitedLengthInDocumentLibrary&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;FALSE&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;Group&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;My Group&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;ID&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;{9266e0fa-ae49-438c-acdc-73063684ac8f}&lt;/span&gt;&amp;quot; &lt;span style="color:silver;"&gt;Name&lt;/span&gt;=&amp;quot;&lt;span style="color:#a5c25c;"&gt;DocumentCategory&lt;/span&gt;&amp;quot; /&amp;gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;At this point you can deploy your site columns, content type, and then custom list (in that order) and if all goes well you will be able to create a new item of that content type with the lookup column functioning.&amp;#160; One thing to note, if you get this wrong, your list will behave oddly.&amp;#160; One thing I noticed is that it won’t turn on content types for the list when that happens.&amp;#160; If this is happening go back and check your work.&amp;#160; Another thing people mentioned is that the source list for the lookup column has to exist before you create the lookup column.&amp;#160; This in fact is not true.&amp;#160; It will work and it will display a drop down list for the lookup column, but it will be empty of course since the list does not exist.&lt;/p&gt;  &lt;p&gt;Along the way I figured out a few other things.&amp;#160; When I was trying to figure this out, I was trying to just create the content type and then manually add it to the list via the UI.&amp;#160; Doesn’t work.&amp;#160; If you try to add a content type with a lookup column defined in this way to an existing list, you will get the following error.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Exception from HRESULT: 0x80040E07 at Microsoft.SharePoint.Library.SPRequestInternalClass.AddField(String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd)      &lt;br /&gt;at Microsoft.SharePoint.Library.SPRequest.AddField(String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd) &lt;/em&gt;&lt;/p&gt;  &lt;p&gt;The only way to get the content type associated with the list is via CAML when it is created.&amp;#160; Another odd thing is that the lookup column never shows it is bound to the other list correctly.&amp;#160; Here is what the source lookup column looked like.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/SharePointLookupColumnSource_13F82363.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="SharePointLookupColumnSource" border="0" alt="SharePointLookupColumnSource" src="http://www.dotnetmafia.com/blogs/dotnettipoftheday/SharePointLookupColumnSource_thumb_659E9DB5.png" width="261" height="189" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Notice where it says &lt;em&gt;Get information from, &lt;/em&gt;the name of the list is present.&amp;#160; Here is what my copy of the list looks like.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/SharePointLookupColumnCopy_65326AC0.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="SharePointLookupColumnCopy" border="0" alt="SharePointLookupColumnCopy" src="http://www.dotnetmafia.com/blogs/dotnettipoftheday/SharePointLookupColumnCopy_thumb_04E14489.png" width="265" height="183" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Notice that the list name is not present.&amp;#160; Strangely enough though, everything works fine in the copy.&amp;#160; This one through me for a loop for a while because it didn’t seem like things weren’t working and as I mentioned above I couldn’t add the content type to a list (nor could I add the column to a content type).&amp;#160; &lt;/p&gt;  &lt;p&gt;As you can see there are few oddities about deploying lookup columns in this manner, but it does work.&amp;#160; &lt;a href="http://twitter.com/spkyle"&gt;@SPKyle&lt;/a&gt; informed me he could have written code to do this hours ago, but I am quite happy that I can deploy things in this manner now.&lt;/p&gt;  &lt;p&gt;   &lt;p&gt;Twitter: &lt;a href="http://twitter.com/coreyroth"&gt;@coreyroth&lt;/a&gt;&lt;/p&gt;&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=962" 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/Content+Type/default.aspx">Content Type</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/Feature/default.aspx">Feature</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/CAML/default.aspx">CAML</category><category domain="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/tags/SPSource/default.aspx">SPSource</category></item><item><title>How to: Seal a Content Type</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/03/11/how-to-seal-a-content-type.aspx</link><pubDate>Wed, 11 Mar 2009 14:15:58 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:861</guid><dc:creator>CoreyRoth</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dotnetmafia.com/blogs/dotnettipoftheday/rsscomments.aspx?PostID=861</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/03/11/how-to-seal-a-content-type.aspx#comments</comments><description>&lt;p&gt;Sometimes, you want to make absolutely sure that someone can’t go in and change your content type via the Windows SharePoint Services user interface.&amp;#160; If an administrator were to delete or rename columns in your content type this can cause all sorts of issues as things may or may not be prorogated down to the child types.&amp;#160; You might also want to ensure that a content type is only created / modified by using a feature and CAML.&amp;#160;&amp;#160; To solve this, a content type can be marked as sealed and it can only be marked as sealed through the object model.&amp;#160; This prevents any casual changes to the content type via the user interface.&lt;/p&gt;  &lt;p&gt;The code to seal a content type is pretty simple.&amp;#160; Just get a reference to the particular content type you want to change, set &lt;em&gt;Sealed&lt;/em&gt; to true and update the content type.&amp;#160; In my example, I am just changing a content type off the root of the site collection called &lt;em&gt;Test Content Type&lt;/em&gt;.&amp;#160;&amp;#160; Here is the code.&lt;/p&gt;  &lt;div style="font-family:consolas;background:black;color:white;font-size:13pt;font-weight:bold;"&gt;   &lt;p style="margin:0px;"&gt;&lt;span style="color:#2b91af;font-weight:normal;"&gt;&amp;#160;&amp;#160; 14&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:#cc7832;"&gt;using&lt;/span&gt; (&lt;span style="color:#ffc66d;"&gt;SPSite&lt;/span&gt; currentSiteCollection = &lt;span style="color:#cc7832;"&gt;new&lt;/span&gt; &lt;span style="color:#ffc66d;"&gt;SPSite&lt;/span&gt;(&lt;span style="color:#a5c25c;"&gt;&amp;quot;http://moss-server&amp;quot;&lt;/span&gt;))&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#2b91af;font-weight:normal;"&gt;&amp;#160;&amp;#160; 15&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#2b91af;font-weight:normal;"&gt;&amp;#160;&amp;#160; 16&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:#ffc66d;"&gt;SPContentType&lt;/span&gt; contentType = currentSiteCollection.RootWeb.ContentTypes[&lt;span style="color:#a5c25c;"&gt;&amp;quot;Test Content Type&amp;quot;&lt;/span&gt;];&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#2b91af;font-weight:normal;"&gt;&amp;#160;&amp;#160; 17&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; contentType.Sealed = &lt;span style="color:#cc7832;"&gt;true&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#2b91af;font-weight:normal;"&gt;&amp;#160;&amp;#160; 18&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; contentType.Update();&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#2b91af;font-weight:normal;"&gt;&amp;#160;&amp;#160; 19&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;Of course there are some things you should know before sealing a content type.&amp;#160; As mentioned before, you will not be able to make any changes in the user interface as you can see below.&amp;#160; You also have to be a site collection administrator to seal the content type.&amp;#160; This means your code has to be executed by a user with appropriate permissions (a console app works fine).&amp;#160; You also need to know that sealed content types are not updated through push-down operations.&amp;#160; So if a change is made in a SPWeb’s content type and a list’s content type beneath it is sealed, that child content type won’t be updated.&amp;#160; You just have to remove all of your seals first.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/ContentTypeSealed_4AE002D2.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="ContentTypeSealed" border="0" alt="ContentTypeSealed" src="http://www.dotnetmafia.com/blogs/dotnettipoftheday/ContentTypeSealed_thumb_233986A8.png" width="348" height="288" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;That is what your content type will look like once it is sealed.&amp;#160; This concept also applies to the SPField object (for Site Columns) as well, the code would be quite similar and also makes use of the &lt;em&gt;Sealed &lt;/em&gt;property.&amp;#160; You can also seal content types at the list level as well.&amp;#160; To unseal your content type, just set the sealed property to false and update it again.&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=861" 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/Content+Type/default.aspx">Content Type</category></item><item><title>A Note on Content Type Inheritance</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/11/04/a-note-on-content-type-inheritance.aspx</link><pubDate>Tue, 04 Nov 2008 17:15:47 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:765</guid><dc:creator>CoreyRoth</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dotnetmafia.com/blogs/dotnettipoftheday/rsscomments.aspx?PostID=765</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/11/04/a-note-on-content-type-inheritance.aspx#comments</comments><description>&lt;p&gt;I ran into this issue a while back so I thought I would post on it.&amp;nbsp; I had a scenario where we wanted to create a simple content type to use as a base content type for all future content types at a comapany (i.e.: Company Base Document).&amp;nbsp; At the time we did not know what site columns we wanted included, so we didn&amp;#39;t include any FieldRefs to site columns.&amp;nbsp; We just inherited from this type into another more project specific document type.&amp;nbsp; It seemed like a good idea at the time, but it of course caused a number of problems.&lt;/p&gt; &lt;p&gt;It appears that if you do not specify any FieldRef elements in your content type definition that any other fields further up in the inheritance tree will also not get inherited.&amp;nbsp; This caused things like the Title field (inherited from item) to not be included in our content type.&amp;nbsp; The lesson to be learned here is a) plan better and have your fields defined first and b) make sure that you always specify at least one FieldRef in your content type definition.&amp;nbsp; I am sure there is a technical reason for this, but I thought I would throw it out there in case someone else runs into the issue in the future.&lt;/p&gt; &lt;p&gt;Also if you haven&amp;#39;t checked out my latest &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/10/31/introducing-document-link-handler-for-moss-2007-enterprise-search.aspx"&gt;addon for Enterprise Search&lt;/a&gt;, go check it out.&amp;nbsp; I am pretty excited about it and the users I have shown it to so far have found a lot of value in it.&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=765" 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/Content+Type/default.aspx">Content Type</category></item><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>Implementing Metadata Inheritance using an ItemEventReceiver</title><link>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/05/19/implementing-metadata-inheritance-using-an-itemeventreceiver.aspx</link><pubDate>Mon, 19 May 2008 18:59:15 GMT</pubDate><guid isPermaLink="false">ceb7fe2a-c56b-4d85-99e6-8dd548580538:585</guid><dc:creator>CoreyRoth</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.dotnetmafia.com/blogs/dotnettipoftheday/rsscomments.aspx?PostID=585</wfw:commentRss><comments>http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/05/19/implementing-metadata-inheritance-using-an-itemeventreceiver.aspx#comments</comments><description>&lt;p&gt;When implementing an ECM solution, it is often necessary to come up with a way for documents to inherit metadata from a parent folder.&amp;nbsp; The main reason of doing this is so that user&amp;#39;s can search on any of the document&amp;#39;s properties.&amp;nbsp; Other ECM solutions do this for you (yes there are other ECM solutions other than SharePoint), but WSS requires a bit of code to make it happen.&amp;nbsp; The way you do it is by creating an ItemEventReceiver and then by setting properties in the event handling method of various events.&amp;nbsp; To start out, I am assuming you have created your own content types for a custom folder and document.&amp;nbsp; We&amp;#39;ll call these &lt;em&gt;Custom Folder Type&lt;/em&gt; and &lt;em&gt;Custom Document Type&lt;/em&gt; respectively.&amp;nbsp; I am also assuming you are deploying these via feature.&amp;nbsp; The reason is you need to set up an Item Event Receiver on the Custom Document Type and it is much easier to configure via feature.&lt;/p&gt; &lt;p&gt;The first thing we need to do is create the class to contain the event handling methods of the &lt;em&gt;ItemAdded&lt;/em&gt;, &lt;em&gt;ItemUpdated&lt;/em&gt;, and &lt;em&gt;ItemCheckedIn&lt;/em&gt; events (there are more event types, but these are the only ones we need).&amp;nbsp; I recommend putting this class in its own library (or in a library with other item event handling methods).&amp;nbsp; My reason for this is that I have only been able to get an item event handling method to fire is when the assembly is in the GAC.&amp;nbsp; If you have read my blog in the past, you know I almost always recommend against this, but in this case, I don&amp;#39;t know of any choice.&amp;nbsp; To implement the class, start by having your custom class inherit from &lt;strong&gt;SPItemEventReceiver&lt;/strong&gt;.&amp;nbsp;&amp;nbsp; You can then override various event handling methods.&amp;nbsp; In this case, I want to enforce the metadata inheritance whenever a document is added, updated, or checked in.&amp;nbsp; To do this, we override the ItemAdded, ItemUpdated, and ItemCheckedIn methods.&amp;nbsp; The contents of all the methods is typically the same.&amp;nbsp; They call a method to do the inheritance and if it fails, we attempt to cancel the event (although I have never had it cancel anything when there is an exception).&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;public&lt;/span&gt; &lt;span style="color:blue;"&gt;override&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; ItemAdded(SPItemEventProperties properties)&lt;/p&gt; &lt;p style="margin:0px;"&gt;{&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;base&lt;/span&gt;.ItemAdded(properties);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;try&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InheritCustomProperties(properties.ListItem);&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;catch&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;Exception&lt;/span&gt; e)&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; properties.Cancel = &lt;span style="color:blue;"&gt;true&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; properties.ErrorMessage = &lt;span style="color:#a31515;"&gt;&amp;quot;Error inheriting metadata.&amp;quot;&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; properties.Status = SPEventReceiverStatus.CancelWithError;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin:0px;"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;The &lt;strong&gt;SPItemEventProperties&lt;/strong&gt; allows you to get access to the list item using the &lt;em&gt;ListItem&lt;/em&gt; property.&amp;nbsp; We then pass it to our custom method which does the inheritance.&amp;nbsp; In this example, I am assuming that the parent folder has two properties: Product Id and Color, that we want to copy into the newly added (or updated) item.&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;protected&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; InheritCustomProperties(&lt;span style="color:#2b91af;"&gt;SPListItem&lt;/span&gt; childItem)&lt;/p&gt; &lt;p style="margin:0px;"&gt;{&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:green;"&gt;// make sure that the parentFolder and its item are not null&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;if&lt;/span&gt; ((childItem.File.ParentFolder != &lt;span style="color:blue;"&gt;null&lt;/span&gt;) &amp;amp;&amp;amp; (childItem.File.ParentFolder.Item != &lt;span style="color:blue;"&gt;null&lt;/span&gt;))&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#2b91af;"&gt;SPItem&lt;/span&gt; parentItem = childItem.File.ParentFolder.Item;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:green;"&gt;// copy properties from parent to child&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; childItem[&lt;span style="color:#a31515;"&gt;&amp;quot;Product Id&amp;quot;&lt;/span&gt;] = parentItem[&lt;span style="color:#a31515;"&gt;&amp;quot;Product Id&amp;quot;&lt;/span&gt;];&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; childItem[&lt;span style="color:#a31515;"&gt;&amp;quot;Color&amp;quot;&lt;/span&gt;] = parentItem[&lt;span style="color:#a31515;"&gt;&amp;quot;Color&amp;quot;&lt;/span&gt;];&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:green;"&gt;// event firing must be disabled otherwise this update will cause another event to fire&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DisableEventFiring();&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; childItem.SystemUpdate(&lt;span style="color:blue;"&gt;false&lt;/span&gt;);&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EnableEventFiring();&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin:0px;"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;One thing to make sure is that a parent item exists for you to inherit from (obviously you would need to do something different if you were uploading documents to the root of a library).&amp;nbsp; Next it is just a matter of getting a reference to the parent item and then start copying each property.&amp;nbsp; Before updating the child item, you need to make a call to the base class&amp;#39;s &lt;em&gt;DisableEventFiring&lt;/em&gt; method to keep it from firing an event when you save the item.&amp;nbsp; Next, you should call &lt;em&gt;SystemUpdate&lt;/em&gt; instead of &lt;em&gt;Update&lt;/em&gt; which will save the item but not save it as a new version.&amp;nbsp; &lt;/p&gt; &lt;p&gt;That is all the code that is involved.&amp;nbsp; However, you still need to modify the XML of your Content Type feature to tell it to use your even receiver.&amp;nbsp; In your content type&amp;#39;s Elements.xml file, you&amp;#39;ll need to add some new entries to the &lt;em&gt;XmlDocuments&lt;/em&gt; element (add one if you don&amp;#39;t have one already).&amp;nbsp; Then, add a section similar to the one below to your file.&amp;nbsp; You will see one receiver for each event type (ItemAdded, ItemUpdated, ItemCheckedIn).&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;XmlDocument&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;NamespaceURI&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/events&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;spe:Receivers&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;xmlns:spe&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/events&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Receiver&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Custom Document Added Event Handler&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Type&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;ItemAdded&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Type&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SequenceNumber&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;10001&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SequenceNumber&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Assembly&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;CustomEventReceivers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f2d79125eb887b9e&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Assembly&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Class&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;CustomEventReceivers.CustomDocumentLibraryItemEventReceiver&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Class&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Data&lt;/span&gt;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Filter&lt;/span&gt;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Receiver&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Receiver&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Custom Document Updated Event Handler&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Type&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;ItemUpdated&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Type&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SequenceNumber&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;10001&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SequenceNumber&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Assembly&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;CustomEventReceivers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f2d79125eb887b9e&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Assembly&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Class&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;CustomEventReceivers.CustomDocumentLibraryItemEventReceiver&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Class&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Data&lt;/span&gt;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Filter&lt;/span&gt;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Receiver&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Receiver&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Custom Document Check In Event Handler&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Type&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;ItemCheckedIn&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Type&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SequenceNumber&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;10001&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SequenceNumber&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Assembly&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;CustomEventReceivers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f2d79125eb887b9e&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Assembly&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Class&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;CustomEventReceivers.CustomDocumentLibraryItemEventReceiver&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Class&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Data&lt;/span&gt;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Filter&lt;/span&gt;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Receiver&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;spe:Receivers&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;XmlDocument&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p&gt;The &lt;em&gt;SequenceNumber&lt;/em&gt; is the order in which your event handling method fires.&amp;nbsp; Microsoft typically recommends something starting with 10,000 and above to avoid conflicts with their event handlers.&amp;nbsp; The &lt;em&gt;Assembly &lt;/em&gt;element, takes a standard assembly reference to a DLL in the GAC.&amp;nbsp; The&lt;em&gt; Class&lt;/em&gt; element specifies the namespace and class which contains the event handling methods.&lt;/p&gt; &lt;p&gt;Again, I recommend keeping the feature for your content type and your event receivers in different assemblies.&amp;nbsp; Install your assemblies first with a &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2007/07/05/how-to-configure-code-access-security-for-a-web-part.aspx"&gt;solution package&lt;/a&gt;.&amp;nbsp; Then you can install the feature containing your updated content type.&amp;nbsp; Once you have it installed, add some metadata to a parent item, save it, and then try uploading a new document to verify that the metadata was copied to the new document.&amp;nbsp; If the event handler threw an exception, most likely it did not display a visible error.&amp;nbsp; Unfortunately, this means you&amp;#39;ll have to do some GAC debugging.&amp;nbsp; It sounds like quite a bit of work, but it really isn&amp;#39;t bad.&lt;/p&gt;&lt;img src="http://www.dotnetmafia.com/aggbug.aspx?PostID=585" 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/Content+Type/default.aspx">Content Type</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>