<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" xml:lang="en" xml:base="http://www.sharepointblues.com/wp-atom.php">
	<title type="text">SharePoint Blues</title>
	<subtitle type="text" />

	<updated>2012-01-09T11:14:01Z</updated>

	<link rel="alternate" type="text/html" href="http://www.sharepointblues.com" />
	<id>http://www.sharepointblues.com/feed/atom/</id>
	

	<generator uri="http://wordpress.org/" version="3.1.3">WordPress</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/SharepointBlues" /><feedburner:info uri="sharepointblues" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
		<author>
			<name>Marko Rosberg</name>
					</author>
		<title type="html"><![CDATA[SharePoint Certificate errors]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SharepointBlues/~3/8No0_V6-vtk/" />
		<id>http://www.sharepointblues.com/?p=2262</id>
		<updated>2012-01-09T11:14:01Z</updated>
		<published>2012-01-09T08:24:50Z</published>
		<category scheme="http://www.sharepointblues.com" term="Configuration and Administration" /><category scheme="http://www.sharepointblues.com" term="Tips" />		<summary type="html"><![CDATA[<p>This article introduces some tools and practices that I’ve seen useful for tackling SharePoint 2010 errors arising from SSL Certificates. The main reason for writing this article is the &#8220;The root of the certificate chain is not a trusted root authority&#8221; – error.</p>
<p>Let&#8217;s first take a look at a useful tool for solving certificate errors. Windows has built in...</p>]]></summary>
		<content type="html" xml:base="http://www.sharepointblues.com/2012/01/09/sharepoint-certificate-errors/"><![CDATA[<p>This article introduces some tools and practices that I’ve seen useful for tackling SharePoint 2010 errors arising from SSL Certificates. The main reason for writing this article is the &#8220;The root of the certificate chain is not a trusted root authority&#8221; – error.</p>
<p>Let&#8217;s first take a look at a useful tool for solving certificate errors. Windows has built in a very good SSL certificate error log called CAPI2. This can be enabled under Application and Services Logs -&gt; Microsoft -&gt; CAPI2 by left clicking “Operational” and pressing “Enable Log”.<br />
<a href="http://www.sharepointblues.com/wp-content/uploads/2012/01/capi2.png"><img class="aligncenter size-full wp-image-2264" title="capi2" src="http://www.sharepointblues.com/wp-content/uploads/2012/01/capi2.png" alt="CAPI2 Log" width="321" height="384" /></a><br />
Two most common errors in CAPI2 log seems to be errors in Certification Revocation Lists (CRL) and untrusted root certificate chains. Let&#8217;s take a look at how one could solve these problems.</p>
<p><strong>Certificate revocation list errors</strong><br />
To make sure that the SSL certificates are valid windows checks for CRL. By default it will try to access this list for 15 seconds. If the list cannot be accessed the process is continued normally.<br />
In SharePoint CRL problems may occur for example as long loading times (especially if the page is not used frequently), broken functionalities, etc.<br />
CRL access errors can be solved by a few quite easy steps:<br />
1. In CAPI2 open error event in Details / XML view and find what CRL (Certificate Revocation List) URL the server is trying to access.<a href="http://www.sharepointblues.com/wp-content/uploads/2012/01/capi2_crl.png"><img class="aligncenter size-full wp-image-2277" title="capi2_crl" src="http://www.sharepointblues.com/wp-content/uploads/2012/01/capi2_crl.png" alt="CRL error" width="624" height="408" /></a><br />
2. You basically have two options for solving this:</p>
<ol>
<li>a. Enable access to the CRL address</li>
<li>b. Disable certificate revocation list check (not recommended) <a href="http://www.page-house.com/blog/2009/04/how-to-disable-crl-checking.html">How to Disable CRL Checking</a></li>
</ol>
<p><strong>Untrusted root authority or broken certificate chain error in SharePoint</strong><br />
1.Let’s first make sure that you have the proper error.</p>
<ol>
<li>a. Open Management console and add certificate snap in.</li>
<li>b. Expand Certificates -&gt; SharePoint -&gt; Certificates and open one of the certificates included in that folder.<a href="http://www.sharepointblues.com/wp-content/uploads/2012/01/sharepoint_container.png"><img class="aligncenter size-full wp-image-2285" title="sharepoint_container" src="http://www.sharepointblues.com/wp-content/uploads/2012/01/sharepoint_container.png" alt="" width="265" height="282" /></a></li>
<li>c. On the Certification Path -tab should look like as in the following figure.<br />
<a href="http://www.sharepointblues.com/wp-content/uploads/2012/01/broken_crt.png"><img class="aligncenter size-full wp-image-2292" title="broken_crt" src="http://www.sharepointblues.com/wp-content/uploads/2012/01/broken_crt.png" alt="" width="408" height="507" /></a></li>
</ol>
<p>2. OK, so let’s fix this problem. The problem by the way is that these certificates are issued by a certificate authority which is not trusted.</p>
<ol>
<li>a. First we must export the root certificate from SharePoint by using the following PowerShell commands:
<div class="codecolorer-container powershell blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="powershell codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000;">&#40;</span><span style="color: #800080;">$rootCert</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span>Get<span style="color: pink;">-</span>SPCertificateAuthority<span style="color: #000000;">&#41;</span>.RootCertificate<br />
<span style="color: #800080;">$rootCert</span>.Export<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;Cert&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Set-Content</span> C:\ConsumingFarmRoot.cer <span style="color: #008080; font-style: italic;">-Encoding</span> byte</div></div>
</li>
<li>b. Then import the SharePoint root certificate to trusted root authorities<br />
<a href="http://www.sharepointblues.com/wp-content/uploads/2012/01/crt_import.png"><img class="aligncenter size-full wp-image-2293" title="crt_import" src="http://www.sharepointblues.com/wp-content/uploads/2012/01/crt_import.png" alt="" width="330" height="314" /></a></li>
</ol>
<p>3. If all went well the certificates under SharePoint certificate store should look like in the following figure.<br />
<a href="http://www.sharepointblues.com/wp-content/uploads/2012/01/working_crt.png"><img class="aligncenter size-full wp-image-2294" title="working_crt" src="http://www.sharepointblues.com/wp-content/uploads/2012/01/working_crt.png" alt="" width="409" height="507" /></a></p>
<p>Allthought we have focused on SharePoint 2010 in this blog post these tools and practices can alse been applied for many other software running on Windows platform.</p>
<img src="http://www.sharepointblues.com/?ak_action=api_record_view&id=2262&type=feed" alt="" />]]></content>
		<link rel="replies" type="text/html" href="http://www.sharepointblues.com/2012/01/09/sharepoint-certificate-errors/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://www.sharepointblues.com/2012/01/09/sharepoint-certificate-errors/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://www.sharepointblues.com/2012/01/09/sharepoint-certificate-errors/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Tomi Tavela</name>
					</author>
		<title type="html"><![CDATA[Anonymous Access and Publishing Web Pages List]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SharepointBlues/~3/raANv1pZUFk/" />
		<id>http://www.sharepointblues.com/?p=2224</id>
		<updated>2011-12-22T12:57:10Z</updated>
		<published>2011-12-22T08:58:37Z</published>
		<category scheme="http://www.sharepointblues.com" term="Development and Customization" /><category scheme="http://www.sharepointblues.com" term="Tips" /><category scheme="http://www.sharepointblues.com" term="anonymous user" /><category scheme="http://www.sharepointblues.com" term="PublishingWeb" />		<summary type="html"><![CDATA[<p>As You know, using <a href="http://msdn.microsoft.com/en-us/library/ms497306(v=office.14).aspx">PublishingWeb.GetPublishingWeb(web)</a> method causes Access Denied exception for anonymous users. You will also get the same exception if you try to access the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.publishing.publishingweb.getpageslistid.aspx">PublishingWeb.GetPagesListId(web)</a> or <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.publishing.publishingweb.getpageslistname.aspx">PublishingWeb.GetPagesListName(web)</a> methods.<br />
There are solutions <a href="http://henry-chong.com/2010/11/sharepoint-anonymous-access-and-publishing-web-default-page/">here</a> and <a href="http://blogs.pointbridge.com/Blogs/sabadra_prasham/Pages/Post.aspx?_ID=1">here</a> and <a href="http://www.google.fi/search?ix=hca&#038;sourceid=chrome&#038;ie=UTF-8&#038;q=anonymousaccess+publishingweb">in many other blogs</a>. These solutions use <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx">SPSecurity.RunWithElevatedPrivileges</a>, but that&#8217;s not ideal solution for anonymous...</p>]]></summary>
		<content type="html" xml:base="http://www.sharepointblues.com/2011/12/22/anonymous_access_and_publishing_web_pages_list/"><![CDATA[<p>As You know, using <a href="http://msdn.microsoft.com/en-us/library/ms497306(v=office.14).aspx">PublishingWeb.GetPublishingWeb(web)</a> method causes Access Denied exception for anonymous users. You will also get the same exception if you try to access the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.publishing.publishingweb.getpageslistid.aspx">PublishingWeb.GetPagesListId(web)</a> or <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.publishing.publishingweb.getpageslistname.aspx">PublishingWeb.GetPagesListName(web)</a> methods.<br />
There are solutions <a href="http://henry-chong.com/2010/11/sharepoint-anonymous-access-and-publishing-web-default-page/">here</a> and <a href="http://blogs.pointbridge.com/Blogs/sabadra_prasham/Pages/Post.aspx?_ID=1">here</a> and <a href="http://www.google.fi/search?ix=hca&#038;sourceid=chrome&#038;ie=UTF-8&#038;q=anonymousaccess+publishingweb">in many other blogs</a>. These solutions use <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx">SPSecurity.RunWithElevatedPrivileges</a>, but that&#8217;s not ideal solution for anonymous sites.<br />
So how to get pages list from a web, if you don&#8217;t even know if the web is publishing site and you are not able to use <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.publishing.publishingweb.ispublishingweb.aspx">PublishingWeb.IsPublishingWeb(web)</a>?<br />
Heres yet another solution. Open the web you want to check if it is a publishing site and try to get the pages list using <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistcollection.trygetlist.aspx">TryGetList</a> method with the right localized pages list name. You will get the localized name from cmscore.resx file using <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.sputility.getlocalizedstring.aspx">SPUtility.GetLocalizedString</a> method with resource key &#8220;List_Pages_UrlName&#8221;.</p>
<div class="codecolorer-container csharp blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">var pages <span style="color: #008000;">=</span> web<span style="color: #008000;">.</span><span style="color: #0000FF;">Lists</span><span style="color: #008000;">.</span><span style="color: #0000FF;">TryGetList</span><span style="color: #008000;">&#40;</span>SPUtility<span style="color: #008000;">.</span><span style="color: #0000FF;">GetLocalizedString</span><span style="color: #008000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Format</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;$Resources:{0}&quot;</span>, <span style="color: #666666;">&quot;List_Pages_UrlName&quot;</span><span style="color: #008000;">&#41;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666666;">&quot;cmscore&quot;</span>, web<span style="color: #008000;">.</span><span style="color: #0000FF;">Language</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<br />
<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>pages <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
<span style="color: #008080; font-style: italic;">// do the do</span><br />
<span style="color: #008000;">&#125;</span></div></div>
<p>It all gets interesting, if the site is not publishing web, but still contain a list called &#8220;Pages&#8221;. Then You might want to check another things from returned list, not just if it&#8217;s null like in the snippet above.</p>
<p>***********************************************<br />
Jerry Seinfeld: Why not? We’re neighbors. What’s mine is yours.<br />
Cosmo Kramer: [leaning against the door-frame and looking around in wonder] Really?<br />
***********************************************</p>
<img src="http://www.sharepointblues.com/?ak_action=api_record_view&id=2224&type=feed" alt="" />]]></content>
		<link rel="replies" type="text/html" href="http://www.sharepointblues.com/2011/12/22/anonymous_access_and_publishing_web_pages_list/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://www.sharepointblues.com/2011/12/22/anonymous_access_and_publishing_web_pages_list/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://www.sharepointblues.com/2011/12/22/anonymous_access_and_publishing_web_pages_list/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Tomi Tavela</name>
					</author>
		<title type="html"><![CDATA[Remove Keys From PropertyBag on FeatureDeactivating Override]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SharepointBlues/~3/zmnzzDUl_fQ/" />
		<id>http://www.sharepointblues.com/?p=2200</id>
		<updated>2011-12-13T12:25:09Z</updated>
		<published>2011-12-13T08:17:09Z</published>
		<category scheme="http://www.sharepointblues.com" term="Development and Customization" /><category scheme="http://www.sharepointblues.com" term="Tips" /><category scheme="http://www.sharepointblues.com" term="feature" /><category scheme="http://www.sharepointblues.com" term="PropertyBag" />		<summary type="html"><![CDATA[<p>You can add keys to spweb propertybag trough a feature using CAML:</p>
<div class="codecolorer-container xml blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&#60;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&#34;1.0&#34;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&#34;utf-8&#34;</span><span style="color: #000000; font-weight: bold;">?&#62;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&#60;Elements</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&#34;http://schemas.microsoft.com/sharepoint/&#34;</span><span style="color: #000000; font-weight: bold;">&#62;</span></span><br />
&#160; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&#60;PropertyBag</span> <span style="color: #000066;">ParentType</span>=<span style="color: #ff0000;">&#34;Web&#34;</span> <span style="color: #000066;">RootWebOnly</span>=<span style="color: #ff0000;">&#34;False&#34;</span><span style="color: #000000; font-weight: bold;">&#62;</span></span><br />
&#160; &#160; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&#60;Property</span> <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&#34;MyCustomProperty&#34;</span></span><br />
<span style="color: #009900;"> &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color:</span></div></div><p>...</p>]]></summary>
		<content type="html" xml:base="http://www.sharepointblues.com/2011/12/13/remove_keys_from_propertybag_on_featuredeactivating_override/"><![CDATA[<p>You can add keys to spweb propertybag trough a feature using CAML:</p>
<div class="codecolorer-container xml blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Elements</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://schemas.microsoft.com/sharepoint/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;PropertyBag</span> <span style="color: #000066;">ParentType</span>=<span style="color: #ff0000;">&quot;Web&quot;</span> <span style="color: #000066;">RootWebOnly</span>=<span style="color: #ff0000;">&quot;False&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Property</span> <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;MyCustomProperty&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">Type</span>=<span style="color: #ff0000;">&quot;string&quot;</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;MyValue&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/PropertyBag<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Elements<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>The property is written to SPWebs AllProperties propertybag. When you deactivate the feature, it does not remove the keys.<br />
If you want to remove the keys when deactivating the feature, add Event Receiver to your Feature and the following code to the FeatureDeactivating override.</p>
<div class="codecolorer-container csharp blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> FeatureDeactivating<span style="color: #008000;">&#40;</span>SPFeatureReceiverProperties properties<span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; var web <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>SPWeb<span style="color: #008000;">&#41;</span>properties<span style="color: #008000;">.</span><span style="color: #0000FF;">Feature</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Parent</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; var allowUnsafeUpdates <span style="color: #008000;">=</span> web<span style="color: #008000;">.</span><span style="color: #0000FF;">AllowUnsafeUpdates</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; var elementDefinitions <span style="color: #008000;">=</span> properties<span style="color: #008000;">.</span><span style="color: #0000FF;">Definition</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetElementDefinitions</span><span style="color: #008000;">&#40;</span>CultureInfo<span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentCulture</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>var n <span style="color: #0600FF; font-weight: bold;">in</span> <span style="color: #0600FF; font-weight: bold;">from</span> SPElementDefinition elementDefinition <span style="color: #0600FF; font-weight: bold;">in</span> elementDefinitions<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">where</span> elementDefinition<span style="color: #008000;">.</span><span style="color: #0000FF;">ElementType</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;PropertyBag&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">select</span> elementDefinition<span style="color: #008000;">.</span><span style="color: #0000FF;">XmlDefinition</span> into xml<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">where</span> xml<span style="color: #008000;">.</span><span style="color: #0000FF;">Attributes</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;&amp;</span> xml<span style="color: #008000;">.</span><span style="color: #0000FF;">Attributes</span><span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;ParentType&quot;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Value</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;Web&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">from</span> n <span style="color: #0600FF; font-weight: bold;">in</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">from</span> XmlNode xNode <span style="color: #0600FF; font-weight: bold;">in</span> xml<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let xmlAttributeCollection <span style="color: #008000;">=</span> xNode<span style="color: #008000;">.</span><span style="color: #0000FF;">Attributes</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">where</span> xmlAttributeCollection <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">select</span> xmlAttributeCollection<span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;Name&quot;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">select</span> n<span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; web<span style="color: #008000;">.</span><span style="color: #0000FF;">AllProperties</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Remove</span><span style="color: #008000;">&#40;</span>n<span style="color: #008000;">.</span><span style="color: #0000FF;">Value</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; web<span style="color: #008000;">.</span><span style="color: #0000FF;">Update</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; web<span style="color: #008000;">.</span><span style="color: #0000FF;">AllowUnsafeUpdates</span> <span style="color: #008000;">=</span> allowUnsafeUpdates<span style="color: #008000;">;</span><br />
&nbsp; &nbsp; web<span style="color: #008000;">.</span><span style="color: #0000FF;">Update</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #008000;">&#125;</span></div></div>
<p>This sample only removes the keys, if the propertybag ParentType is &#8220;Web&#8221;, which means the key will be written to SPWebs AllProperties propertybag.</p>
<p>***********************************************<br />
Jerry Seinfeld: Why not? We’re neighbors. What’s mine is yours.<br />
Cosmo Kramer: [leaning against the door-frame and looking around in wonder] Really?<br />
***********************************************</p>
<img src="http://www.sharepointblues.com/?ak_action=api_record_view&id=2200&type=feed" alt="" />]]></content>
		<link rel="replies" type="text/html" href="http://www.sharepointblues.com/2011/12/13/remove_keys_from_propertybag_on_featuredeactivating_override/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://www.sharepointblues.com/2011/12/13/remove_keys_from_propertybag_on_featuredeactivating_override/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://www.sharepointblues.com/2011/12/13/remove_keys_from_propertybag_on_featuredeactivating_override/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Juha Alhojoki</name>
					</author>
		<title type="html"><![CDATA[SPList’s Title Property &amp; SPField’s DisplayName not Updating]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SharepointBlues/~3/_fF2qL5d3d8/" />
		<id>http://www.sharepointblues.com/?p=2141</id>
		<updated>2011-11-21T19:48:08Z</updated>
		<published>2011-11-14T12:45:13Z</published>
		<category scheme="http://www.sharepointblues.com" term="Development and Customization" /><category scheme="http://www.sharepointblues.com" term="Tips" /><category scheme="http://www.sharepointblues.com" term="DisplayName" /><category scheme="http://www.sharepointblues.com" term="language pack" /><category scheme="http://www.sharepointblues.com" term="problem" /><category scheme="http://www.sharepointblues.com" term="SPField" /><category scheme="http://www.sharepointblues.com" term="SPList" /><category scheme="http://www.sharepointblues.com" term="Title" />		<summary type="html"><![CDATA[<p>We encountered a problem which seemed really strange while provisioning our site collection with PowerShell (<a href="http://technet.microsoft.com/en-us/library/ff607937.aspx" target="_blank">New-SPSite</a>). Our provisioning contains programmatic custom list creation to our publishing webs via <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfeaturereceiver.aspx" target="_blank">feature receivers</a>. The procedure is that the feature receiver creates the list with a URL friendly Title and then changes the Title to a UI friendly version. Say,...</p>]]></summary>
		<content type="html" xml:base="http://www.sharepointblues.com/2011/11/14/splist-title-property-spfield-displayname-property-not-updating/"><![CDATA[<p>We encountered a problem which seemed really strange while provisioning our site collection with PowerShell (<a href="http://technet.microsoft.com/en-us/library/ff607937.aspx" target="_blank">New-SPSite</a>). Our provisioning contains programmatic custom list creation to our publishing webs via <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfeaturereceiver.aspx" target="_blank">feature receivers</a>. The procedure is that the feature receiver creates the list with a URL friendly Title and then changes the Title to a UI friendly version. Say, a list “orderform” is created and then the name of the list is changed to “Order Form” would result that we have a list “Order Form” at URL http://sharepointsite/lists/orderform.
</p>
<p>
What would you say if I told you that you can’t change the Title of a list after it is created with PowerShell or custom console app, if you are working with sites any other language than English. Well it’s true. I’ve tested it with two Team Sites, one in English and another in Swedish and by creating a generic list “Temp” to both of them. Then I tried the following PowerShell commands on both of the sites.
</p>
<ul>
<li>$web = Get-SPWeb(“http://sharepointsite”)</li>
<li>$list = $web.Lists[“Temp”]</li>
<li>$list.Title = “Temp2”</li>
<li>$list.Update()</li>
</ul>
<p>
The commands above update the &#8220;Temp&#8221; List’s Title to &#8220;Temp2&#8243; when my $web is the English team site but nothing happens if I run the same commands to my Swedish site. First I run the PowerShell commands to the sites
</p>
<p><img src="http://www.sharepointblues.com/wp-content/uploads/2011/11/powershell.png" /></p>
<p>Then I wonder why the Swedish site&#8217;s list title has not been updated&#8230;</p>
<p><img src="http://www.sharepointblues.com/wp-content/uploads/2011/11/Listor.png" /></p>
<p>&#8230;while the English site&#8217;s list title is updated as expected.</p>
<p><img src="http://www.sharepointblues.com/wp-content/uploads/2011/11/Lists.png" /></p>
<p>The resolution to the problem lies in the API. While trying to figure out what was going on by narrowing our use case which was a pretty large scale provision to the fact that you can&#8217;t edit list&#8217;s title even with PowerShell consisted of the following steps and remarks:</p>
<ul>
<li>The <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.aspx" target="_blank">SPList</a> <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.schemaxml.aspx" target="_blank">SchemaXml</a> property consists of a root element List, which has an attribute Title: the english site had Title=&#8221;Temp2&#8243; while Swedish site had Title=&#8221;Temp&#8221; but the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.schemaxmlincurrentuiculture.aspx" target="_blank">SchemaXmlInCurrentUiCulture</a> property had a correct Title-attribute in the Swedish site&#8217;s case Title=&#8221;Temp2&#8243;</li>
<li>After running IISRESET, the first page load in Swedish site&#8217;s /_layouts/viewlsts.aspx showed the updated Title &#8220;Temp2&#8243; of the list but after that page loads resulted the Title being the original &#8220;Temp&#8221;</li>
<li>While Googling, I came across this <a href="http://vojtan.wordpress.com/2010/10/28/displayname-of-spfield-is-not-set/" target="_blank">blog post by Vojtech Nadrovnik</a>, which describes a similar problem but with <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfield.aspx" target="_blank">SPField</a>&#8216;s DisplayName and the fact that Vojtech resolved the issue with <a href="http://en.wikipedia.org/wiki/Reflection_(computer_programming)" target="_blank">reflection</a> after first digging into the SharePoint code with a disassembler</li>
<li>Following Vojtech&#8217;s example, I tried some disassembling myself with <a href="http://wiki.sharpdevelop.net/ILSpy.ashx" target="_blank">ILSpy</a> and found out that there is a very similar condition in SPList&#8217;s Title property&#8217;s setter (the last if) as seen in Vojtech&#8217;s SPField case</li>
</ul>
<p><img src="http://www.sharepointblues.com/wp-content/uploads/2011/11/ILSpy.png" /></p>
<p>Some properties <b>ARE NOT</b> updated if the Thread&#8217;s UI Culture <b>IS NOT</b> the same as the web&#8217;s UI Culture.</p>
<p>If you have a feature and a receiver which might be activated by some other means than from the UI (_layouts/ManageFeatures.aspx) or any other piece of code that might be run outside SharePoint&#8217;s context, you could handle the problems described above by changing the thread&#8217;s UI Culture to the web&#8217;s UI Culture programmatically and it would work in any language as the following sample illustrates (different from Vojtech&#8217;s resolution):</p>
<div class="codecolorer-container csharp blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> FeatureActivated<span style="color: #008000;">&#40;</span>SPFeatureReceiverProperties properties<span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; SPWeb web <span style="color: #008000;">=</span> properties<span style="color: #008000;">.</span><span style="color: #0000FF;">Feature</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Parent</span> <span style="color: #0600FF; font-weight: bold;">as</span> SPWeb<span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">string</span> title <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Temp&quot;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">string</span> displayName <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Temp2&quot;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; CultureInfo originalUICulture <span style="color: #008000;">=</span> Thread<span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentThread</span><span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentUICulture</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">bool</span> allowUnsafeUpdates <span style="color: #008000;">=</span> web<span style="color: #008000;">.</span><span style="color: #0000FF;">AllowUnsafeUpdates</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">try</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>SPContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span> <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// IF CURRENT THREAD'S UI CULTURE </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// IS NOT THE SAME AS WEB'S UI CULTURE,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// STRANGE THINGS CAN HAPPEN</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Thread<span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentThread</span><span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentUICulture</span> <span style="color: #008000;">=</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> CultureInfo<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span><span style="color: #008000;">&#41;</span>web<span style="color: #008000;">.</span><span style="color: #0000FF;">Language</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; web<span style="color: #008000;">.</span><span style="color: #0000FF;">AllowUnsafeUpdates</span> <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// create list</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Guid listId <span style="color: #008000;">=</span> web<span style="color: #008000;">.</span><span style="color: #0000FF;">Lists</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>title, <span style="color: #666666;">&quot;&quot;</span>, <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SPListTemplateType<span style="color: #008000;">.</span><span style="color: #0000FF;">GenericList</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// get newly created list by id</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; SPList list <span style="color: #008000;">=</span> web<span style="color: #008000;">.</span><span style="color: #0000FF;">Lists</span><span style="color: #008000;">&#91;</span>listId<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// change list's title</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; list<span style="color: #008000;">.</span><span style="color: #0000FF;">Title</span> <span style="color: #008000;">=</span> displayName<span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; list<span style="color: #008000;">.</span><span style="color: #0000FF;">Update</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">finally</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; web<span style="color: #008000;">.</span><span style="color: #0000FF;">AllowUnsafeUpdates</span> <span style="color: #008000;">=</span> allowUnsafeUpdates<span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>SPContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span> <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// TOGGLE THE UI CULTURE BACK</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Thread<span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentThread</span><span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentUICulture</span> <span style="color: #008000;">=</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; originalUICulture<span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
<span style="color: #008000;">&#125;</span></div></div>
<img src="http://www.sharepointblues.com/?ak_action=api_record_view&id=2141&type=feed" alt="" />]]></content>
		<link rel="replies" type="text/html" href="http://www.sharepointblues.com/2011/11/14/splist-title-property-spfield-displayname-property-not-updating/#comments" thr:count="2" />
		<link rel="replies" type="application/atom+xml" href="http://www.sharepointblues.com/2011/11/14/splist-title-property-spfield-displayname-property-not-updating/feed/atom/" thr:count="2" />
		<thr:total>2</thr:total>
	<feedburner:origLink>http://www.sharepointblues.com/2011/11/14/splist-title-property-spfield-displayname-property-not-updating/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Marko Rosberg</name>
					</author>
		<title type="html"><![CDATA[Publishing cross farm Managed Metadata in cross forest environment with one way trust]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SharepointBlues/~3/fUVp_Md3NZQ/" />
		<id>http://www.sharepointblues.com/?p=2052</id>
		<updated>2011-04-28T13:37:53Z</updated>
		<published>2011-04-28T10:56:50Z</published>
		<category scheme="http://www.sharepointblues.com" term="Configuration and Administration" /><category scheme="http://www.sharepointblues.com" term="cross forest" /><category scheme="http://www.sharepointblues.com" term="managed metadata" /><category scheme="http://www.sharepointblues.com" term="one way trust" /><category scheme="http://www.sharepointblues.com" term="publishing" />		<summary type="html"><![CDATA[<p>Recently we ended up in a situation where there was a need to publish services from one farm to another. Basically there&#8217;s nothing special, but we needed to do that between SharePoint farms located in different forests. Only a one way trust was established.</p>
<p><a href="http://www.sharepointblues.com/wp-content/uploads/2011/04/forestit.png"><img class="alignleft size-medium wp-image-2060" title="Forest architecture" src="http://www.sharepointblues.com/wp-content/uploads/2011/04/forestit-300x141.png" alt="" width="300" height="141" /></a></p>
<p>The main idea is that Farm 2 will produce Managed Metadata Service (MMS) to be consumed in Farm 1....</p>]]></summary>
		<content type="html" xml:base="http://www.sharepointblues.com/2011/04/28/publishing-cross-farm-managed-metadata-in-cross-forest-environment-with-one-way-trust/"><![CDATA[<p>Recently we ended up in a situation where there was a need to publish services from one farm to another. Basically there&#8217;s nothing special, but we needed to do that between SharePoint farms located in different forests. Only a one way trust was established.</p>
<p><a href="http://www.sharepointblues.com/wp-content/uploads/2011/04/forestit.png"><img class="alignleft size-medium wp-image-2060" title="Forest architecture" src="http://www.sharepointblues.com/wp-content/uploads/2011/04/forestit-300x141.png" alt="" width="300" height="141" /></a></p>
<p>The main idea is that Farm 2 will produce Managed Metadata Service (MMS) to be consumed in Farm 1. The setup can be seen in the figure.</p>
<p>Publishing services between two farms can be done through Central Admin or by using PowerShell. There is an excellent guide for publishing cross farm services written by Mark Rhodes. <a href="http://mrhodes.net/2010/05/19/publishing-service-applications-between-sharepoint-2010-farms-part-1-8/">http://mrhodes.net/2010/05/19/publishing-service-applications-between-sharepoint-2010-farms-part-1-8/</a></p>
<p>We did everything as written in Rhodes&#8217; guide. The outcome was that we were able to share the service, but it couldn&#8217;t be accessed through the consuming farm (Farm 1).  When trying to access the Term Store following Error message appeared.</p>
<div style="border: 2px solid #ff0000; color: #ff0000; text-align: center; font-family: Verdana; line-height: 100%; font-size: 10px; padding: 8px">The Managed Metadata Service or Connection is currently not available. The Application Pool or Managed Metadata Web Service may not have been started. Please Contact your Administrator.</div>
<p>The problem was that although we had granted permission for the service application we hadn’t granted permissions to the Term Store.</p>
<p>Granting permissions to the Term Store can be done with the following PowerShell (PS)script.</p>
<p>In the consuming farm (Farm 1) run the following command:<br />
 </p>
<div class="codecolorer-container powershell blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="powershell codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000;">&#40;</span>Get<span style="color: pink;">-</span>SPFarm<span style="color: #000000;">&#41;</span>.Id</div></div>
<p>Run the following PowerShell commands on the publishing farm:</p>
<div class="codecolorer-container powershell blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="powershell codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #800080;">$ap</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>SPServiceApplication –Identity “Managed Metadata Service Application”<br />
<span style="color: #800080;">$security</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>SPMetadataServiceApplication <span style="color: #800080;">$ap</span> <span style="color: pink;">|</span> Get<span style="color: pink;">-</span>SPServiceApplicationSecurity<br />
<span style="color: #800080;">$principal</span> <span style="color: pink;">=</span> New<span style="color: pink;">-</span>SPClaimsPrincipal <span style="color: pink;">-</span>ClaimType <span style="color: #800000;">&quot;http://schemas.microsoft.com/sharepoint/2009/08/claims/farmid&quot;</span> <span style="color: pink;">-</span>ClaimProvider <span style="color: #800080;">$claimProvider</span> <span style="color: pink;">-</span>ClaimValue <span style="color: #800000;">&quot;farm id from previous&quot;</span><br />
Grant<span style="color: pink;">-</span>SPObjectSecurity <span style="color: pink;">-</span>Identity <span style="color: #800080;">$security</span> <span style="color: pink;">-</span>Principal <span style="color: #800080;">$principal</span> <span style="color: pink;">-</span>Rights <span style="color: #800000;">&quot;Full Access to Term Store&quot;</span><br />
Get<span style="color: pink;">-</span>SPMetadataServiceApplication <span style="color: #800080;">$ap</span> <span style="color: pink;">|</span> Set<span style="color: pink;">-</span>SPServiceApplicationSecurity <span style="color: pink;">-</span>ObjectSecurity $security</div></div>
<p>After running the script we could access the MMS through farm 1, but all groups were grayed out and we were not able to make any changes.</p>
<div class="mceTemp mceIEcenter">
<div class="mceTemp mceIEcenter"><a href="http://www.sharepointblues.com/wp-content/uploads/2011/04/access_failed.png"><img class="size-full wp-image-2072 alignleft" title="access_failed" src="http://www.sharepointblues.com/wp-content/uploads/2011/04/access_failed.png" alt="" width="249" height="120" /></a></div>
</div>
<p> <br />
The solution is to grant the user permissions to the term sets. One can grant the permissions in farm A. OOTB the people picker doesn’t recognize users in Forest B, but this problem can be solved by using the following stsadm script. The script should be run on the server where CA is running for all web applications including CA.</p>
<div class="codecolorer-container powershell blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="powershell codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">STSADM.exe <span style="color: pink;">-</span>o setproperty <span style="color: pink;">-</span>pn peoplepicker<span style="color: pink;">-</span>searchadforests <span style="color: pink;">-</span>pv <span style="color: #800000;">&quot;forest:domaina.com,DOMAINA\sp_admina,password; forest:domainb.com,DOMAINB\sp_adminb,password&quot;</span> <span style="color: pink;">-</span>url http:<span style="color: pink;">//</span>webapplication</div></div>
<p>After that we were able to grant permissions for term sets for users in both forests in farm 1. Unfortunately because the Farm 2 can’t see users in Forest 1 the MMS management site won’t open if you have granted permissions for users in both forests. In our case this was acceptable because the idea is that Managed Metadata is fully administered in Farm 2. So we granted Farm 1 write permissions, run our code that generated the Metadata structures and then changed the write permission back to Farm 2.</p>
<p><strong>Conclusion</strong></p>
<p>It is possible to publish Managed Metadata between two farms when there is only one way trust between the forests present. In any case this causes problems if you want to add or edit terms in both farms.</p>
<img src="http://www.sharepointblues.com/?ak_action=api_record_view&id=2052&type=feed" alt="" />]]></content>
		<link rel="replies" type="text/html" href="http://www.sharepointblues.com/2011/04/28/publishing-cross-farm-managed-metadata-in-cross-forest-environment-with-one-way-trust/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://www.sharepointblues.com/2011/04/28/publishing-cross-farm-managed-metadata-in-cross-forest-environment-with-one-way-trust/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://www.sharepointblues.com/2011/04/28/publishing-cross-farm-managed-metadata-in-cross-forest-environment-with-one-way-trust/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Juha Alhojoki</name>
					</author>
		<title type="html"><![CDATA[Extending the SocialCommentControl]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SharepointBlues/~3/5oEzhMm39lg/" />
		<id>http://www.sharepointblues.com/?p=2028</id>
		<updated>2011-04-07T06:44:32Z</updated>
		<published>2011-04-06T15:04:07Z</published>
		<category scheme="http://www.sharepointblues.com" term="Development and Customization" /><category scheme="http://www.sharepointblues.com" term="Tips" /><category scheme="http://www.sharepointblues.com" term="extend" /><category scheme="http://www.sharepointblues.com" term="Note Board" /><category scheme="http://www.sharepointblues.com" term="SocialCommentControl" />		<summary type="html"><![CDATA[<p>
SocialCommentControl is the control, which enables commenting on a page. You can use social commenting feature with the Note Board web part (Social Collaboration > Note Board) by adding the web part onto your page. You would have to have User Profile Service Application provisioned to enable social comments. Comments are stored in the Social DB (SocialComments table) of...</p>]]></summary>
		<content type="html" xml:base="http://www.sharepointblues.com/2011/04/06/extending-the-socialcommentcontrol/"><![CDATA[<p>
SocialCommentControl is the control, which enables commenting on a page. You can use social commenting feature with the Note Board web part (Social Collaboration > Note Board) by adding the web part onto your page. You would have to have User Profile Service Application provisioned to enable social comments. Comments are stored in the Social DB (SocialComments table) of your Service Application.
</p>
<p>
What we did recently was that we extended the out-of-box SocialCommentControl to be included in a custom page layout with a custom content type. The content type contains a boolean field to indicate, if commenting would be enabled on the published page. Another thing is that we can catch the events when a new comment is added, deleted or updated and build our own custom functionality, if needed, to handle those events.
</p>
<p>
The first thing was to take a look at the SocialCommentControl class with reflector in Microsoft.SharePoint.Portal assembly. The control inherits from <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webcontrol.aspx" target="_blank">System.Web.UI.WebControls.WebControl</a> and implements the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.icallbackeventhandler(v=VS.90).aspx" target="_blank">System.Web.UI.WebControls.ICallbackEventHandler</a>. The event handling for comments takes place in <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.icallbackeventhandler.raisecallbackevent.aspx" target="_blank">RaiseCallBackEvent</a> and the code can be dug out with reflector.
</p>
<p>
So what if there was a case where the editor wants to specify if commenting is allowed on a published page and wants to get the added comments via email if commenting would be enabled to the page. The scenario is not from our business case and is purely hypothetical but as a demo the case will do just fine.
</p>
<p>Below is a quick demonstration of how to handle enabling commenting on a page and get the editor of the page to receive email every time a comment is either added or edited. The sample contains also a workaround for the inconvenient behavior of the out-of-box SocialCommentControl which breaks the DOM and makes web designers mumble when they come across the fact that one <i>div</i> is unclosed.</p>
<div class="codecolorer-container csharp blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> SocialComments <span style="color: #008000;">:</span> SocialCommentControl, ICallbackEventHandler<br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> SocialComments<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Load <span style="color: #008000;">+=</span> SocialComments_Load<span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">protected</span> <span style="color: #6666cc; font-weight: bold;">void</span> SocialComments_Load<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, EventArgs e<span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; var item <span style="color: #008000;">=</span> SPContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ListItem</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// check if the current page has commenting allowed</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; var allowComments <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>item<span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;AllowComments&quot;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;&amp;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">bool</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span>item<span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;AllowComments&quot;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">?</span> <span style="color: #0600FF; font-weight: bold;">true</span> <span style="color: #008000;">:</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">!</span>allowComments<span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Visible <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">return</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">protected</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> CreateChildControls<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">base</span><span style="color: #008000;">.</span><span style="color: #0000FF;">CreateChildControls</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// the DOM is a terrible thing to break</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// http://www.sharepointblues.com/2010/09/28/fix-disabled-page-scrolling-on-navigation-settings/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Controls<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> LiteralControl<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;&lt;/div&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> GetCallbackResult<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #0600FF; font-weight: bold;">base</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetCallbackResult</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> RaiseCallbackEvent<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> eventArgument<span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">base</span><span style="color: #008000;">.</span><span style="color: #0000FF;">RaiseCallbackEvent</span><span style="color: #008000;">&#40;</span>eventArgument<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">try</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var item <span style="color: #008000;">=</span> SPContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ListItem</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var page <span style="color: #008000;">=</span> PublishingPage<span style="color: #008000;">.</span><span style="color: #0000FF;">GetPublishingPage</span><span style="color: #008000;">&#40;</span>item<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var editorEmail <span style="color: #008000;">=</span> page<span style="color: #008000;">.</span><span style="color: #0000FF;">CreatedBy</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Email</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var url <span style="color: #008000;">=</span> SPContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Web</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Url</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;/&quot;</span> <span style="color: #008000;">+</span> item<span style="color: #008000;">.</span><span style="color: #0000FF;">Url</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var currentUser <span style="color: #008000;">=</span> SPContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Web</span><span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentUser</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Name</span><span style="color: #008000;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var document <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> XmlDocument<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document<span style="color: #008000;">.</span><span style="color: #0000FF;">LoadXml</span><span style="color: #008000;">&#40;</span>eventArgument<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var documentElement <span style="color: #008000;">=</span> document<span style="color: #008000;">.</span><span style="color: #0000FF;">DocumentElement</span><span style="color: #008000;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">/*<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; eventArgument when added:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Item &nbsp;type='Add'&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Title&gt;News&lt;/Title&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;RTEContents&gt;This is a new comment&lt;/RTEContents&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/Item&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">/*<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; eventArgument when edited<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Item type='Edit' <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SequenceId='0' <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CommentId='144' <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CurrentPage='1' &gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;RTEContents&gt;This is an&amp;amp;#160;edited comment&lt;/RTEContents&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/Item&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>documentElement <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var <span style="color: #0600FF; font-weight: bold;">event</span> <span style="color: #008000;">=</span> documentElement<span style="color: #008000;">.</span><span style="color: #0000FF;">GetAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;type&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">event</span> <span style="color: #008000;">!=</span> <span style="color: #666666;">&quot;Get&quot;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">event</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;Add&quot;</span> <span style="color: #008000;">||</span> <span style="color: #0600FF; font-weight: bold;">event</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;Edit&quot;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var contentElement <span style="color: #008000;">=</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#40;</span>XmlElement<span style="color: #008000;">&#41;</span>documentElement<span style="color: #008000;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000FF;">SelectSingleNode</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;./RTEContents&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var content <span style="color: #008000;">=</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SPHttpUtility<span style="color: #008000;">.</span><span style="color: #0000FF;">NoEncode</span><span style="color: #008000;">&#40;</span>contentElement<span style="color: #008000;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000FF;">InnerText</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var subject <span style="color: #008000;">=</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Format</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Comment event '{0}' at {1}&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">event</span>, DateTime<span style="color: #008000;">.</span><span style="color: #0000FF;">Now</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var message <span style="color: #008000;">=</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Format</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Content: <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {0}&lt;br/&gt;&lt;br/&gt;By {1}&lt;br/&gt;&lt;br/&gt;Url: {2}&quot;</span>, <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; content, currentUser, url<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SPUtility<span style="color: #008000;">.</span><span style="color: #0000FF;">SendEmail</span><span style="color: #008000;">&#40;</span>SPContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Web</span>, <span style="color: #0600FF; font-weight: bold;">true</span>, <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">false</span>, editorEmail, subject, message<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">catch</span><span style="color: #008000;">&#40;</span>Exception ex<span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// log the exception</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
<span style="color: #008000;">&#125;</span></div></div>
<p>Below is the email the editor would get when a new comment is added to the page where commenting is enabled and the custom extension of the SocialCommentControl is included.</p>
<p><img src="http://www.sharepointblues.com/wp-content/uploads/2011/04/Comment-Notification.png" /></p>
<img src="http://www.sharepointblues.com/?ak_action=api_record_view&id=2028&type=feed" alt="" />]]></content>
		<link rel="replies" type="text/html" href="http://www.sharepointblues.com/2011/04/06/extending-the-socialcommentcontrol/#comments" thr:count="5" />
		<link rel="replies" type="application/atom+xml" href="http://www.sharepointblues.com/2011/04/06/extending-the-socialcommentcontrol/feed/atom/" thr:count="5" />
		<thr:total>5</thr:total>
	<feedburner:origLink>http://www.sharepointblues.com/2011/04/06/extending-the-socialcommentcontrol/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Tuukka Uskali</name>
					</author>
		<title type="html"><![CDATA[Fix SharePoint 2010 for Opera Part I]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SharepointBlues/~3/S0kR0HZivik/" />
		<id>http://www.sharepointblues.com/?p=2021</id>
		<updated>2011-03-29T06:14:03Z</updated>
		<published>2011-03-28T12:18:03Z</published>
		<category scheme="http://www.sharepointblues.com" term="Tips" /><category scheme="http://www.sharepointblues.com" term="css" /><category scheme="http://www.sharepointblues.com" term="js" /><category scheme="http://www.sharepointblues.com" term="opera" /><category scheme="http://www.sharepointblues.com" term="support" />		<summary type="html"><![CDATA[<p>I can&#8217;t use IE9 because UAG doesn&#8217;t support it yet on VPN connections. I can&#8217;t use IE8 or older because they don&#8217;t play well with the rest of the Web. I can use Google Chrome, Apple Safari, Mozilla Firefox and of course Opera. SharePoint 2010 plays fine with all these new generation browsers, except for the one: Opera. Opera isn&#8217;t...</p>]]></summary>
		<content type="html" xml:base="http://www.sharepointblues.com/2011/03/28/fix-sharepoint-2010-for-opera-part-i/"><![CDATA[<p>I can&#8217;t use IE9 because UAG doesn&#8217;t support it yet on VPN connections. I can&#8217;t use IE8 or older because they don&#8217;t play well with the rest of the Web. I can use Google Chrome, Apple Safari, Mozilla Firefox and of course Opera. SharePoint 2010 plays fine with all these new generation browsers, except for the one: Opera. Opera isn&#8217;t supported, and I&#8217;m glad to disagree.<br />
<div id="attachment_2023" class="wp-caption alignnone" style="width: 610px"><a href="http://www.sharepointblues.com/wp-content/uploads/2011/03/opera-1.jpg"><img src="http://www.sharepointblues.com/wp-content/uploads/2011/03/opera-1.jpg" alt="" title="Scrollbar in Ribbon area" width="600" height="142" class="size-full wp-image-2023" /></a><p class="wp-caption-text">Scrollbars are handy but sometimes we don&#039;t need them</p></div><br />
First things first. The top portion of the Ribbon has a nasty scrollbar slobbering all over it. We&#8217;ll get rid of that with a simple CSS rule:</p>
<div class="codecolorer-container css blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #cc00cc;">#s4-ribbonrow</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></div></div>
<p>Now onto the hard part. Click the Site Action button on the top left corner of the viewport. Nothing happens? I&#8217;m going the skip right through the details. The OnClick event of the Site Actions button calls the MMU_Open() -function which itself calls the MenuHtc_show() -function in order to display the pop-up menu. Both of these functions are located in the Core.js.  </p>
<p>A look on the MenuHtc_show() -function tells us the the execution of the function stops, if the browser object doesn&#8217;t hold a fresh enough version.</p>
<div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>browseris.<span style="color: #660066;">ie55up</span> <span style="color: #339933;">||</span> browseris.<span style="color: #660066;">nav6up</span> <span style="color: #339933;">||</span> browseris.<span style="color: #660066;">safari125up</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span></div></div>
<p>Apparently the latest Opera build isn&#8217;t good enough for SharePoint (in my opionion it&#8217;s the other way around). The browseris-object is built in the init.js and there we can see no references to the Presto layout engine Opera uses. I will add a simple and dirty support for opera and I&#8217;m not going to modify these two files since that is not in line with best practices. Obviously this is something Microsoft usually fixes in the future with cumulative updates, and they might change something that we are not aware of, making the page scream with Opera again.</p>
<p>I&#8217;ve got my external JS file somewhere in the hive, and I&#8217;ll just add &#8216;support&#8217; for Opera. The trick is to camouflage Opera as a Mozilla browser. To do this, I&#8217;ll use my favourite JS lib jQuery for dead simple browser detection and pass true the nav6up property of the browseris object if the browser is Opera with a recent major version.</p>
<div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">browseris.<span style="color: #660066;">nav6up</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">browser</span>.<span style="color: #660066;">opera</span> <span style="color: #339933;">&amp;&amp;</span> $.<span style="color: #660066;">browser</span>.<span style="color: #660066;">version</span> <span style="color: #339933;">&gt;=</span> <span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> <span style="color: #003366; font-weight: bold;">true</span> <span style="color: #339933;">:</span> browseris.<span style="color: #660066;">nav6up</span><span style="color: #339933;">;</span></div></div>
<p>There you go. The Site Actions menu works and the Fat Lady can sing. Unfortunately there is more. Once you hover over the menu items, the ribbon content goes up. The webpart properties menu is also dead. But this should be enough to get you started with Opera. On the next part, I&#8217;ll concentrate on those issues.</p>
<img src="http://www.sharepointblues.com/?ak_action=api_record_view&id=2021&type=feed" alt="" />]]></content>
		<link rel="replies" type="text/html" href="http://www.sharepointblues.com/2011/03/28/fix-sharepoint-2010-for-opera-part-i/#comments" thr:count="1" />
		<link rel="replies" type="application/atom+xml" href="http://www.sharepointblues.com/2011/03/28/fix-sharepoint-2010-for-opera-part-i/feed/atom/" thr:count="1" />
		<thr:total>1</thr:total>
	<feedburner:origLink>http://www.sharepointblues.com/2011/03/28/fix-sharepoint-2010-for-opera-part-i/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Tomi Tavela</name>
					</author>
		<title type="html"><![CDATA[How to Configure Crawl for Anonymous SharePoint 2010 Site]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SharepointBlues/~3/rI8m8Zxzq0M/" />
		<id>http://www.sharepointblues.com/?p=1946</id>
		<updated>2011-03-01T09:57:10Z</updated>
		<published>2011-02-25T16:53:23Z</published>
		<category scheme="http://www.sharepointblues.com" term="Configuration and Administration" /><category scheme="http://www.sharepointblues.com" term="Tips" />		<summary type="html"><![CDATA[<p>Are You getting errors like described in <a href="http://blog.mikehacker.net/2010/06/10/crawler-issue-with-sharepoint-2010-and-windows-server-2008-r2/">Mikes</a>  blog? Well atleast I did, and here is one way to fix it.</p>
<p>First of all, you need to have a web application with only anonymous access enabled. You can have it extended to another zone, with windows authentication , to make it available for editing. <a href="http://www.topsharepoint.com/enable-anonymous-access-in-sharepoint-2010">Here</a> is one guide...</p>]]></summary>
		<content type="html" xml:base="http://www.sharepointblues.com/2011/02/25/how-to-configure-crawl-for-anonymous-sharepoint-2010-site/"><![CDATA[<p>Are You getting errors like described in <a href="http://blog.mikehacker.net/2010/06/10/crawler-issue-with-sharepoint-2010-and-windows-server-2008-r2/">Mikes</a>  blog? Well atleast I did, and here is one way to fix it.</p>
<p>First of all, you need to have a web application with only anonymous access enabled. You can have it extended to another zone, with windows authentication , to make it available for editing. <a href="http://www.topsharepoint.com/enable-anonymous-access-in-sharepoint-2010">Here</a> is one guide how to make site anonymous. To disable view for form pages, guide for that in <a href="http://blogs.msdn.com/b/russmax/archive/2010/01/22/lockdown-mode-in-sharepoint-2010.aspx">here</a>.</p>
<p>When you are configuring your search and you want to use the anonymous site for crawling, you might get following error in you craw log and not getting anything crawled.</p>
<p><em>Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has &#8220;Full Read&#8221; permissions on the SharePoint Web Application being crawled.</em></p>
<p>The key here is that you need to crawl the site as <strong>Web site</strong>, not as <strong>SharePoint site</strong>. Basically it makes sense, you are using the site as anonymous, so what you can&#8217;t see should not be crawled.</p>
<p>[edit: You can also use SharePoint site as crawl type and and use the same crawls rule as described here, but if the crawl does not get all content you want, you can't add more start URLs because each start url needs to be a web application or site collection. And without the crawl rule you will be getting the same error as mentioned above.]</p>
<p>1. Go to your <strong>Search Service Application</strong>, select <strong>Content Sources</strong> from the navigation on the left and create a new content source by clinking the link <strong>New Content Source.</strong></p>
<p><a href="http://www.sharepointblues.com/wp-content/uploads/2011/02/contentsource1.png"><img src="http://www.sharepointblues.com/wp-content/uploads/2011/02/contentsource1.png" alt="" title="contentsource1" width="431" height="170" class="size-full wp-image-1965" /></a></p>
<p>2. Set the<strong> Content Source Type</strong> to <strong>Web site</strong> and Type the URLs from which the search system should start crawling. Some times it only crawled only the root web and did not follow the links in top navigation. If this happens, add more start URLs, like the URLs found in top navigation of your site collection.</p>
<p><a href="http://www.sharepointblues.com/wp-content/uploads/2011/02/contentsourcedetails1.png"><img src="http://www.sharepointblues.com/wp-content/uploads/2011/02/contentsourcedetails1.png" alt="" title="contentsourcedetails1" width="472" height="658" class="size-full wp-image-1966" /></a></p>
<p>3. Click <strong>Crawl Rules</strong> from the left navigation and create crawl rule.</p>
<p><a href="http://www.sharepointblues.com/wp-content/uploads/2011/02/rules.png"><img src="http://www.sharepointblues.com/wp-content/uploads/2011/02/rules.png" alt="" title="rules" width="387" height="238" class="size-full wp-image-1969" /></a></p>
<p>3.1 <strong>Rule</strong></p>
<p><a href="http://www.sharepointblues.com/wp-content/uploads/2011/02/rule1.png"><img src="http://www.sharepointblues.com/wp-content/uploads/2011/02/rule1.png" alt="" title="rule1" width="390" height="365" class="size-full wp-image-1967" /></a></p>
<p><strong>Start your crawler&#8230;</strong></p>
<p>***********************************************<br />
Jerry Seinfeld: Why not? We’re neighbors. What’s mine is yours.<br />
Cosmo Kramer: [leaning against the door-frame and looking around in wonder] Really?<br />
***********************************************</p>
<img src="http://www.sharepointblues.com/?ak_action=api_record_view&id=1946&type=feed" alt="" />]]></content>
		<link rel="replies" type="text/html" href="http://www.sharepointblues.com/2011/02/25/how-to-configure-crawl-for-anonymous-sharepoint-2010-site/#comments" thr:count="1" />
		<link rel="replies" type="application/atom+xml" href="http://www.sharepointblues.com/2011/02/25/how-to-configure-crawl-for-anonymous-sharepoint-2010-site/feed/atom/" thr:count="1" />
		<thr:total>1</thr:total>
	<feedburner:origLink>http://www.sharepointblues.com/2011/02/25/how-to-configure-crawl-for-anonymous-sharepoint-2010-site/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Tuukka Uskali</name>
					</author>
		<title type="html"><![CDATA[Drag &amp; Drop Web Part Y-offset Problem]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SharepointBlues/~3/TJqY3HrE9Gw/" />
		<id>http://www.sharepointblues.com/?p=1931</id>
		<updated>2011-01-19T11:54:26Z</updated>
		<published>2011-01-18T10:09:13Z</published>
		<category scheme="http://www.sharepointblues.com" term="Tips" /><category scheme="http://www.sharepointblues.com" term="javascript" /><category scheme="http://www.sharepointblues.com" term="master page" /><category scheme="http://www.sharepointblues.com" term="web part" />		<summary type="html"><![CDATA[<p>I&#8217;ve come across a bug in SharePoint 2010 with my custom master page that is based on minimal.master. In the edit mode, if I try to drag and drop web parts around, the element that is used to mark the drag position has a strange offset. Upon more investigation it appears that the javascript function that positions the marker with...</p>]]></summary>
		<content type="html" xml:base="http://www.sharepointblues.com/2011/01/18/drag-drop-webpart-y-offset-problem/"><![CDATA[<p>I&#8217;ve come across a bug in SharePoint 2010 with my custom master page that is based on minimal.master. In the edit mode, if I try to drag and drop web parts around, the element that is used to mark the drag position has a strange offset. Upon more investigation it appears that the javascript function that positions the marker with the class &#8216;ms-SPZoneIBar&#8217; ignores the scroll position of the #s4-workspace div.</p>
<p>Override the javascript function with your own, and everything is golden once again.</p>
<div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">MSOLayout_GetRealOffset <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>StartingObject<span style="color: #339933;">,</span> OffsetType<span style="color: #339933;">,</span> EndParent<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> realValue <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>EndParent<span style="color: #009900;">&#41;</span> EndParent <span style="color: #339933;">=</span> document.<span style="color: #660066;">body</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> currentObject <span style="color: #339933;">=</span> StartingObject<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; currentObject <span style="color: #339933;">!=</span> EndParent <span style="color: #339933;">&amp;&amp;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; currentObject <span style="color: #339933;">!=</span> document.<span style="color: #660066;">body</span> <span style="color: #339933;">&amp;&amp;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; currentObject <span style="color: #339933;">!=</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; currentObject <span style="color: #339933;">=</span> currentObject.<span style="color: #660066;">offsetParent</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; realValue <span style="color: #339933;">+=</span> <span style="color: #000066; font-weight: bold;">eval</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'currentObject.offset'</span> <span style="color: #339933;">+</span> OffsetType<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>OffsetType <span style="color: #339933;">==</span> <span style="color: #3366CC;">'Top'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> realValue <span style="color: #339933;">-</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'s4-workspace'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">scrollTop</span> <span style="color: #339933;">:</span> realValue<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></div></div>
<img src="http://www.sharepointblues.com/?ak_action=api_record_view&id=1931&type=feed" alt="" />]]></content>
		<link rel="replies" type="text/html" href="http://www.sharepointblues.com/2011/01/18/drag-drop-webpart-y-offset-problem/#comments" thr:count="3" />
		<link rel="replies" type="application/atom+xml" href="http://www.sharepointblues.com/2011/01/18/drag-drop-webpart-y-offset-problem/feed/atom/" thr:count="3" />
		<thr:total>3</thr:total>
	<feedburner:origLink>http://www.sharepointblues.com/2011/01/18/drag-drop-webpart-y-offset-problem/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>Juha Alhojoki</name>
					</author>
		<title type="html"><![CDATA[Blog Site in Anonymous Use]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SharepointBlues/~3/f03poTJvkbg/" />
		<id>http://www.sharepointblues.com/?p=1888</id>
		<updated>2011-01-10T08:47:51Z</updated>
		<published>2010-12-22T14:23:09Z</published>
		<category scheme="http://www.sharepointblues.com" term="Featured" /><category scheme="http://www.sharepointblues.com" term="Tips" /><category scheme="http://www.sharepointblues.com" term="anonymous" /><category scheme="http://www.sharepointblues.com" term="blog" /><category scheme="http://www.sharepointblues.com" term="viewformpageslockdown" />		<summary type="html"><![CDATA[<p>
Anonymous user cannot enter a blog entry in a SharePoint site if ViewFormPagesLockDown feature is active at site collection level and ViewFormPagesLockDown feature is active if site collection is based on publishing portal. After googling we came accross plenty of resources considering this matter:
</p>
<ul>
<li><a href="http://blogs.msdn.com/b/russmax/archive/2010/01/22/lockdown-mode-in-sharepoint-2010.aspx" target="_blank">Lockdown Mode in SharePoint 2010</a>
</li><li><a href="http://www.sharepointoverflow.com/questions/7279/anonymous-access-for-blog-sites-not-working-in-sp2010" target="_blank">Anonymous access for blog sites not working in</a></li></ul><p>...</p>]]></summary>
		<content type="html" xml:base="http://www.sharepointblues.com/2010/12/22/blog-site-in-anonymous-use/"><![CDATA[<p>
Anonymous user cannot enter a blog entry in a SharePoint site if ViewFormPagesLockDown feature is active at site collection level and ViewFormPagesLockDown feature is active if site collection is based on publishing portal. After googling we came accross plenty of resources considering this matter:
</p>
<ul>
<li><a href="http://blogs.msdn.com/b/russmax/archive/2010/01/22/lockdown-mode-in-sharepoint-2010.aspx" target="_blank">Lockdown Mode in SharePoint 2010</a>
<li><a href="http://www.sharepointoverflow.com/questions/7279/anonymous-access-for-blog-sites-not-working-in-sp2010" target="_blank">Anonymous access for blog sites not working in SP2010</a></i>
<li><a href="http://blog.richfinn.net/blog/CommentView,guid,2c3596d1-d7f3-4dad-8484-4a45e5ed315d.aspx" target="_blank">Rich Finn&#8217;s Blog</a></li>
</ul>
<p>
We didn&#8217;t want use the solutions suggested in the links above. To disable the ViewFormPagesLockDown &#8220;&#8230;leaves you wide open from a security perspective&#8230;&#8221;. To have our blog site in another site collection. Well that&#8217;s just not what we want to do to solve this tiny little thing with permissions.
</p>
<p>Me and <a href="http://www.sharepointblues.com/author/aapo-laakkonen/" target="_blank">Aapo</a> dug with reflector into ViewFormPagesLockDown feature and found out what the feature receiver does.</p>
<p><img src="http://www.sharepointblues.com/wp-content/uploads/2010/12/LockDownViewFormPages.png" /></p>
<p>The highlighted sections of the feature receiver show what happens to Guest&#8217;s permissions at rootweb level when you disable ViewFormPagesLockDown site collection level feature.</p>
<p>So why not just take the solution from where it is and develop a web scoped feature which does the exactly same thing to the blog site but not to all webs in the site collection because that&#8217;s not what we want.</p>
<p>Develop a feature receiver as follows:</p>
<div class="codecolorer-container csharp blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Microsoft.SharePoint</span><span style="color: #008000;">;</span><br />
<br />
<span style="color: #0600FF; font-weight: bold;">namespace</span> My<span style="color: #008000;">.</span><span style="color: #0000FF;">Assembly</span><br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> FormPagesLockDownReleaseReceiver <span style="color: #008000;">:</span> SPFeatureReceiver<br />
&nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> FeatureActivated<span style="color: #008000;">&#40;</span>SPFeatureReceiverProperties <br />
&nbsp; &nbsp; &nbsp; &nbsp; properties<span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>var web <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>SPWeb<span style="color: #008000;">&#41;</span>properties<span style="color: #008000;">.</span><span style="color: #0000FF;">Feature</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Parent</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var anonymousState <span style="color: #008000;">=</span> web<span style="color: #008000;">.</span><span style="color: #0000FF;">AnonymousState</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// continue only if anonymous use is enabled</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>anonymousState <span style="color: #008000;">==</span> SPWeb<span style="color: #008000;">.</span><span style="color: #0000FF;">WebAnonymousState</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Disabled</span><span style="color: #008000;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">return</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; web<span style="color: #008000;">.</span><span style="color: #0000FF;">AllowUnsafeUpdates</span> <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #008080; font-style: italic;">// break inheritance to set permissions per site</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; web<span style="color: #008000;">.</span><span style="color: #0000FF;">RoleDefinitions</span><span style="color: #008000;">.</span><span style="color: #0000FF;">BreakInheritance</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">true</span>, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// permission granting from LockDownViewFormPages</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var byType <span style="color: #008000;">=</span> web<span style="color: #008000;">.</span><span style="color: #0000FF;">RoleDefinitions</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetByType</span><span style="color: #008000;">&#40;</span>SPRoleType<span style="color: #008000;">.</span><span style="color: #0000FF;">Guest</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byType<span style="color: #008000;">.</span><span style="color: #0000FF;">BasePermissions</span> <span style="color: #008000;">|=</span> SPBasePermissions<span style="color: #008000;">.</span><span style="color: #0000FF;">EmptyMask</span> <span style="color: #008000;">|</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SPBasePermissions<span style="color: #008000;">.</span><span style="color: #0000FF;">ViewFormPages</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byType<span style="color: #008000;">.</span><span style="color: #0000FF;">BasePermissions</span> <span style="color: #008000;">|=</span> SPBasePermissions<span style="color: #008000;">.</span><span style="color: #0000FF;">UseRemoteAPIs</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byType<span style="color: #008000;">.</span><span style="color: #0000FF;">Update</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// reset the anonymous state programmatically</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; web<span style="color: #008000;">.</span><span style="color: #0000FF;">AnonymousState</span> <span style="color: #008000;">=</span> SPWeb<span style="color: #008000;">.</span><span style="color: #0000FF;">WebAnonymousState</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Disabled</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; web<span style="color: #008000;">.</span><span style="color: #0000FF;">AnonymousState</span> <span style="color: #008000;">=</span> anonymousState<span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; web<span style="color: #008000;">.</span><span style="color: #0000FF;">Update</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; web<span style="color: #008000;">.</span><span style="color: #0000FF;">AllowUnsafeUpdates</span> <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
<span style="color: #008000;">&#125;</span></div></div>
<p>Resetting the anonymous state is just a thing you would have to do from UI when you toggle permissions. <i><a href="http://blogs.msdn.com/b/russmax/archive/2010/01/22/lockdown-mode-in-sharepoint-2010.aspx" target="_blank">Lockdown Mode in SharePoint 2010</a>: &#8220;If anonymous is already setup, you may need to disable\re-enable anonymous on the site.&#8221;</i></p>
<p>Then a web scoped feature that consumes the receiver:</p>
<div class="codecolorer-container csharp blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #008000;">&lt;?</span>xml version<span style="color: #008000;">=</span><span style="color: #666666;">&quot;1.0&quot;</span> encoding<span style="color: #008000;">=</span><span style="color: #666666;">&quot;utf-8&quot;</span> <span style="color: #008000;">?&gt;</span><br />
<span style="color: #008000;">&lt;</span>Feature &nbsp; <br />
&nbsp; Id<span style="color: #008000;">=</span><span style="color: #666666;">&quot;{6189C7B4-6FDC-4BAA-95FD-03DD318031E5}&quot;</span> <br />
&nbsp; Title<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Blog Anonymous Access Staplee&quot;</span><br />
&nbsp; Description<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Enables Anonymous Access to Blog Entries&quot;</span><br />
&nbsp; Scope<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Web&quot;</span> <br />
&nbsp; ReceiverAssembly<span style="color: #008000;">=</span><span style="color: #666666;">&quot;My.Assembly, <br />
&nbsp; Version=1.0.0.0, <br />
&nbsp; Culture=neutral, <br />
&nbsp; PublicKeyToken=e3e48257ada349c4&quot;</span><br />
&nbsp; ReceiverClass<span style="color: #008000;">=</span><span style="color: #666666;">&quot;My.Assembly.FormPagesLockDownReleaseReceiver&quot;</span><br />
&nbsp; Hidden<span style="color: #008000;">=</span><span style="color: #666666;">&quot;FALSE&quot;</span> <br />
&nbsp; xmlns<span style="color: #008000;">=</span><span style="color: #666666;">&quot;http://schemas.microsoft.com/sharepoint/&quot;</span><span style="color: #008000;">&gt;</span><br />
<span style="color: #008000;">&lt;/</span>Feature<span style="color: #008000;">&gt;</span></div></div>
<p>
You could set the feature hidden to avoid accidental feature activations.
</p>
<p>
Then a stapling mechanism at site collection level to staple the feature to Blog sites by default.
</p>
<div class="codecolorer-container csharp blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Stapling<span style="color: #008000;">.</span><span style="color: #0000FF;">xml</span><br />
<br />
<span style="color: #008000;">&lt;?</span>xml version<span style="color: #008000;">=</span><span style="color: #666666;">&quot;1.0&quot;</span> encoding<span style="color: #008000;">=</span><span style="color: #666666;">&quot;utf-8&quot;</span> <span style="color: #008000;">?&gt;</span><br />
<span style="color: #008000;">&lt;</span>Elements xmlns<span style="color: #008000;">=</span><span style="color: #666666;">&quot;http://schemas.microsoft.com/sharepoint/&quot;</span><span style="color: #008000;">&gt;</span><br />
&nbsp; <span style="color: #008000;">&lt;!--</span>BLOG<span style="color: #008080;">#0--&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #008000;">&lt;!--</span>Staple FormPagesLockDownReleaseReceiver to Blog sites <span style="color: #008000;">--&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #008000;">&lt;</span>FeatureSiteTemplateAssociation <br />
&nbsp; &nbsp; Id<span style="color: #008000;">=</span><span style="color: #666666;">&quot;6189C7B4-6FDC-4BAA-95FD-03DD318031E5&quot;</span> <br />
&nbsp; &nbsp; TemplateName<span style="color: #008000;">=</span><span style="color: #666666;">&quot;BLOG#0&quot;</span> <span style="color: #008000;">/&gt;</span><br />
<span style="color: #008000;">&lt;/</span>Elements<span style="color: #008000;">&gt;</span></div></div>
<div class="codecolorer-container csharp blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #008000;">&lt;?</span>xml version<span style="color: #008000;">=</span><span style="color: #666666;">&quot;1.0&quot;</span> encoding<span style="color: #008000;">=</span><span style="color: #666666;">&quot;utf-8&quot;</span> <span style="color: #008000;">?&gt;</span><br />
<span style="color: #008000;">&lt;</span>Feature<br />
&nbsp; &nbsp; Id<span style="color: #008000;">=</span><span style="color: #666666;">&quot;{7DF309A4-7E3B-488A-9D2A-F3B88D656465}&quot;</span><br />
&nbsp; &nbsp; Title<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Blog Anonymous Enabling Stapler&quot;</span><br />
&nbsp; &nbsp; Description<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Staples Anonymous Access to Created Blog Sites&quot;</span><br />
&nbsp; &nbsp; Version<span style="color: #008000;">=</span><span style="color: #666666;">&quot;1.0.0.0&quot;</span><br />
&nbsp; &nbsp; Scope<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Site&quot;</span><br />
&nbsp; &nbsp; xmlns<span style="color: #008000;">=</span><span style="color: #666666;">&quot;http://schemas.microsoft.com/sharepoint/&quot;</span><br />
&nbsp; &nbsp; ActivateOnDefault<span style="color: #008000;">=</span><span style="color: #666666;">&quot;FALSE&quot;</span><span style="color: #008000;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&lt;</span>ElementManifests<span style="color: #008000;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&lt;</span>ElementManifest Location<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Stapling.xml&quot;</span> <span style="color: #008000;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&lt;/</span>ElementManifests<span style="color: #008000;">&gt;</span><br />
<span style="color: #008000;">&lt;/</span>Feature<span style="color: #008000;">&gt;</span></div></div>
<p>Voila, you have a mechanism to allow viewing form pages only in blog sites when you activate the stapler feature at site collection level. Of course, if you want, you could even set the needed permissions at list level in the Blog site, I suppose, but that&#8217;s not what we&#8217;ve done here.</p>
<img src="http://www.sharepointblues.com/?ak_action=api_record_view&id=1888&type=feed" alt="" />]]></content>
		<link rel="replies" type="text/html" href="http://www.sharepointblues.com/2010/12/22/blog-site-in-anonymous-use/#comments" thr:count="5" />
		<link rel="replies" type="application/atom+xml" href="http://www.sharepointblues.com/2010/12/22/blog-site-in-anonymous-use/feed/atom/" thr:count="5" />
		<thr:total>5</thr:total>
	<feedburner:origLink>http://www.sharepointblues.com/2010/12/22/blog-site-in-anonymous-use/</feedburner:origLink></entry>
	</feed>

