<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Vojtech Nadvornik&#039;s Blog</title>
	<atom:link href="http://vojtan.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://vojtan.wordpress.com</link>
	<description>SharePoint....</description>
	<lastBuildDate>Fri, 20 Jan 2012 09:46:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='vojtan.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/81eedde5624c42f9329e7eca4cfb1462?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Vojtech Nadvornik&#039;s Blog</title>
		<link>http://vojtan.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://vojtan.wordpress.com/osd.xml" title="Vojtech Nadvornik&#039;s Blog" />
	<atom:link rel='hub' href='http://vojtan.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Google Id/Windows Authentication in SharePoint 2010 using Windows Azure</title>
		<link>http://vojtan.wordpress.com/2011/12/11/google-idwindows-authentication-in-sharepoint-2010-using-windows-azure/</link>
		<comments>http://vojtan.wordpress.com/2011/12/11/google-idwindows-authentication-in-sharepoint-2010-using-windows-azure/#comments</comments>
		<pubDate>Sun, 11 Dec 2011 15:02:03 +0000</pubDate>
		<dc:creator>vojtan</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Claims]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[claims]]></category>

		<guid isPermaLink="false">http://vojtan.wordpress.com/?p=260</guid>
		<description><![CDATA[In this article I will describe how to enable signing in using Google Id, Windows Open Id, Facebook or Yahoo account to a SharePoint 2010 site collection. As authentication provider I will use Windows Azure Platform. Here are the steps you have to do: Configure the Azure platform Create an account on Windows Azure Platform [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=260&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this article I will describe how to enable signing in using Google Id, Windows Open Id, Facebook or Yahoo account to a SharePoint 2010 site collection. As authentication provider I will use Windows Azure Platform.<br />
Here are the steps you have to do:</p>
<p>Configure the Azure platform</p>
<ol>
<li>Create an account on Windows Azure Platform using your Windows Live Id. There is 90 days evaluation period available on Windows Azure that is free, additionaly the Access Control Services I will use as authnetication provider are free at least until December 2012. During the registration process you will be however asked to fill in you credit card number. For more information about pricing see <a href="https://www.windowsazure.com/en-us/pricing/details/">this</a>.</li>
<li>After you created your azure account go to the Windows Azure management portal  <a href="https://windows.azure.com/">https://windows.azure.com/</a>.</li>
<li>In the portal click &#8220;Services Bus, Access Control &amp; Caching &#8221; and then &#8220;Access Control&#8221;. See following picture</li>
<li><a href="http://vojtan.files.wordpress.com/2011/12/management1.png"><img class="alignnone size-full" title="management1" src="http://vojtan.files.wordpress.com/2011/12/management1.png?w=450" alt="" /></a></li>
<li>Click new to create a new namespace and select a unique name for the namespace and the region where your server exists and click &#8220;Create namespace&#8221; button</li>
<li>Wait until the namespace is activated. It takes several minutes</li>
<li>Click the newly created namespace and then &#8220;Access Control Service&#8221;</li>
<li>Click &#8220;Identity providers&#8221; and add the providers that should be used in your SharePoint site collection for the authentication. See folllowing image.</li>
<li><a href="http://vojtan.files.wordpress.com/2011/12/management2.png"><img class="alignnone   wp-image-262" title="management2" src="http://vojtan.files.wordpress.com/2011/12/management2.png?w=450" alt="" /></a></li>
<li>Click Relying party application button in the left tab and add a new Relying application and fill the form as marked in the following image. The url should be the url of your sharepoint web application.</li>
<li><a href="http://vojtan.files.wordpress.com/2011/12/management3.png"><img class="alignnone size-full" title="management3" src="http://vojtan.files.wordpress.com/2011/12/management3.png?w=450" alt="" /></a></li>
<li>Also check the &#8220;Create new rule group&#8221;</li>
<li>Now click the &#8220;Rule groups&#8221; and click Generate. The form should look like this afterwards:</li>
<li><a href="http://vojtan.files.wordpress.com/2011/12/management4.png"><img class="alignnone size-full  wp-image-264" title="management4" src="http://vojtan.files.wordpress.com/2011/12/management4.png?w=450" alt="" /></a></li>
<li>Click save.</li>
<li>Click  &#8220;Application Integration&#8221; under &#8220;Development&#8221; tab. Then &#8220;Login pages&#8221; and then your relying service application.</li>
<li>Copy the content of the textbox und option 1. It should look like this <a href="https://vnanamespace2.accesscontrol.windows.net:443/v2/wsfederation?wa=wsignin1.0&amp;wtrealm=http%3a%2f%2fsharepoint2010%2f">https://yournamespace.accesscontrol.windows.net:443/v2/wsfederation?wa=wsignin1.0&amp;wtrealm=http%3a%2f%2fsharepoint2010%2f</a></li>
<li>For now you are done with the azure platform configuration. Now go to your SharePoint server where should be the claims authentication enabled.</li>
</ol>
<p>Create and export new certificate</p>
<ol>
<li>Run following command &#8220;MakeCert.exe -r -pe -n &#8220;CN=&lt;yournamespace&gt;.accesscontrol.windows.net&#8221; -sky exchange -ss my&#8221;. The Makecert.exe can you find in this folder: C:\Program Files\Microsoft Office Servers\14.0\Tools</li>
<li>Here <a href="http://msdn.microsoft.com/en-us/library/gg185932.aspx">http://msdn.microsoft.com/en-us/library/gg185932.aspx</a>  you can find a description how to export the newly created certificate for the communication betwen SharePoint and Azure.</li>
<li>Once you have the file go back to Azure platform to your namespace and click &#8220;Certificates and keys&#8221; and click &#8220;Add&#8221; button in the &#8220;Token signing&#8221; section.</li>
<li>Upload the exported certificate and leave the other setings to default</li>
</ol>
<p>Configure SharePoint to use claims<br />
Run following script. Replace following things:</p>
<ol>
<li>Path to the certificate</li>
<li>Password of the certificate</li>
<li>$realm (it is the Url you gave in the Relying Application Settings as Realm). Mind the slashes.</li>
<li>$signinurl It is the url from step 17</li>
<li>The names of the providers.</li>
</ol>
<p><pre class="brush: powershell;">

Add-PSSnapin &quot;Microsoft.SharePoint.PowerShell&quot;

$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2(&quot;yourcertificatename.pfx&quot;,&quot;yourpassword&quot;)

$map1 = New-SPClaimTypeMapping &quot;http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress&quot; -IncomingClaimTypeDisplayName &quot;Email&quot; -SameAsIncoming

$realm = &quot;http://sharepoint2010/&quot;

$signinurl = &quot;https://yournamespace.accesscontrol.windows.net:443/v2/wsfederation?wa=wsignin1.0&amp;wtrealm=http%3a%2f%2fsharepoint2010%2f&quot;

New-SPTrustedIdentityTokenIssuer -Name &quot;Azure ACS&quot; -Description &quot;Windows Azure ACS v2&quot; -Realm $realm -ImportTrustCertificate $cert -ClaimsMappings $map1 -SignInUrl $signinurl -IdentifierClaim $map1.InputClaimType

New-SPTrustedRootAuthority -Name &quot;Azure Test Token Signing&quot; -Certificate $cert

$issuer = Get-SPTrustedIdentityTokenIssuer
$authority = Get-SPTrustedRootAuthority
$issuer.ProviderUri = $signinurl
$issuer.Update
</pre></p>
<p>Check if the things work:</p>
<ol>
<li>Open central administration and open Web application</li>
<li>Click Create new Web application</li>
<li>Switch to claims authentication</li>
<li>Check the &#8220;Azure ACS&#8221;</li>
<li>Create new web application</li>
<li>Create new site collection</li>
<li>Set the permissions on the site collection that the users have access to the site collection</li>
<li>Log in with your Google Id to the site collection</li>
</ol>
<p>References: <a href="https://blogs.pointbridge.com/Blogs/nielsen_travis/Pages/Post.aspx?_ID=38"> Travis Nielsen blog</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vojtan.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vojtan.wordpress.com/260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vojtan.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vojtan.wordpress.com/260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vojtan.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vojtan.wordpress.com/260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vojtan.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vojtan.wordpress.com/260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vojtan.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vojtan.wordpress.com/260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vojtan.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vojtan.wordpress.com/260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vojtan.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vojtan.wordpress.com/260/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=260&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vojtan.wordpress.com/2011/12/11/google-idwindows-authentication-in-sharepoint-2010-using-windows-azure/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6a445344b4cf0792c5d1014646391e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vojtan</media:title>
		</media:content>

		<media:content url="http://vojtan.files.wordpress.com/2011/12/management1.png" medium="image">
			<media:title type="html">management1</media:title>
		</media:content>

		<media:content url="http://vojtan.files.wordpress.com/2011/12/management2.png" medium="image">
			<media:title type="html">management2</media:title>
		</media:content>

		<media:content url="http://vojtan.files.wordpress.com/2011/12/management3.png" medium="image">
			<media:title type="html">management3</media:title>
		</media:content>

		<media:content url="http://vojtan.files.wordpress.com/2011/12/management4.png" medium="image">
			<media:title type="html">management4</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating Secure Store Service Application through Powershell</title>
		<link>http://vojtan.wordpress.com/2011/11/24/creating-secure-store-service-application-through-powershell/</link>
		<comments>http://vojtan.wordpress.com/2011/11/24/creating-secure-store-service-application-through-powershell/#comments</comments>
		<pubDate>Thu, 24 Nov 2011 18:07:27 +0000</pubDate>
		<dc:creator>vojtan</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://vojtan.wordpress.com/?p=251</guid>
		<description><![CDATA[SSSA is a good way how to store credentials for accessing external systems. Here is a script that will help you to create such a service application through powershell. Thanks to the codeplex project autospinstaller for the inspiration.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=251&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>SSSA is a good way how to store credentials for accessing external systems.<br />
Here is a script that will help you to create such a service application through powershell.<br />
Thanks to the codeplex project <a href="http://autospinstaller.codeplex.com/">autospinstaller</a> for the inspiration.<br />
<pre class="brush: powershell; wrap-lines: false;">
Add-PsSnapin Microsoft.SharePoint.PowerShell
$serviceApplicationPool  = &quot;SecurityTokenServiceApplicationPool&quot; #name of the application pool under which the application should run
$secureStoreDatabaseName  = &quot;SecureStoreServiceDatabase&quot; #the sharepoint database where the service app will store the data
$secureStoreApplicationName  =&quot;Secure Store Service Application&quot; #name of the service application
$secureStoreApplicationProxyName  =&quot;Secure Store Service Application Proxy&quot; #name of the service application proxy
$secureStoreAdministrator = &quot;domain\administrator&quot; #the administrator of the application
$secureStoreUser = &quot;domain\user&quot; #the group or user that will have access to service application. I use the group configuration
$secureStoreAdministratorEmail = &quot;adminemail&quot; #email of the administrator
$serviceContext = &quot;http://localhost&quot; # the url for getting the service application context
$targeApplicationUserName= &quot;administrator&quot; #user name which will be used to access the external application
$targetApplicationUserPassword = &quot;password&quot;
#password which will be used to access the external application
$passPhrase = &quot;PassPhrase&quot; #passphrase for securing the application

If ($secureStoreApplicationName -eq $null) {$secureStoreApplicationName = &quot;State Service Application&quot;}
# Get the service instance
$SecureStoreServiceInstances = Get-SPServiceInstance | ? {$_.GetType().Equals([Microsoft.Office.SecureStoreService.Server.SecureStoreServiceInstance])}
$SecureStoreServiceInstance = $SecureStoreServiceInstances | ? {$_.Server.Address -eq $env:COMPUTERNAME}
If (-not $?) { Throw &quot; - Failed to find Secure Store service instance&quot; }
# Start Service instance
If ($SecureStoreServiceInstance.Status -eq &quot;Disabled&quot;)
{
	Write-Host  &quot; - Starting Secure Store Service Instance...&quot;
	$SecureStoreServiceInstance.Provision()
	If (-not $?) { Throw &quot; - Failed to start Secure Store service instance&quot; }
	# Wait
	Write-Host  &quot; - Waiting for Secure Store service...&quot; -NoNewline
	While ($SecureStoreServiceInstance.Status -ne &quot;Online&quot;)
	{
	   Write-Host  &quot;.&quot; -NoNewline
		Start-Sleep 1
		$SecureStoreServiceInstances = Get-SPServiceInstance | ? {$_.GetType().ToString() -eq &quot;Microsoft.Office.SecureStoreService.Server.SecureStoreServiceInstance&quot;}
		$SecureStoreServiceInstance = $SecureStoreServiceInstances | ? {$_.Server.Address -eq $env:COMPUTERNAME}
	}
	Write-Host  $($SecureStoreServiceInstance.Status)
}
			# Create Service Application
			$GetSPSecureStoreServiceApplication = Get-SPServiceApplication | ? {$_.GetType().Equals([Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplication])}
			If ($GetSPSecureStoreServiceApplication -eq $Null)
			{
				Write-Host  &quot; - Creating Secure Store Service Application...&quot;
				New-SPSecureStoreServiceApplication -Name $secureStoreApplicationName -PartitionMode:$false -Sharing:$false -DatabaseName $secureStoreDatabaseName -ApplicationPool $serviceApplicationPool -AuditingEnabled:$true -AuditLogMaxSize 30 | Out-Null
				Write-Host  &quot; - Creating Secure Store Service Application Proxy...&quot;
				Get-SPServiceApplication | ? {$_.GetType().Equals([Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplication])} | New-SPSecureStoreServiceApplicationProxy -Name $secureStoreApplicationProxyName -DefaultProxyGroup | Out-Null
				Write-Host  &quot; - Done creating Secure Store Service Application.&quot;
			}
			Else {Write-Host  &quot; - Secure Store Service Application already provisioned.&quot;}

			$secureStore = Get-SPServiceApplicationProxy | Where {$_.GetType().Equals([Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplicationProxy])}
			Start-Sleep 5
			Write-Host  &quot; - Creating the Master Key...&quot;
			Update-SPSecureStoreMasterKey -ServiceApplicationProxy $secureStore.Id -Passphrase $passPhrase
			Start-Sleep 5
			Write-Host  &quot; - Creating the Application Key...&quot;
			Update-SPSecureStoreApplicationServerKey -ServiceApplicationProxy $secureStore.Id -Passphrase $passPhrase -ErrorAction SilentlyContinue

$usernameField = New-SPSecureStoreApplicationField –Name “UserName” -Type UserName –Masked:$false
$passwordField = New-SPSecureStoreApplicationField –Name “Password” –Type Password –Masked:$true
$fields = $usernameField,$passwordField

$adminClaim = New-SPClaimsPrincipal –Identity $secureStoreAdministrator –IdentityType  WindowsSamAccountName
$userClaim = New-SPClaimsPrincipal –Identity $secureStoreUser –IdentityType  WindowsSamAccountName
$targetApp = new-spsecurestoretargetapplication -name &quot;externalApplication&quot; -friendlyname &quot;externalApplication&quot; -contactemail $secureStoreAdministratorEmail -applicationtype Group -timeoutinminutes 3
$ssApp = New-SPSecureStoreApplication –ServiceContext $serviceContext –TargetApplication $targetApp –Field$fields –Administrator $adminClaim -CredentialsOwnerGroup $userClaim
$firstCredential = ConvertTo-SecureString $targeApplicationUserName –AsPlainText –Force
$secondCredential = ConvertTo-SecureString $targeApplicationUserPassword –AsPlainText –Force
$credentialValues = $firstCredential,$secondCredential
Update-SPSecureStoreGroupCredentialMapping  –Identity $ssApp –Values $credentialValues
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vojtan.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vojtan.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vojtan.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vojtan.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vojtan.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vojtan.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vojtan.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vojtan.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vojtan.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vojtan.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vojtan.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vojtan.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vojtan.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vojtan.wordpress.com/251/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=251&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vojtan.wordpress.com/2011/11/24/creating-secure-store-service-application-through-powershell/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6a445344b4cf0792c5d1014646391e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vojtan</media:title>
		</media:content>
	</item>
		<item>
		<title>Start content type synchronisation from within a feature</title>
		<link>http://vojtan.wordpress.com/2011/11/07/start-content-type-synchronisation-from-within-a-feature/</link>
		<comments>http://vojtan.wordpress.com/2011/11/07/start-content-type-synchronisation-from-within-a-feature/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 07:53:23 +0000</pubDate>
		<dc:creator>vojtan</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Content Type Hub]]></category>

		<guid isPermaLink="false">http://vojtan.wordpress.com/?p=246</guid>
		<description><![CDATA[The standard way to consume the content types from content type hub in your site collection. It is described for example here.  If you want  the content types available direct during creating of the site collection, this will not work for you. You try to start the Timer Job programmatically, but you will receive access [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=246&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The standard way to consume the content types from content type hub in your site collection. It is described for example <a href="http://njbblog.blogspot.com/2011/05/sharepoint-40-content-type-hub.html">here</a>.  If you want  the content types available direct during creating of the site collection, this will not work for you. You try to start the Timer Job <a href="http://sakarih.wordpress.com/2009/03/10/starting-custom-timer-job-programmatically/">programmatically</a>, but you will receive access denied exception. Because starting timer jobs is not allowed during feature activation. Here is a sample how you can consume content types immediately only for a specific site collection without permissions problems. However it includes a little bit of reflection.</p>
<p><pre class="brush: csharp;">
using System;
using Microsoft.SharePoint;
using System.Reflection;

namespace NameSpace
{
public class ContentTypeSubscriber
{
public void Execute(SPSite site)
{
var taxonomyAssembly = Assembly.Load(&quot;Microsoft.SharePoint.Taxonomy, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&quot;);
var subscriberType = taxonomyAssembly.GetType(&quot;Microsoft.SharePoint.Taxonomy.ContentTypeSync.Internal.Subscriber&quot;);

var processSiteMethodInfo = subscriberType.GetMethod(&quot;ProcessSite&quot;,
BindingFlags.NonPublic | BindingFlags.Instance,
null,
new[] { typeof(SPSite) },
null);

var subscriberTypeConstructor = subscriberType.GetConstructor(
BindingFlags.NonPublic | BindingFlags.Instance,
null, new Type[] { }, null
);

var subscriberInstance = subscriberTypeConstructor.Invoke(new object[] { });
processSiteMethodInfo.Invoke(subscriberInstance, new Object[] { site });
}
}
}

</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vojtan.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vojtan.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vojtan.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vojtan.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vojtan.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vojtan.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vojtan.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vojtan.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vojtan.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vojtan.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vojtan.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vojtan.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vojtan.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vojtan.wordpress.com/246/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=246&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vojtan.wordpress.com/2011/11/07/start-content-type-synchronisation-from-within-a-feature/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6a445344b4cf0792c5d1014646391e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vojtan</media:title>
		</media:content>
	</item>
		<item>
		<title>Restoring site or list from a full farm backup</title>
		<link>http://vojtan.wordpress.com/2011/06/12/restoring-site-or-list-from-a-full-farm-backup/</link>
		<comments>http://vojtan.wordpress.com/2011/06/12/restoring-site-or-list-from-a-full-farm-backup/#comments</comments>
		<pubDate>Sun, 12 Jun 2011 20:20:05 +0000</pubDate>
		<dc:creator>vojtan</dc:creator>
				<category><![CDATA[Backup and Recovery]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Backup and Recorvery]]></category>

		<guid isPermaLink="false">http://vojtan.wordpress.com/?p=239</guid>
		<description><![CDATA[This post covers a scenario, when a user makes some irreversible changes and the only place where the undamaged data is, is the farm full backup. The scenarios can be list deletion, site deletion, permissions damage etc. So here are the instructions: Locate the folder where your farm full backup is and open the file [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=239&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post covers a scenario, when a user makes some irreversible changes and the only place where the undamaged data is, is the farm full backup. The scenarios can be list deletion, site deletion, permissions damage etc.<br />
So here are the instructions:</p>
<ol>
<li>Locate the folder where your farm full backup is and open the file spbackup.xml</li>
<li>Find the content database name in the file and in the found node  locate a line that looks like this:<br />
<pre class="brush: xml;">
&lt;SPParameter Key=&quot;SHAREPOINT2010:WSS_Content.dat&quot;&gt;&lt;![CDATA[00000055.bak]]&gt;&lt;/SPParameter&gt;
</pre></li>
<li>00000055.bak is the name of the database backup of the content database.</li>
<li>Go to SQL Management Studio and create a new database.</li>
<li>Perform a restore into this database from the backup file mentioned above. You have to change the name of the ldf and mdf file and check the &#8220;overwrite the existing database&#8221; checkbox.</li>
<li>Now open the Central administration. Click &#8220;Backup and Restore&#8221; tab and then &#8220;Recover data from an unattached content database&#8221; link.</li>
<li>Type in the name of the currently restored database and click Next.</li>
<li>Navigate to a list / site collection that you want to restore and click Next.</li>
<li>On the following page type in where you want to store the exported data of the list / site collection and click Next.</li>
<li>When the backup is created use the Import-SPWeb command to restore the data. The command should look like this:</li>
</ol>
<p><pre class="brush: csharp;">
Import-SPWeb -Path C:\temp\backup.bak -Identity http://localhost
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vojtan.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vojtan.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vojtan.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vojtan.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vojtan.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vojtan.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vojtan.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vojtan.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vojtan.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vojtan.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vojtan.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vojtan.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vojtan.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vojtan.wordpress.com/239/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=239&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vojtan.wordpress.com/2011/06/12/restoring-site-or-list-from-a-full-farm-backup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6a445344b4cf0792c5d1014646391e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vojtan</media:title>
		</media:content>
	</item>
		<item>
		<title>RunWithElevatedPrivileges throws Access Denied Exception</title>
		<link>http://vojtan.wordpress.com/2011/05/08/runwithelevatedprivileges-throws-access-denied-exception/</link>
		<comments>http://vojtan.wordpress.com/2011/05/08/runwithelevatedprivileges-throws-access-denied-exception/#comments</comments>
		<pubDate>Sun, 08 May 2011 12:52:58 +0000</pubDate>
		<dc:creator>vojtan</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Permissions]]></category>

		<guid isPermaLink="false">http://vojtan.wordpress.com/?p=225</guid>
		<description><![CDATA[There are more reasons why you can receive this exception. The obvious one is that you use SPContext in the elevated block. For more info see this post . I will  describe a less obvious reason in following article. The RunWithElevatedPrivileges method runs the code under the account of the application pool. In the productive environments has [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=225&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There are more reasons why you can receive this exception. The obvious one is that you use SPContext in the elevated block. For more info see <a title="this post" href="http://vojtan.wordpress.com/wp-admin/post-new.php">this post</a> . I will  describe a less obvious reason in following article. The RunWithElevatedPrivileges method runs the code under the account of the application pool. In the productive environments has the application pool account only limited privileges. Generally the permissions are so defined that you can do anything you want in the current site however if you try to run e.g following code:<br />
<pre class="brush: csharp;">
var webApp = SPWebApplication.Lookup(new Uri(&quot;http://localhost/sites&quot;));
webApp.Sites.Add(&quot;http://localhost/sites/&quot;, &quot;user&quot;, &quot;email&quot;);
</pre><br />
you will receive the access denied exception. So how to solve this problem:</p>
<ol>
<li>Define an account that has only the needed permissions to perform the desired operation. In this specific scenario, you can define a user that has <a href="http://technet.microsoft.com/en-us/library/cc261685.aspx">self service site creation</a> permissions and modify the code that it uses self service site creation.</li>
<li>Run the code, that throws exception under the specified account. You can achieve this for example so, that you open the SPSite impersonated. See <a href="http://msdn.microsoft.com/en-us/library/ms469253.aspx">this</a>.</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vojtan.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vojtan.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vojtan.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vojtan.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vojtan.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vojtan.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vojtan.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vojtan.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vojtan.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vojtan.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vojtan.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vojtan.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vojtan.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vojtan.wordpress.com/225/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=225&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vojtan.wordpress.com/2011/05/08/runwithelevatedprivileges-throws-access-denied-exception/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6a445344b4cf0792c5d1014646391e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vojtan</media:title>
		</media:content>
	</item>
		<item>
		<title>SSD Disks and SharePoint 2010</title>
		<link>http://vojtan.wordpress.com/2011/02/08/performance-issd-disk-and-sharepoint-2010/</link>
		<comments>http://vojtan.wordpress.com/2011/02/08/performance-issd-disk-and-sharepoint-2010/#comments</comments>
		<pubDate>Tue, 08 Feb 2011 13:43:25 +0000</pubDate>
		<dc:creator>vojtan</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[SSD]]></category>
		<category><![CDATA[Virtualization]]></category>

		<guid isPermaLink="false">http://vojtan.wordpress.com/?p=214</guid>
		<description><![CDATA[I have recently set up a new virtualized SharePoint development machine with a SSD Disk (Model Kingston 128GB SSDNow V-Series V+ SATA2 2.5).  I measured the time it takes to load a start page of a site collection after iisreset. The virtualization software was virtual box. The tested site collection was Enterprise Wiki. Here is the configuration of the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=214&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have recently set up a new virtualized SharePoint development machine with a SSD Disk (Model Kingston 128GB SSDNow V-Series V+ SATA2 2.5).  I measured the time it takes to load a start page of a site collection after iisreset. The virtualization software was virtual box. The tested site collection was Enterprise Wiki. Here is the configuration of the systems:<br />
Host system</p>
<ul>
<li>Windows 7 64bit</li>
<li>8GB RAM</li>
</ul>
<p>Virtualized Server</p>
<ul>
<li>Windows 2008 Server 64bit R2</li>
<li>SharePoint 2010</li>
<li>4GB RAM</li>
</ul>
<p>Here are the results</p>
<table border="1">
<tbody>
<tr>
<td>System</td>
<td>Time (seconds) </td>
</tr>
<tr>
<td>with SSD disk</td>
<td>8</td>
</tr>
<tr>
<td>with standard disk</td>
<td>32 </td>
</tr>
</tbody>
</table>
<p>Pretty impressive</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vojtan.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vojtan.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vojtan.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vojtan.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vojtan.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vojtan.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vojtan.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vojtan.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vojtan.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vojtan.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vojtan.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vojtan.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vojtan.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vojtan.wordpress.com/214/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=214&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vojtan.wordpress.com/2011/02/08/performance-issd-disk-and-sharepoint-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6a445344b4cf0792c5d1014646391e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vojtan</media:title>
		</media:content>
	</item>
		<item>
		<title>DisplayName of SPField is not set</title>
		<link>http://vojtan.wordpress.com/2010/10/28/displayname-of-spfield-is-not-set/</link>
		<comments>http://vojtan.wordpress.com/2010/10/28/displayname-of-spfield-is-not-set/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 13:25:04 +0000</pubDate>
		<dc:creator>vojtan</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://vojtan.wordpress.com/?p=210</guid>
		<description><![CDATA[Today I came across rather interesting &#8220;feature&#8221; in SharePoint 2010. I created a new LookupField programmatically and set the Title to a value. This value was however not used. The internal name was used in the display. The more i So after some digging in .Net Reflector I came up with this. The setter of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=210&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today I came across rather interesting &#8220;feature&#8221; in SharePoint 2010. I created a new LookupField programmatically and set the Title to a value. This value was however not used. The internal name was used in the display. The more i</p>
<p>So after some digging in .Net Reflector I came up with this. The setter of the Title property is implemented like this:</p>
<p><pre class="brush: csharp;">
public void set_Title(string value)
{
	if (!this.Title.Equals(value, StringComparison.Ordinal))
	{
		if (this.TitleResource != null)
		{
			this.TitleResource.Value = value;
		}
		if (CultureInfo.CurrentUICulture.LCID == this.Web.UICulture.LCID)
		{
			this.SetFieldAttributeValue(&quot;DisplayName&quot;, value);
		}
		else
		if (this.TitleResource != null)
		{
			this.SetFieldAttributeValue(&quot;DisplayName&quot;, this.TitleResource.GetValueForUICulture(this.Fields.Web.UICulture));
		}
	}
}
</pre></p>
<p>So the reason why this does not work is that I had a german site collection where and the server was english. In this case is the DiplayName not set. Cool<br />
For comparison how it is implemented in SharePoint 2007:</p>
<p><pre class="brush: csharp;">
public void set_Title(string value)
{
	this.SetFieldAttributeValue(&quot;DisplayName&quot;, value);
}
</pre></p>
<p>As you can see this could not have happened in the old version.<br />
The solution is as follows. Switch the culture of the CurrentThread to the language of the SPWeb you want to work with.<br />
Or do it through reflection</p>
<p><pre class="brush: csharp;">
private static void SetFieldDisplayName(SPFieldLookup continuingProjectLookup, string displayName)
{
	Type baseType = continuingProjectLookup.GetType().BaseType;
	object obj = baseType.InvokeMember(&quot;SetFieldAttributeValue&quot;, BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance,	null, continuingProjectLookup, new object[] { &quot;DisplayName&quot;, displayName });
	continuingProjectLookup.Update();
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vojtan.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vojtan.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vojtan.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vojtan.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vojtan.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vojtan.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vojtan.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vojtan.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vojtan.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vojtan.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vojtan.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vojtan.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vojtan.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vojtan.wordpress.com/210/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=210&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vojtan.wordpress.com/2010/10/28/displayname-of-spfield-is-not-set/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6a445344b4cf0792c5d1014646391e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vojtan</media:title>
		</media:content>
	</item>
		<item>
		<title>Quick tips for using Powershell in SharePoint</title>
		<link>http://vojtan.wordpress.com/2010/10/12/quick-tips-for-using-powershell-in-sharepoint/</link>
		<comments>http://vojtan.wordpress.com/2010/10/12/quick-tips-for-using-powershell-in-sharepoint/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 10:50:54 +0000</pubDate>
		<dc:creator>vojtan</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://vojtan.wordpress.com/?p=205</guid>
		<description><![CDATA[Here are some helpful powershell commands that I am afraid that I will forget: This powershell command will install PowerShell ISE. A Pretty tool for editing powershell scripts: Import-Module ServerManager;Add-WindowsFeature PowerShell-ISE This powershell command will enable SharePoint commands: Add-PsSnapin Microsoft.SharePoint.PowerShell This command opens a new SPSite and root SPWeb $spsite = new-object Microsoft.SharePoint.SPSite(&#8220;http://localhost&#8221;) $spweb = $spsite.OpenWeb()<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=205&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here are some helpful powershell commands that I am afraid that I will forget:</p>
<p>This powershell command will install PowerShell ISE. A Pretty tool for editing powershell scripts:</p>
<p>Import-Module ServerManager;Add-WindowsFeature PowerShell-ISE</p>
<p>This powershell command will enable SharePoint commands:</p>
<p>Add-PsSnapin Microsoft.SharePoint.PowerShell</p>
<p>This command opens a new SPSite and root SPWeb</p>
<p>$spsite = new-object Microsoft.SharePoint.SPSite(&#8220;http://localhost&#8221;)</p>
<p>$spweb = $spsite.OpenWeb()</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vojtan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vojtan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vojtan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vojtan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vojtan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vojtan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vojtan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vojtan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vojtan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vojtan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vojtan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vojtan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vojtan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vojtan.wordpress.com/205/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=205&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vojtan.wordpress.com/2010/10/12/quick-tips-for-using-powershell-in-sharepoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6a445344b4cf0792c5d1014646391e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vojtan</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating Loops in SharePoint Designer 2010 Workflows</title>
		<link>http://vojtan.wordpress.com/2010/10/07/creating-loops-in-sharepoint-designer-2010-workflows/</link>
		<comments>http://vojtan.wordpress.com/2010/10/07/creating-loops-in-sharepoint-designer-2010-workflows/#comments</comments>
		<pubDate>Thu, 07 Oct 2010 07:13:15 +0000</pubDate>
		<dc:creator>vojtan</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[SharePoint Designer]]></category>
		<category><![CDATA[Workflows]]></category>

		<guid isPermaLink="false">http://vojtan.wordpress.com/?p=197</guid>
		<description><![CDATA[By default SPD 2010 does not allow possible infinite loops to be added to a workflow. Here is the guide how you can do it: Open SPD 2010 Add a new Workflow Add new IfElseActivity and fill in the conditions and the actions you want to loop through Save the workflow Go to Alle Files [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=197&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>By default SPD 2010 does not allow possible infinite loops to be added to a workflow. Here is the guide how you can do it:</p>
<ol>
<li>Open SPD 2010</li>
<li>Add a new Workflow</li>
<li>Add new IfElseActivity and fill in the conditions and the actions you want to loop through</li>
<li>Save the workflow</li>
<li>Go to Alle Files -&gt; Workflows -&gt; Your workflow name  folder and open  &#8221;your workflow name.xoml&#8221; file as xml.</li>
<li>Locate the lines that look like this:</li>
</ol>
<p><pre class="brush: xml;">

&lt;IfElseActivity x:Name=&quot;ID411&quot;&gt;

&lt;IfElseBranchActivity x:Name=&quot;ID412&quot;&gt;

&lt;IfElseBranchActivity.Condition&gt;

&lt;RuleConditionReference ConditionName=&quot;__Rule_ID412&quot; /&gt;

&lt;/IfElseBranchActivity.Condition&gt;

</pre></p>
<p>And replace if with something like this:</p>
<p><pre class="brush: xml;">

&lt;WhileActivity x:Name=&quot;ID411&quot;&gt;

&lt;WhileActivity.Condition&gt;

&lt;RuleConditionReference ConditionName=&quot;__Rule_ID412&quot; /&gt;

&lt;/WhileActivity.Condition&gt;

&amp;nbsp;

</pre></p>
<p>Keep in mind that you have to remove also the ending tag of the IfElseBranchActivity.  Keep also in mind that if you have multiple activities in the IfElseActivity taht you have to encapsulate these activities into one single SequenceActivity.</p>
<p>Now you can Publish your workflow back to SharePoint.</p>
<p>One drawback of this approach is that SPD does not support designing of a whileactivity in the worklow designer so you have to change the activities direct in the xoml file or you can replace the whileactivity again with ifelseactivity, do your changes and replace it again.</p>
<p>You have to also modify the web.config of the web app where you want to deploy your workflow because by default is the WhileActivity disabled. Locate following line</p>
<p><pre class="brush: xml;">

&lt;authorizedType Assembly=&quot;System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&quot; Namespace=&quot;System.Workflow.*&quot; TypeName=&quot;WhileActivity&quot; Authorized=&quot;False&quot; /&gt;

</pre></p>
<p>and set the &#8220;Authorized&#8221; attribute to True.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vojtan.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vojtan.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vojtan.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vojtan.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vojtan.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vojtan.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vojtan.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vojtan.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vojtan.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vojtan.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vojtan.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vojtan.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vojtan.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vojtan.wordpress.com/197/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=197&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vojtan.wordpress.com/2010/10/07/creating-loops-in-sharepoint-designer-2010-workflows/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6a445344b4cf0792c5d1014646391e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vojtan</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding a Webpart to home.aspx during Site creating in Enterprise Wiki</title>
		<link>http://vojtan.wordpress.com/2010/09/08/adding-a-webpart-to-home-aspx-during-site-creating-in-enterprise-wiki/</link>
		<comments>http://vojtan.wordpress.com/2010/09/08/adding-a-webpart-to-home-aspx-during-site-creating-in-enterprise-wiki/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 16:09:51 +0000</pubDate>
		<dc:creator>vojtan</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Wiki]]></category>

		<guid isPermaLink="false">http://vojtan.wordpress.com/?p=190</guid>
		<description><![CDATA[Consider following scenario: Create a custom site template based on Enterprise Wiki (Publishing Site) and add a web part to the home page during site creating. The creating of the template is not tricky and you can find the description here.  The tricky part is actually adding the web part to the homepage. So here [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=190&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Consider following scenario:</p>
<p>Create a custom site template based on Enterprise Wiki (Publishing Site) and add a web part to the home page during site creating.</p>
<p>The creating of the template is not tricky and you can find the description <a href="http://www.sharepointbits.com/blog/sharepoint-2010-custom-site-templates.html">here</a>.  The tricky part is actually adding the web part to the homepage.</p>
<p>So here is how you can do it:</p>
<p>Delete the module that creates the home.aspx from the onet.xml. and create it manually in code behind (I used a feature receiver on a feature that is activated when the site is created. The method that adds the homepage can look like this.</p>
<p><pre class="brush: csharp;">
public static void AddHomePageToDocumentLibrary(SPWeb web, string pageContent)
{
        var pubWeb = PublishingWeb.GetPublishingWeb(web);
        var pageLayout = pubWeb.GetAvailablePageLayouts()[0];
        PublishingPage newPage = pubWeb.GetPublishingPages().Add(&quot;home.aspx&quot;, pageLayout);
        newPage.ListItem[FieldId.PublishingPageContent] = pageContent;
        newPage.ListItem.Update();
        newPage.Update();
}
</pre></p>
<p>The page content should contain following div:</p>
<p><pre class="brush: xml;">
&lt;div class='ms-rtestate-read ms-rte-wpbox' contentEditable='false'&gt;&lt;div class='ms-rtestate-read d127f8fd-2a2e-4495-9e0f-d32d5ca2e5c7' id='div_d127f8fd-2a2e-4495-9e0f-d32d5ca2e5c7'&gt;&lt;/div&gt;&lt;div style='display:none' id='vid_d127f8fd-2a2e-4495-9e0f-d32d5ca2e5c7'&gt;&lt;/div&gt;&lt;/div&gt;
</pre></p>
<p>This div is by run time replaced with an actual webpart. The guid d127f8fd-2a2e-4495-9e0f-d32d5ca2e5c7 is important as it identifies the webpart that should be added to the page.</p>
<p>Finally we have to add the webpart to the webpart zone.</p>
<p><pre class="brush: csharp;">

public static void AddWebPartToHomePage(System.Web.UI.WebControls.WebParts.WebPart webPart, SPWeb web, Guid webpartId)
        {
            using (SPLimitedWebPartManager mgr = web.GetLimitedWebPartManager(&quot;seiten/home.aspx&quot;, PersonalizationScope.Shared))
            {
                string storageKeyId = StorageKeyToID(webpartId);
                webPart.ID = storageKeyId;
                mgr.AddWebPart(webPart, &quot;wpz&quot;, 0);
            }
        }

private static string StorageKeyToID(Guid storageKey)
        {
            if (!(Guid.Empty == storageKey))
            {
                return (&quot;g_&quot; + storageKey.ToString().Replace('-', '_'));
            }
            return string.Empty;
        }

</pre></p>
<p>The webpart is the webpart we want to add, web is the web that we create and the guid is the guid that identifies the webpart. In our case it is d127f8fd-2a2e-4495-9e0f-d32d5ca2e5c7. The &#8220;wpz&#8221; zone is the hidden webpart zone that SharePoint 2010 uses to store inline webparts.</p>
<p>I tried to create these webparts in onet.xml, but it did not work. The webparts were simply not displayed, though all attributes were filled.</p>
<p>References</p>
<p><a href="http://donalconlon.wordpress.com/2010/05/04/sp2010-creating-a-wiki-page-using-the-om/">http://donalconlon.wordpress.com/2010/05/04/sp2010-creating-a-wiki-page-using-the-om/</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vojtan.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vojtan.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vojtan.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vojtan.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vojtan.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vojtan.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vojtan.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vojtan.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vojtan.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vojtan.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vojtan.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vojtan.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vojtan.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vojtan.wordpress.com/190/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vojtan.wordpress.com&amp;blog=5400803&amp;post=190&amp;subd=vojtan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vojtan.wordpress.com/2010/09/08/adding-a-webpart-to-home-aspx-during-site-creating-in-enterprise-wiki/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6a445344b4cf0792c5d1014646391e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vojtan</media:title>
		</media:content>
	</item>
	</channel>
</rss>
