<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Coding against a Document Set</title>
	<atom:link href="http://blog.petergerritsen.nl/2009/11/06/coding-against-a-document-set/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.petergerritsen.nl/2009/11/06/coding-against-a-document-set/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link>
	<description>about .Net and application platform development</description>
	<lastBuildDate>Wed, 01 Feb 2012 17:07:23 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Paulo</title>
		<link>http://blog.petergerritsen.nl/2009/11/06/coding-against-a-document-set/comment-page-1/#comment-841</link>
		<dc:creator>Paulo</dc:creator>
		<pubDate>Fri, 17 Sep 2010 13:16:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.petergerritsen.nl/2009/11/06/sp2010-coding-against-a-document-set/#comment-841</guid>
		<description>Hi Peter,

1 - I already tried that and in debug mode I see it adding the additional content type, but then nothing happens in the sharepoint UI. Very strange...

2 - Also I&#039;ve been experimenting with this and also the instruction DocumentSet.Create that has a properties hashtable parameter does not seem to work, I don&#039;t see in sharepoint UI the properties.

3 - Do you have code to insert a document inside a document set, I&#039;ve seen a couple in the internet, but nothing works :-(

Best regards,
Paulo Fonseca

By the way here&#039;s the code:

SPSite site = new SPSite(&quot;http://win-n2bu1ltoqd9/sites/extranet&quot;);
            SPWeb web = site.OpenWeb();

            web.AllowUnsafeUpdates = true;
            //TODO: Get Site Content Types
            //Associar Esses CTs ao Document Set
            string s = String.Empty;
            SPContentType ct = web.ContentTypes[&quot;TemplateAlfa&quot;];
            SPContentType ctDocSet = web.ContentTypes[&quot;Document Set&quot;];
                       
            SPFolder folder = web.GetFolder(&quot;ListaProcessos/Processos&quot;);

            Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet docSet =
                                Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet.GetDocumentSet(folder);

                       
            
            //add the default document to your document set template
            //SPContentType customDocType = web.ContentTypes[&quot;Document Set&quot;]; 

            ////get a an instance of DocumentSetTemplate for the new document set
            DocumentSetTemplate newDocumentSetTemplate =
                        DocumentSetTemplate.GetDocumentSetTemplate(ctDocSet); 

            ////newDocumentSetTemplate.DefaultDocuments.Add(&quot;texte.txt&quot;, customDocType.Id, documentoBytes);

            ////.Folder.Files.Add(&quot;texte.txt&quot;, documentoBytes);
                        
            ////Add the new content type, make the field shared, and add it to the welcomepage


            newDocumentSetTemplate.AllowedContentTypes.Add(ct.Id);

            newDocumentSetTemplate.Update(true);
            ct.Update(); 

            web.Update();

            
            web.Dispose();</description>
		<content:encoded><![CDATA[<p>Hi Peter,</p>
<p>1 &#8211; I already tried that and in debug mode I see it adding the additional content type, but then nothing happens in the sharepoint UI. Very strange&#8230;</p>
<p>2 &#8211; Also I&#8217;ve been experimenting with this and also the instruction DocumentSet.Create that has a properties hashtable parameter does not seem to work, I don&#8217;t see in sharepoint UI the properties.</p>
<p>3 &#8211; Do you have code to insert a document inside a document set, I&#8217;ve seen a couple in the internet, but nothing works <img src='http://blog.petergerritsen.nl/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>Best regards,<br />
Paulo Fonseca</p>
<p>By the way here&#8217;s the code:</p>
<p>SPSite site = new SPSite(&#8220;http://win-n2bu1ltoqd9/sites/extranet&#8221;);<br />
            SPWeb web = site.OpenWeb();</p>
<p>            web.AllowUnsafeUpdates = true;<br />
            //TODO: Get Site Content Types<br />
            //Associar Esses CTs ao Document Set<br />
            string s = String.Empty;<br />
            SPContentType ct = web.ContentTypes["TemplateAlfa"];<br />
            SPContentType ctDocSet = web.ContentTypes["Document Set"];</p>
<p>            SPFolder folder = web.GetFolder(&#8220;ListaProcessos/Processos&#8221;);</p>
<p>            Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet docSet =<br />
                                Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet.GetDocumentSet(folder);</p>
<p>            //add the default document to your document set template<br />
            //SPContentType customDocType = web.ContentTypes["Document Set"]; </p>
<p>            ////get a an instance of DocumentSetTemplate for the new document set<br />
            DocumentSetTemplate newDocumentSetTemplate =<br />
                        DocumentSetTemplate.GetDocumentSetTemplate(ctDocSet); </p>
<p>            ////newDocumentSetTemplate.DefaultDocuments.Add(&#8220;texte.txt&#8221;, customDocType.Id, documentoBytes);</p>
<p>            ////.Folder.Files.Add(&#8220;texte.txt&#8221;, documentoBytes);</p>
<p>            ////Add the new content type, make the field shared, and add it to the welcomepage</p>
<p>            newDocumentSetTemplate.AllowedContentTypes.Add(ct.Id);</p>
<p>            newDocumentSetTemplate.Update(true);<br />
            ct.Update(); </p>
<p>            web.Update();</p>
<p>            web.Dispose();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Gerritsen</title>
		<link>http://blog.petergerritsen.nl/2009/11/06/coding-against-a-document-set/comment-page-1/#comment-812</link>
		<dc:creator>Peter Gerritsen</dc:creator>
		<pubDate>Wed, 15 Sep 2010 16:04:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.petergerritsen.nl/2009/11/06/sp2010-coding-against-a-document-set/#comment-812</guid>
		<description>Where did you put this code?

I haven&#039;t tried this out but the DocumentSetTemplate has a property AllowedContentTypes. I assume you can use the Add method on that to add a child content type to the documentset through code.</description>
		<content:encoded><![CDATA[<p>Where did you put this code?</p>
<p>I haven&#8217;t tried this out but the DocumentSetTemplate has a property AllowedContentTypes. I assume you can use the Add method on that to add a child content type to the documentset through code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paulo</title>
		<link>http://blog.petergerritsen.nl/2009/11/06/coding-against-a-document-set/comment-page-1/#comment-810</link>
		<dc:creator>Paulo</dc:creator>
		<pubDate>Wed, 15 Sep 2010 14:12:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.petergerritsen.nl/2009/11/06/sp2010-coding-against-a-document-set/#comment-810</guid>
		<description>I get the error &quot;The object specified does not belong to a list&quot; on line DocumentSetTemplate template = set.ContentTypeTemplate;
witch is strange because the document set is already created inside a form library.

Also do you know a way to add child content types to a document set using c# OM?

Thanks,
Paulo Fonseca</description>
		<content:encoded><![CDATA[<p>I get the error &#8220;The object specified does not belong to a list&#8221; on line DocumentSetTemplate template = set.ContentTypeTemplate;<br />
witch is strange because the document set is already created inside a form library.</p>
<p>Also do you know a way to add child content types to a document set using c# OM?</p>
<p>Thanks,<br />
Paulo Fonseca</p>
]]></content:encoded>
	</item>
</channel>
</rss>

