<?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/"
	>

<channel>
	<title>Olav Aukan</title>
	<atom:link href="http://www.olavaukan.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.olavaukan.com</link>
	<description>Getting information off the Internet is like taking a drink from a fire hydrant...</description>
	<lastBuildDate>Tue, 16 Apr 2013 17:09:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>How To Backup And Restore IIS 7 Metabase With PowerShell</title>
		<link>http://www.olavaukan.com/2011/03/how-to-backup-and-restore-iis-7-metabase-with-powershell/</link>
		<comments>http://www.olavaukan.com/2011/03/how-to-backup-and-restore-iis-7-metabase-with-powershell/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 13:32:02 +0000</pubDate>
		<dc:creator>Olav Aukan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.olavaukan.com/?p=398</guid>
		<description><![CDATA[As I mentioned in my last blog post I've been playing around with PowerShell for SharePoint automation for a while now. One of the problems with SharePoint is it's complicated architecture that makes a seemingly simple task - backing up the system - incredibly complicated. The complexity often comes from the fact that there are [...]]]></description>
				<content:encoded><![CDATA[<p>As I mentioned in my last blog post I've been playing around with PowerShell for SharePoint automation for a while now. One of the problems with SharePoint is it's complicated architecture that makes a seemingly simple task - backing up the system - incredibly complicated. The complexity often comes from the fact that there are so many options to choose from. There are SQL backups of the content databases, Stsadm.exe backups of whole or parts of the farm, VMWare snapshots of the server (which by the way is not supported by Microsoft), file backups of the 12 hive, solution file backups, web.config backups, IIS backups, third party backup solutions that do some or all of these things etc. etc. etc.</p>
<p>This blog post is not going to solve those issues for you, but it will at least give you one part of the puzzle: how to backup and restore the IIS metabase with PowerShell.</p>
<pre class="brush: xml; title: ; notranslate">
# This function performs a backup of the IIS Metabase
function SP-Backup-IIS {

	param (
		[Parameter(Mandatory=$true, ValueFromPipeline=$true, Position=0)]
		[string]
		$BackupFolder		
	)
	
	process {
	
		UI-PrintAction &quot;Attempting to backup the Internet Information Services Metabase&quot;
		
		Write-Host &quot;Checking IIS version...&quot;
		Write-Host
		
		$IISVersion = (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\InetStp | select SetupString, *Version*)
		
		Write-Host &quot;IIS Version:&quot;
		$IISVersion
		Write-Host
		
		$ComputerName = Get-Content Env:Computername
		$Time = [DateTime]::Now.ToString().Replace(&quot;:&quot;,&quot;.&quot;).Replace(&quot; &quot;,&quot;_&quot;)
		$BackupName = &quot;IIS-Metadata-$ComputerName-$Time&quot;
		$BackupFileName = &quot;$BackupName.zip&quot;
		
	    switch ($IISVersion.MajorVersion) 
		{
			# IIS 7
			7 {
				$BackupFilePath = Join-Path -Path $BackupFolder -ChildPath $BackupFileName

				Write-Host &quot;Starting backup of IIS metadata.&quot;
				Write-Host
				
				#Perform backup
				&amp; $env:windir\system32\inetsrv\appcmd.exe add backup $BackupName				
				
				#Zip and copy backup to destination
				$IISRootBackupFolder = Get-Item $env:windir\system32\inetsrv\backup
				$IISBackupFolder = Join-Path -Path $IISRootBackupFolder -ChildPath $BackupName								
				Zip-Compress-Folder $IISBackupFolder $BackupFilePath
												
				Write-Host &quot;Backup Complete&quot;
			}
			
			# Other version of IIS
			default { Write-Host &quot;This version of IIS is not supported in this script.&quot; -ForegroundColor Yellow }
		}
		Write-Host
	}
}

# This function restores a backup of the IIS Metabase
function SP-Restore-IIS {

	param (
		[Parameter(Mandatory=$true, ValueFromPipeline=$true, Position=0)]
		[string]
		$BackupName		
	)
	
	process {
	
		UI-PrintAction &quot;Attempting to restore the Internet Information Services Metabase&quot;
		
		Write-Host &quot;Checking IIS version...&quot;
		Write-Host
		
		$IISVersion = (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\InetStp | select SetupString, *Version*)
		
		Write-Host &quot;IIS Version:&quot;
		$IISVersion
		Write-Host
				
	    switch ($IISVersion.MajorVersion) 
		{
			# IIS 7
			7 {

				Write-Host &quot;Starting restore of IIS metadata.&quot;
				Write-Host
				
				#Perform restore
				&amp; $env:windir\system32\inetsrv\appcmd.exe restore backup $BackupName				
								
				Write-Host
				Write-Host &quot;Restore Complete&quot;
			}
			
			#Other version of IIS
			default { Write-Host &quot;This version of IIS is not supported in this script.&quot; -ForegroundColor Yellow }
		}
		Write-Host
	}
}


# This function zips the contents of a folder
function Zip-Compress-Folder { 

	param (
		[Parameter(Mandatory=$true, ValueFromPipeline=$true, Position=0)]
		[string]
		$SourceFolder,		

		[Parameter(Mandatory=$true, ValueFromPipeline=$true, Position=1)]
		[string]
		$ZipFileName		
	)
	
	process {
		
		Write-Host
		Write-Host &quot;Creating new zip file.&quot;
		Write-Host
		Write-Host &quot;Source: $SourceFolder&quot;
		Write-Host &quot;Destination: $ZipFileName&quot;
		Write-Host
		
		$ParentFolder = (Get-Item $SourceFolder).Parent.FullName
		
		# Check if file exists
		if (test-path $ZipFileName) { 
		  Write-Host &quot;The file $ZipFileName already exists.&quot; -ForegroundColor Yellow
		  return
		} 
		
		# Create zip file		
		Set-Content $ZipFileName (&quot;PK&quot; + [char]5 + [char]6 + (&quot;$([char]0)&quot; * 18))
		(Dir $ZipFileName).IsReadOnly = $false 
		$ZipFile = (New-Object -com shell.application).NameSpace($ZipFileName) 
		
		Write-Host &quot;Adding $SourceFolder to the zip file.&quot;
		Write-Host
				
		$ZipFile.CopyHere((Get-Item $SourceFolder).FullName)
		
		Write-Host &quot;Zip file created.&quot;
		Write-Host
	}
}
</pre>
<p>SP-Backup-IIS will backup the IIS metabase, zip the backup folder and copy it to the location you specify in the $BackupFolder parameter. The SP-Restore-IIS will restore the IIS metabase from the backup you specify in the $BackupName parameter. This parameter corresponds to the name of the backup folder in 'C:\Windows\System32\inetsrv\backup'. You could expand on this by having the restore script first get your zip file and extract it to the backup folder. Happy scripting!</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Share this page</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-backup-and-restore-iis-7-metabase-with-powershell%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-backup-and-restore-iis-7-metabase-with-powershell%2F&amp;title=How+To+Backup+And+Restore+IIS+7+Metabase+With+PowerShell" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-backup-and-restore-iis-7-metabase-with-powershell%2F&amp;title=How+To+Backup+And+Restore+IIS+7+Metabase+With+PowerShell" rel="nofollow" title="Add to&nbsp;LinkedIn"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Add to&nbsp;LinkedIn" alt="Add to&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-backup-and-restore-iis-7-metabase-with-powershell%2F&amp;title=How+To+Backup+And+Restore+IIS+7+Metabase+With+PowerShell" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-backup-and-restore-iis-7-metabase-with-powershell%2F&amp;title=How+To+Backup+And+Restore+IIS+7+Metabase+With+PowerShell" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+How+To+Backup+And+Restore+IIS+7+Metabase+With+PowerShell+@+http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-backup-and-restore-iis-7-metabase-with-powershell%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.olavaukan.com/2011/03/how-to-backup-and-restore-iis-7-metabase-with-powershell/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How to backup SharePoint using PowerShell</title>
		<link>http://www.olavaukan.com/2011/03/how-to-backup-sharepoint-using-powershell/</link>
		<comments>http://www.olavaukan.com/2011/03/how-to-backup-sharepoint-using-powershell/#comments</comments>
		<pubDate>Mon, 21 Mar 2011 15:47:25 +0000</pubDate>
		<dc:creator>Olav Aukan</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[STSADM]]></category>

		<guid isPermaLink="false">http://www.olavaukan.com/?p=385</guid>
		<description><![CDATA[Lately I've been reading up on - and experimenting with - PowerShell to automate alot of the tings I do in SharePoint. The original motivation was a deployment gone bad (ie. too many manual steps + too little time = too many errors) and it got me rethinking my whole approach to managing SharePoint. My [...]]]></description>
				<content:encoded><![CDATA[<p>Lately I've been reading up on - and experimenting with - PowerShell to automate alot of the tings I do in SharePoint. The original motivation was a deployment gone bad (ie. too many manual steps + too little time = too many errors) and it got me rethinking my whole approach to managing SharePoint. </p>
<p>My previous attempts at automating the build -&gt; package -&gt; deploy process with a .bat file calling MSBuild and STSADM commands had failed miserably about two years ago. It would not wait for the solution to finish retracting before trying to remove it, or it would try to activate a feature before the solution was finished deploying, etc. Also, since it was one giant monolithic script, any errors early on in the process would cause all sorts of problems.</p>
<p>There are ways to deal with this in .bat files, but they don't even come close to the cool stuff you can do with PowerShell! Therefore I'm planning on writing a couple of posts about using PowerShell to manage SharePoint based on the things I've been trying out so far. Keep in mind that I'm still learning and some of the stuff I write about might be stupid, inefficient or downright wrong. With that disclaimer out of the way I present my first PowerShell script: Performing a full farm backup.</p>
<pre class="brush: xml; title: ; notranslate">
# This function performs a complete backup of the local farm
function SP-Backup-Farm {

	param (
		[Parameter(Mandatory=$true, ValueFromPipeline=$true, Position=0)]
		[string]
		$BackupFolder
	)

	process {

		Write-Host &quot;Attempting full backup of the farm.&quot;

		# Create the backup settings
		$Settings = [Microsoft.SharePoint.Administration.Backup.SPBackupRestoreSettings]::GetBackupSettings($BackupFolder, &quot;Full&quot;);

		# Set optional operation parameters
		$Settings.IsVerbose = $true;
		$Settings.UpdateProgress = 10;
		$Settings.BackupThreads = 10;

		# File size details
		$BackupSize = New-Object UInt64
		$DiskSize = New-Object UInt64
		$DiskFreeSize = New-Object UInt64

		Write-Host &quot;Backup Location:&quot; $BackupFolder

		# Check that the target folder exists
		if (Test-Path $BackupFolder)
		{
			Write-Host &quot;Backup Location Exists: True&quot;
			Write-Host

			# Backup operation details
			$BackupID = [Microsoft.SharePoint.Administration.Backup.SPBackupRestoreConsole]::CreateBackupRestore($Settings);
			$BackupObjects = [Microsoft.SharePoint.Administration.Backup.SPBackupRestoreConsole]::FindItems($BackupID, &quot;Farm&quot;);

			# Get file size info
			$BackupSize = [Microsoft.SharePoint.Administration.Backup.SPBackupRestoreConsole]::DiskSizeRequired($BackupID)
			[void][Microsoft.SharePoint.Administration.Backup.SPBackupRestoreConsole]::DiskSize($BackupFolder, [ref]$DiskFreeSize, [ref]$DiskSize)

			# Check if there is enough free disk space
			$HasEnoughSpace = $false
			if ($DiskFreeSize -gt $BackupSize)
			{
				$HasEnoughSpace = $true
			}

			$BackupSizeString = Util-Convert-FileSizeToString $BackupSize
			$DiskSizeString = Util-Convert-FileSizeToString $DiskSize
			$DiskFreeSizeString = Util-Convert-FileSizeToString $DiskFreeSize

			Write-Host &quot;Total Disk Space:&quot; $DiskSizeString
			Write-Host &quot;Free Disk Space:&quot; $DiskFreeSizeString
			Write-Host &quot;Required Disk Space:&quot; $BackupSizeString
			Write-Host

			if($HasEnoughSpace)
			{
				Write-Host &quot;Sufficient Free Disk Space: True&quot;

				# Set the backup as the active job and run it
				if ([Microsoft.SharePoint.Administration.Backup.SPBackupRestoreConsole]::SetActive($BackupID))
				{
					$BackupObjectCount = $BackupObjects.Count

					Write-Host &quot;Successfully set backup job as the active job.&quot;
					Write-Host &quot;Backup consists of $BackupObjectCount object(s)&quot;
					Write-Host
					Write-Host &quot;Backup Started&quot;
					Write-Host

					foreach($BackupObject in $BackupObjects)
					{
						if (([Microsoft.SharePoint.Administration.Backup.SPBackupRestoreConsole]::Run($BackupID, $BackupObject)))
						{
							Write-Host &quot;Backup Completed&quot;
						}
						else
						{
							Write-host &quot;An unexpected error occured!&quot; -ForegroundColor Yellow
							Write-Host &quot;Backup Failed&quot; -ForegroundColor Yellow
						}
					}
				}
				else
				{
					Write-Host &quot;Unable to set backup job as the active job.&quot; -ForegroundColor Yellow
					Write-Host &quot;Backup Failed.&quot; -ForegroundColor Yellow
				}
			}
			else
			{
				Write-Host &quot;Sufficient Free Disk Space: False&quot; -ForegroundColor Yellow
				Write-Host &quot;Backup Failed&quot; -ForegroundColor Yellow
			}
		}
		else
		{
			Write-Host &quot;Backup Location Exists: False&quot; -ForegroundColor Yellow
			Write-Host &quot;Backup folder doesn't exist or the service account does not have read/write access to it.&quot; -ForegroundColor Yellow
			Write-Host &quot;Backup Failed.&quot; -ForegroundColor Yellow
		}

		Write-Host

		# Clean up the operation
		if (!$BackupID -eq $null)
		{
			[void][Microsoft.SharePoint.Administration.Backup.SPBackupRestoreConsole]::Remove($BackupID)
		}
	}
}

# This function returns a &quot;user friendly&quot; display value for a filesize in bytes
function Util-Convert-FileSizeToString {

    param (
		[Parameter(Mandatory=$true, ValueFromPipeline=$true, Position=0)]
		[int64]
		$sizeInBytes
	)

    switch ($sizeInBytes)
    {
        {$sizeInBytes -ge 1TB} {&quot;{0:n$sigDigits}&quot; -f ($sizeInBytes/1TB) + &quot; TB&quot; ; break}
        {$sizeInBytes -ge 1GB} {&quot;{0:n$sigDigits}&quot; -f ($sizeInBytes/1GB) + &quot; GB&quot; ; break}
        {$sizeInBytes -ge 1MB} {&quot;{0:n$sigDigits}&quot; -f ($sizeInBytes/1MB) + &quot; MB&quot; ; break}
        {$sizeInBytes -ge 1KB} {&quot;{0:n$sigDigits}&quot; -f ($sizeInBytes/1KB) + &quot; KB&quot; ; break}
        Default { &quot;{0:n$sigDigits}&quot; -f $sizeInBytes + &quot; Bytes&quot; }
    }
}
</pre>
<p>The convert bytes to string function was something I found on another blog and adapted to PowerShell, so I can't really take credit for that one. Also it took about 3 hours to do a full backup on my VMWare machine with about 50GB of content databases. Your milage may vary...</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Share this page</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-backup-sharepoint-using-powershell%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-backup-sharepoint-using-powershell%2F&amp;title=How+to+backup+SharePoint+using+PowerShell" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-backup-sharepoint-using-powershell%2F&amp;title=How+to+backup+SharePoint+using+PowerShell" rel="nofollow" title="Add to&nbsp;LinkedIn"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Add to&nbsp;LinkedIn" alt="Add to&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-backup-sharepoint-using-powershell%2F&amp;title=How+to+backup+SharePoint+using+PowerShell" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-backup-sharepoint-using-powershell%2F&amp;title=How+to+backup+SharePoint+using+PowerShell" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+How+to+backup+SharePoint+using+PowerShell+@+http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-backup-sharepoint-using-powershell%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.olavaukan.com/2011/03/how-to-backup-sharepoint-using-powershell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to ghost an unghosted content type</title>
		<link>http://www.olavaukan.com/2011/03/how-to-ghost-an-unghosted-content-type/</link>
		<comments>http://www.olavaukan.com/2011/03/how-to-ghost-an-unghosted-content-type/#comments</comments>
		<pubDate>Mon, 21 Mar 2011 09:33:37 +0000</pubDate>
		<dc:creator>Olav Aukan</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Content Type]]></category>
		<category><![CDATA[STSADM]]></category>

		<guid isPermaLink="false">http://www.olavaukan.com/?p=371</guid>
		<description><![CDATA[A while back I wrote a post about content types becoming unghosted when you edit them in the UI and there not being any way of reversing this without directly modifying the content database. That would put you in an unsupported state, so obviously it's not an option for most people. But as it turns [...]]]></description>
				<content:encoded><![CDATA[<p>A while back I wrote a post about <a title="Content types can be unghosted too!" href="http://www.olavaukan.com/2010/10/content-types-can-be-unghosted-too/">content types becoming unghosted</a> when you edit them in the UI and there not being any way of reversing this without directly modifying the content database. That would put you in an unsupported state, so obviously it's not an option for most people. But as it turns out there <strong>is</strong> a supported way of doing this after all, it's just not very well documented...</p>
<p>A colleague of mine was having this same problem and informed me that he was able to fix it with the STSADM Deactivatefeature operation by adding the -force parameter.</p>
<p>Let us see what the <a title="Deactivatefeature: Stsadm operation (Office SharePoint Server)" href="http://technet.microsoft.com/en-us/library/cc262680%28office.12%29.aspx" target="_blank">Holy Gospel according to TechNet</a> has to say about the -force parameter:</p>
<pre style="padding-left: 30px;">"force - Forces the feature to be uninstalled."</pre>
<p>In other words, not much help to be found in the scriptures. But it works! When the feature containing the unghosted content type(s) is deactivated with the -force parameter the Definition column in the ContentTypes table goes back to NULL, meaning it is now using the XML definition again.</p>
<p>You can then use the <a title="Propagate Content Type Changes " href="http://blog.falchionconsulting.com/index.php/2008/05/propagate-content-type-changes/" target="_blank">gl-propagatecontenttype</a> custom STSADM command from Gary Lapointe with the -updatefields parameter to push changes in the site content type down to the list content type.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Share this page</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-ghost-an-unghosted-content-type%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-ghost-an-unghosted-content-type%2F&amp;title=How+to+ghost+an+unghosted+content+type" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-ghost-an-unghosted-content-type%2F&amp;title=How+to+ghost+an+unghosted+content+type" rel="nofollow" title="Add to&nbsp;LinkedIn"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Add to&nbsp;LinkedIn" alt="Add to&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-ghost-an-unghosted-content-type%2F&amp;title=How+to+ghost+an+unghosted+content+type" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-ghost-an-unghosted-content-type%2F&amp;title=How+to+ghost+an+unghosted+content+type" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+How+to+ghost+an+unghosted+content+type+@+http%3A%2F%2Fwww.olavaukan.com%2F2011%2F03%2Fhow-to-ghost-an-unghosted-content-type%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.olavaukan.com/2011/03/how-to-ghost-an-unghosted-content-type/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>400 Bad Request (Header Field Too Long) when using Kerberos authentication</title>
		<link>http://www.olavaukan.com/2010/11/400-bad-request-header-field-too-long-when-using-kerberos-authentication/</link>
		<comments>http://www.olavaukan.com/2010/11/400-bad-request-header-field-too-long-when-using-kerberos-authentication/#comments</comments>
		<pubDate>Wed, 24 Nov 2010 12:09:49 +0000</pubDate>
		<dc:creator>Olav Aukan</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Authentication]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[Kerberos]]></category>

		<guid isPermaLink="false">http://www.olavaukan.com/?p=355</guid>
		<description><![CDATA[A client was having a problem with his SharePoint installation a while back that really confused me at first. Some users were unable to access their SharePoint 2007 intranet after Kerberos authentication had been configured. Instead of being logged in automatically as expected they received a nize "This page cannot de displayed" in Internet Explorer. [...]]]></description>
				<content:encoded><![CDATA[<p>A client was having a problem with his SharePoint installation a while back that really confused me at first. Some users were unable to access their SharePoint 2007 intranet after Kerberos authentication had been configured. Instead of being logged in automatically as expected they received a nize "This page cannot de displayed" in Internet Explorer. The error returned by IIS was "440 Bad Request (Header Field Too Long)".</p>
<p>After some research I stumbled upon this blog post: <a title="HTTP/1.1 400 Bad Request (Header Field Too Long)" href="http://www.marc-antho-etc.net/blog/post/2008/08/22/HTTP11-400-Bad-Request-%28Header-Field-Too-Long%29.aspx" target="_blank">HTTP/1.1 400 Bad Request (Header Field Too Long)</a> that pointed me to <a title="KB-820129" href="http://support.microsoft.com/kb/820129" target="_blank">KB-820129</a>. Basically the problem boils down to the difference in the way NTML and Kerberos authentication is performed. With NTLM authentication the client basically sends his username and password to the server which then checks the users memberships by looking up the user in Active Directory. With Kerberos authentication the client basically gets this information from Active Directory himself sends a "token" to the server that contains information about the users memberships. The more AD groups that user is a member of, the bigger the token, and at some point it can become so large that IIS rejects the whole request.</p>
<p>This explained why only some users were having problems, as we discovered that the affected users had dozens of AD memberships, and those AD groups were nested inside other AD groups etc. The solution for us was to modify the following registry keys on all the SharePoint web front end servers in the farm:</p>
<pre class="brush: plain; title: ; notranslate">
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\HTTP\Parameters\MaxFieldLength = 65534
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\HTTP\Parameters\MaxRequestBytes = 65534
</pre>
<p>After the registry modifications have been done the HTTP service and all related IIS services will have to be restarted, as described in the bottom of KB-820129:</p>
<p style="padding-left: 30px;">To restart the HTTP service, type and all related IIS services, follow these steps:</p>
<ol>
<li>Click Start, click Run, type Cmd and then click OK.</li>
<li>At the command prompt, type net stop http at a command prompt and then press ENTER.</li>
<li>At the command prompt, type net start http at a command prompt and then press ENTER.</li>
<li>At the command prompt, type net stop iisadmin /y at a command prompt and then press ENTER.<br />
<br/>
<p>Note: Any IIS services that depend on the IIS Admin Service service will  also be stopped. Notice the IIS services that are stopped when you stop  the IIS Admin Service service. You will restart each service in the  next step.</p>
</li>
<li>Restart the IIS services that were stopped in step 4. To do this, type  net start servicename at the command prompt and then press ENTER. In  the command, servicename is the name of the service that you want to  restart. For example, to restart the World Wide Web Publishing Service  service, type net start "World Wide Web Publishing Service", and then  press ENTER.</li>
</ol>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Share this page</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F11%2F400-bad-request-header-field-too-long-when-using-kerberos-authentication%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F11%2F400-bad-request-header-field-too-long-when-using-kerberos-authentication%2F&amp;title=400+Bad+Request+%28Header+Field+Too+Long%29+when+using+Kerberos+authentication" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F11%2F400-bad-request-header-field-too-long-when-using-kerberos-authentication%2F&amp;title=400+Bad+Request+%28Header+Field+Too+Long%29+when+using+Kerberos+authentication" rel="nofollow" title="Add to&nbsp;LinkedIn"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Add to&nbsp;LinkedIn" alt="Add to&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F11%2F400-bad-request-header-field-too-long-when-using-kerberos-authentication%2F&amp;title=400+Bad+Request+%28Header+Field+Too+Long%29+when+using+Kerberos+authentication" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F11%2F400-bad-request-header-field-too-long-when-using-kerberos-authentication%2F&amp;title=400+Bad+Request+%28Header+Field+Too+Long%29+when+using+Kerberos+authentication" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+400+Bad+Request+%28Header+Field+Too+Long%29+when+using+Kerberos+authentication+@+http%3A%2F%2Fwww.olavaukan.com%2F2010%2F11%2F400-bad-request-header-field-too-long-when-using-kerberos-authentication%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.olavaukan.com/2010/11/400-bad-request-header-field-too-long-when-using-kerberos-authentication/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Content types can be unghosted too!</title>
		<link>http://www.olavaukan.com/2010/10/content-types-can-be-unghosted-too/</link>
		<comments>http://www.olavaukan.com/2010/10/content-types-can-be-unghosted-too/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 20:22:25 +0000</pubDate>
		<dc:creator>Olav Aukan</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[CAML]]></category>
		<category><![CDATA[Content Type]]></category>
		<category><![CDATA[STSADM]]></category>

		<guid isPermaLink="false">http://www.olavaukan.com/?p=341</guid>
		<description><![CDATA[Update: There is a simple solution to this problem after all. See How to ghost an unghosted content type for more details. Just about all SharePoint projects require that you create some custom content types and/or add some custom site columns, and this is usually done through a feature that contains the CAML definition for [...]]]></description>
				<content:encoded><![CDATA[<p><span style="color: #ff0000;"><strong>Update:</strong></span> There is a simple solution to this problem after all. See <a title="How to ghost an unghosted content type." href="http://www.olavaukan.com/2011/03/how-to-ghost-an-unghosted-content-type/">How to ghost an unghosted content type</a> for more details.</p>
<p>Just about all SharePoint projects require that you create some custom content types and/or add some custom site columns, and this is usually done through a feature that contains the CAML definition for those content types and site columns, as described in the MSDN article <a title="Content Type Deployment Using Features" href="http://msdn.microsoft.com/en-us/library/ms479975%28v=office.12%29.aspx" target="_blank">Content Type Deployment Using Features</a>. It is also often the case that for some reason these CAML definitions will change during the project. Maybe a certain feature was not specified correctly, the requirements changed, or additional features are added that require new columns to an already existing content type. This is where the first problems start to arise...</p>
<p>If you read the MSDN article about deploying content types you will see the following warning:</p>
<p style="padding-left: 30px;"><em>"Under no circumstances should you update the content type definition file for a content type after you have installed and activated that content type. Windows SharePoint Services does not track changes made to the content type definition file. Therefore, you have no method for pushing down changes made to site content types to the child content types."</em></p>
<p>This warning is usually ignored while in development, as clean builds are done regularly where everything is deleted and the solution is deployed to a fresh site collection. The problem usually doesn't show up until after the solution has gone into production and a later update tries to make some changes to these content type definitons. These changes will be pushed to the <strong>site content types</strong> but the <strong>list content types</strong> are basically detached copies of the site content types and therefore will not be updated.</p>
<p>Luckily there is a <span style="text-decoration: line-through;">hack</span> solution to this problem, and it comes in the form of a <a title="Propagate Content Type Changes" href="http://stsadm.blogspot.com/2008/05/propagate-content-type-changes.html" target="_blank">custom STSADM command</a>. This command will push changes to the site content type down to all list content type instances, thus solving the problem once and for all. Or perhaps not? I stumbled upon this command while trying to figure out how to do just such an update, and after trying it out with success in our test environment I decided to go ahead and use the same command in the production environment. Sadly it did not work, and I could not figure out why.</p>
<p>Then I read a post on our internal blog by <a title="LinkedIn: Jan Inge Dalsbø" href="http://no.linkedin.com/in/janid1967" target="_blank">Jan Inge Dalsbø</a> with a title of something like "Mysteries of SharePoint content types" where he goes on to explain that site content types can actually be unghosted (detached from their CAML definition) if they are edited in the SharePoint UI. Any changes to the CAML definition done after this has happened will not be pushed to the site content type, and you are - pardon my french - properly fucked! The content type will have to be updated through the UI or object model from that point on.</p>
<p>To verify that the content type has in fact been unghosted you need to check the content database. To do this you will have to run a query against it (obviously) and this will actually <strong>leave you in an unsupported state!</strong> Yep, we all knew you weren't supposed to modify any of the SharePoint databases but as it turns out you're not even allowed to read from it.  That being said, here are two before and after screenshots of a content type being unghosted.</p>
<p><img class="alignnone size-full wp-image-346" title="Attached Content Type" src="http://www.olavaukan.com/wp-content/uploads/2010/10/attached-contenttype.jpg" alt="" width="700" height="99" /></p>
<p><img class="alignnone size-full wp-image-347" title="Detached Content Type" src="http://www.olavaukan.com/wp-content/uploads/2010/10/detached-contenttype.jpg" alt="" width="700" height="96" /></p>
<p>Notice that in the second screenshot the <em>definition</em> field has gone from being NULL to containing the content type CAML definiton. The content type has now been detached from its definition, updates will fail, hairs will be pulled, gods will be cursed etc. etc. I haven't dared to poke around in the production database to see if this is actually what happened in my case, but I'm pretty certain it's the same problem.</p>
<p>So where do you go from here? I honestly don't know... Søren Nielsen, the original author of the code used in the STSADM command mentioned earlier, has a  <span style="text-decoration: line-through;">hack</span> solution to this problem as well, but it involves modifying the content database. In his blog post <a title="Convert “virtual” content types to “physical”" href="http://soerennielsen.wordpress.com/2007/09/08/convert-%E2%80%9Dvirtual-content-types%E2%80%9D-to-physical/" target="_blank">Convert “virtual” content types to “physical”</a> he explains the steps needed to reattach the content type to its CAML definition. Keep in mind that this <strong>will</strong> leave you in an unsupported state!</p>
<p>This was all new to me, and I was a bit shocked to find out that this is how it works. Basically Microsoft has given us a big fat rope to hang ourselves with here. From now on I will definitely tell all site collection administrators to never touch the content types!</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Share this page</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F10%2Fcontent-types-can-be-unghosted-too%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F10%2Fcontent-types-can-be-unghosted-too%2F&amp;title=Content+types+can+be+unghosted+too%21" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F10%2Fcontent-types-can-be-unghosted-too%2F&amp;title=Content+types+can+be+unghosted+too%21" rel="nofollow" title="Add to&nbsp;LinkedIn"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Add to&nbsp;LinkedIn" alt="Add to&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F10%2Fcontent-types-can-be-unghosted-too%2F&amp;title=Content+types+can+be+unghosted+too%21" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F10%2Fcontent-types-can-be-unghosted-too%2F&amp;title=Content+types+can+be+unghosted+too%21" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Content+types+can+be+unghosted+too%21+@+http%3A%2F%2Fwww.olavaukan.com%2F2010%2F10%2Fcontent-types-can-be-unghosted-too%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.olavaukan.com/2010/10/content-types-can-be-unghosted-too/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SharePoint does not always play nice with comments</title>
		<link>http://www.olavaukan.com/2010/10/sharepoint-does-not-always-play-nice-with-comment/</link>
		<comments>http://www.olavaukan.com/2010/10/sharepoint-does-not-always-play-nice-with-comment/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 12:49:53 +0000</pubDate>
		<dc:creator>Olav Aukan</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.olavaukan.com/?p=326</guid>
		<description><![CDATA[Some days ago I was tasked with removing the "Add to my colleagues" button from the My Profile page in SharePoint. This is a one-off page located at the root of the My Site site collection named Person.aspx. So I fired up SharePoint Designer (yes I know, SPD is a great evil, but for these [...]]]></description>
				<content:encoded><![CDATA[<p>Some days ago I was tasked with removing the "Add to my colleagues" button from the My Profile page in SharePoint. This is a one-off page located at the root of the My Site site collection named Person.aspx. So I fired up SharePoint Designer (yes I know, SPD is a great evil, but for these kinds of changes it's really the easiest way) and looked at the file. It turns out that the "Add to my colleagues" button is a control in the PlaceHolderMiniConsole placeholder, so I commented it out and saved the page.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;asp:Content ContentPlaceHolderId=&quot;PlaceHolderMiniConsole&quot; runat=&quot;server&quot;&gt;
	&lt;SPSWC:MiniConsole runat=&quot;server&quot; id=&quot;miniConsole&quot;&gt;
	&lt;SPSWC:SPSRepeatedControls id=&quot;RptControls&quot; runat=&quot;server&quot; HeaderHtml=&quot;&quot; BeforeControlHtml=&quot;&lt;td class='ms-toolbar' nowrap='true' ID='_spFocusHere'&gt;&quot; AfterControlHtml=&quot;&lt;/td&gt;&quot; SeparatorHtml=&quot;&lt;td class=ms-separator&gt;|&lt;/td&gt;&quot;&gt;
		&lt;Template_Controls&gt;
			&lt;SPSWC:ReturnToSiteButton runat=&quot;server&quot; id=&quot;TBBReturnToSite&quot; class=&quot;ms-toolbar&quot; ShowImageAndText=&quot;false&quot;/&gt;
			&lt;!--&lt;SPSWC:AddToColleaguesButton runat=&quot;server&quot; visible=&quot;false&quot; id=&quot;TBBAddtoColleagues&quot; class=&quot;ms-toolbar&quot; ShowImageAndText=&quot;false&quot;/&gt;--&gt;
			&lt;SPSWC:AsSeenBy runat=&quot;server&quot; id=&quot;ddlAsSeenBy&quot; SelectionMode=&quot;Single&quot; autopostback=true/&gt;
		&lt;/Template_Controls&gt;
	&lt;/SPSWC:SPSRepeatedControls&gt;
  &lt;/SPSWC:MiniConsole&gt;
&lt;/asp:Content&gt;
</pre>
<p>Much to my surprise nothing happened and the control was still rendered. I tried to revert Person.aspx to it's definition and do the changes again, I tried disabling the cache, I tried iisreset, but nothing worked. In the end I deleted the control instead of commenting it out. That worked...</p>
<p>A colleague of mine had a different problem. His content type was suddenly missing a site column. He was being a good developer and deploying it with XML, just like Microsoft tell you to do. I'm sure we all know about the MANY issues with this approach. So many in fact that I'm almost considering using the object model to add my site columns and content types on my next project, but that's a different subject altogether... We looked at the XML and couldn't see anything wrong with it:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;ContentType ID=&quot;0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D000cba91cafa2b473e85a2e018ed328699&quot;
               Name=&quot;InsideBaseArticle&quot;
               Group=&quot;Inside Portal&quot;
               Description=&quot;Base Content Type for publishing content in the Inside Portal&quot;
               Inherits=&quot;TRUE&quot;
               Version=&quot;0&quot;&gt;
    &lt;FieldRefs&gt;
      &lt;FieldRef ID=&quot;{6440A642-CE85-4AF3-BFF7-1900D5095D87}&quot; /&gt;   &lt;!-- Tax Note Field --&gt;
      &lt;FieldRef ID=&quot;{D5F62894-71DA-49E1-88CE-A8FBBCBFCE2F}&quot; Name=&quot;Via&quot; /&gt;  &lt;!-- Tax Field --&gt;
      &lt;FieldRef ID=&quot;{9DFA6A86-70E7-4470-B3FD-4D68D1FDD1A5}&quot; Name=&quot;Summary&quot;  Required=&quot;FALSE&quot; /&gt;
      &lt;FieldRef ID=&quot;{5a14d1ab-1513-48c7-97b3-657a5ba6c742}&quot; Name=&quot;AverageRating&quot; /&gt;
      &lt;FieldRef ID=&quot;{b1996002-9167-45e5-a4df-b2c41c6723c7}&quot; Name=&quot;RatingCount&quot; /&gt;
    &lt;/FieldRefs&gt;
&lt;/ContentType&gt;
</pre>
<p>Turns out it was the comments in the FieldRefs section. Removing them and deploying again resolved the issue.</p>
<p>Moral of the story? SharePoint doesn't always play nice with comments...</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Share this page</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F10%2Fsharepoint-does-not-always-play-nice-with-comment%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F10%2Fsharepoint-does-not-always-play-nice-with-comment%2F&amp;title=SharePoint+does+not+always+play+nice+with+comments" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F10%2Fsharepoint-does-not-always-play-nice-with-comment%2F&amp;title=SharePoint+does+not+always+play+nice+with+comments" rel="nofollow" title="Add to&nbsp;LinkedIn"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Add to&nbsp;LinkedIn" alt="Add to&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F10%2Fsharepoint-does-not-always-play-nice-with-comment%2F&amp;title=SharePoint+does+not+always+play+nice+with+comments" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F10%2Fsharepoint-does-not-always-play-nice-with-comment%2F&amp;title=SharePoint+does+not+always+play+nice+with+comments" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+SharePoint+does+not+always+play+nice+with+comments+@+http%3A%2F%2Fwww.olavaukan.com%2F2010%2F10%2Fsharepoint-does-not-always-play-nice-with-comment%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.olavaukan.com/2010/10/sharepoint-does-not-always-play-nice-with-comment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating an ActiveX control in .Net using C#</title>
		<link>http://www.olavaukan.com/2010/08/creating-an-activex-control-in-net-using-c/</link>
		<comments>http://www.olavaukan.com/2010/08/creating-an-activex-control-in-net-using-c/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 19:39:17 +0000</pubDate>
		<dc:creator>Olav Aukan</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[ActiveX]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.olavaukan.com/?p=287</guid>
		<description><![CDATA[A while back I had a client request that I write an ActiveX control for use on their corporate intranet. I had never done this before, and most of the examples I could find online were either really old, incomplete or based on using C++ and MFC. It's safe to say that my C++ skills [...]]]></description>
				<content:encoded><![CDATA[<p>A while back I had a client request that I write an ActiveX control for use on their corporate intranet. I had never done this before, and most of the examples I could find online were either really old, incomplete or based on using C++ and MFC. It's safe to say that my C++ skills are not quite up to the job, so for me it was really a requirement to be able to do this with C#. It took me about an hour or two to write the code for the control, but it took almost three days to successfully package and deploy it as a .cab file... So to save others from wasting their time like I did, I'll document my findings in this post.</p>
<h1>Steps</h1>
<ol>
<li>- Create a new Class Library project in Visual Studio</li>
<li>- Create a new class that inherits from UserControl</li>
<li>- Create a new interface that exposes the controls methods and properties to COM interop</li>
<li>- Make the control class implement the new interface</li>
<li>- Mark the control as safe for scripting and initialization</li>
<li>- Create a .msi installer for the control</li>
<li>- Package the control in a .cab file for web deployment</li>
<li>- Initialize and test the control with JavaScript</li>
</ol>
<h2>1. Create a new Class Library project in Visual Studio</h2>
<p>I'm using Visual Studio 2008, but other versions should work as well.</p>
<ol>
<li>After starting Visual Studio click File -&gt; New -&gt; Project and select Class Library under C#.</li>
<li>Call the project 'AxControls' and click OK.</li>
</ol>
<p><img class="alignnone size-full wp-image-291" title="ActiveX-Control-1" alt="" src="http://www.olavaukan.com/wp-content/uploads/2010/06/ActiveX-Control-1.png" width="640" height="455" /></p>
<h2>2. Create a new class that inherits from UserControl</h2>
<ol>
<li>Rename 'Class1.cs' to 'HelloWorld.cs', making sure to rename the class name as well.</li>
<li>Add a project reference to System.Windows.Forms.<img class="alignnone size-full wp-image-292" style="margin-top: 10px; margin-bottom: 10px;" title="ActiveX-Control-2" alt="" src="http://www.olavaukan.com/wp-content/uploads/2010/06/ActiveX-Control-2.png" width="482" height="408" /></li>
<li>Make the HelloWorld class inherit UserControl.</li>
</ol>
<h2>3. Create a new interface that exposes the controls methods and properties to COM interop</h2>
<ol>
<li>Right click the project in Visual Studio and click Add -&gt; New Item.</li>
<li>Select 'Interface' from the list of components, name it 'IHelloWorld.cs' and click Add.<img class="alignnone size-full wp-image-293" style="margin-top: 10px; margin-bottom: 10px;" title="ActiveX-Control-3" alt="" src="http://www.olavaukan.com/wp-content/uploads/2010/06/ActiveX-Control-3.png" width="640" height="385" /></li>
<li>Edit the 'IHelloWorld.cs' file so it looks like this:
<pre class="brush: csharp; title: ; notranslate">
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace AxControls
{
    [ComVisible(true)]
    [InterfaceType(ComInterfaceType.InterfaceIsDual)]
    [Guid(&quot;41E85D5D-C57A-4386-B722-4031D0B1E1B7&quot;)]
    public interface IHelloWorld
    {
        string GetText();
    }
}
</pre>
</li>
</ol>
<p>We now have a COM visible interface with a single method 'GetText()'.</p>
<p>[ComVisible(true)] makes the interface visible to COM.<br />
[InterfaceType(ComInterfaceType.InterfaceIsDual)] sets the COM interface type to Dual, see <a title="MSDN: InterfaceTypeAttribute Class" href="http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.interfacetypeattribute%28v=VS.100%29.aspx" target="_blank">InterfaceTypeAttribute Class on MSDN</a>.<br />
[Guid("41E85D5D-C57A-4386-B722-4031D0B1E1B7")] let's us manually assign a GUID to the interface. Use guidgen.exe to generate your own.</p>
<h2>4. Make the control class implement the new interface</h2>
<p>Make the HelloWorld class implement the IHelloWorld interface and have the GetText() method return a string of your choice. This is what the file might look like:</p>
<pre class="brush: csharp; title: ; notranslate">
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace AxControls
{
    [ComVisible(true)]
    [ClassInterface(ClassInterfaceType.None)]
    [Guid(&quot;1FC0D50A-4803-4f97-94FB-2F41717F558D&quot;)]
    [ProgId(&quot;AxControls.HelloWorld&quot;)]
    [ComDefaultInterface(typeof(IHelloWorld))]
    public class HelloWorld : UserControl, IHelloWorld
    {
        #region IHelloWorld Members

        public string GetText()
        {
            return &quot;Hello ActiveX World!&quot;;
        }

        #endregion
    }
}
</pre>
<p>We now have a COM visible control that implements the IHelloWorld interface.</p>
<p>[ComVisible(true)] makes the control visible to COM, see <a title="MSDN: ComVisibleAttribute Class" href="http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.comvisibleattribute%28v=VS.100%29.aspx" target="_blank">ComVisibleAttribute Class on MSDN</a>.<br />
[ClassInterface(ClassInterfaceType.None)] indicates that no class interface is generated for this class, see <a title="MSDN: ClassInterfaceType Enumeration" href="http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.classinterfacetype.aspx" target="_blank">ClassInterfaceType Enumeration on MSDN</a>.<br />
[Guid("1FC0D50A-4803-4f97-94FB-2F41717F558D")] let's us manually assign a GUID to the control, see <a title="MSDN: GuidAttributeClass" href="http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.guidattribute%28v=VS.100%29.aspx." target="_blank">GuidAttribute Class on MSDN</a>. Use guidgen.exe to generate your own.<br />
[ProgId("AxControls.HelloWorld")] is a "user friendly" ID that we'll use later from JavaScript when initiating the control, see <a title="MSDN: ProgIdAttribute Class" href="http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.progidattribute%28v=VS.100%29.aspx" target="_blank">ProgIdAttribute Class on MSDN</a>.<br />
[ComDefaultInterface(typeof(IHelloWorld))] sets IHelloWorld as the default interface that will be exposed to COM, see <a title="MSDN: ComDefaultInterfaceAttribute Class" href="http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.comdefaultinterfaceattribute%28v=VS.100%29.aspx" target="_blank">ComDefaultInterfaceAttribute Class on MSDN</a>.</p>
<h2>5. Mark the control as safe for scripting and initialization</h2>
<p>By default IE will not allow initializing and scripting an ActiveX control unless it is marked as safe. This means that we won't be able to create instances of our ActiveX class with JavaScript by default. We can get around this by modifying the browser security settings, but a more elegant way would be to mark the control as safe. Before you do this to a "real" control, be sure to understand the consequences. I found an ancient (1996) MSDN article that explains this <a title="MSDN: Signing and Marking ActiveX Controls" href="http://msdn.microsoft.com/en-us/library/ms974305.aspx" target="_blank">here</a>. We will mark the control as safe by implementing the IObjectSafety interface.</p>
<ol>
<li>Right click the project in Visual Studio and click Add -&gt; New Item.</li>
<li>Select 'Interface' from the list of components, name it 'IObjectSafety.cs' and click Add.<img class="alignnone size-full wp-image-294" style="margin-top: 10px; margin-bottom: 10px;" title="ActiveX-Control-4" alt="" src="http://www.olavaukan.com/wp-content/uploads/2010/06/ActiveX-Control-4.png" width="640" height="385" /></li>
<li>Edit the 'IObjectSafety.cs' file so it looks like this:
<pre class="brush: csharp; title: ; notranslate">
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace AxControls
{
    [ComImport()]
    [Guid(&quot;CB5BDC81-93C1-11CF-8F20-00805F2CD064&quot;)]
    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    interface IObjectSafety
    {
        [PreserveSig()]
        int GetInterfaceSafetyOptions(ref Guid riid, out int pdwSupportedOptions, out int pdwEnabledOptions);

        [PreserveSig()]
        int SetInterfaceSafetyOptions(ref Guid riid, int dwOptionSetMask, int dwEnabledOptions);
    }
}
</pre>
</li>
<li>Make the HelloWorld class implement the IObjectSafety interface. The end result should look something like this:
<pre class="brush: csharp; title: ; notranslate">
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace AxControls
{
    [ComVisible(true)]
    [ClassInterface(ClassInterfaceType.None)]
    [Guid(&quot;1FC0D50A-4803-4f97-94FB-2F41717F558D&quot;)]
    [ProgId(&quot;AxControls.HelloWorld&quot;)]
    [ComDefaultInterface(typeof(IHelloWorld))]
    public class HelloWorld : UserControl, IHelloWorld, IObjectSafety
    {
        #region IHelloWorld Members

        public string GetText()
        {
            return &quot;Hello ActiveX World!&quot;;
        }

        #endregion

        #region IObjectSafety Members

        public enum ObjectSafetyOptions
        {
            INTERFACESAFE_FOR_UNTRUSTED_CALLER = 0x00000001,
            INTERFACESAFE_FOR_UNTRUSTED_DATA = 0x00000002,
            INTERFACE_USES_DISPEX = 0x00000004,
            INTERFACE_USES_SECURITY_MANAGER = 0x00000008
        };

        public int GetInterfaceSafetyOptions(ref Guid riid, out int pdwSupportedOptions, out int pdwEnabledOptions)
        {
            ObjectSafetyOptions m_options = ObjectSafetyOptions.INTERFACESAFE_FOR_UNTRUSTED_CALLER | ObjectSafetyOptions.INTERFACESAFE_FOR_UNTRUSTED_DATA;
            pdwSupportedOptions = (int) m_options;
            pdwEnabledOptions = (int) m_options;
            return 0;
        }

        public int SetInterfaceSafetyOptions(ref Guid riid, int dwOptionSetMask, int dwEnabledOptions)
        {
            return 0;
        }

        #endregion
    }
}
</pre>
</li>
</ol>
<p>[ComImport()] IObjectSafety is a native interface so we have to redefine it for managed .Net use. This is done with the ComImport() attribute, see <a title="MSDN: ComImportAttribute Class" href="http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.comimportattribute%28v=VS.100%29.aspx" target="_blank">ComImportAttribute Class on MSDN</a>.<br />
[Guid("CB5BDC81-93C1-11CF-8F20-00805F2CD064")] This is the GUID of the original IObjectSafety interface. Do not change it.<br />
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] sets the COM interface type to Unknown, see <a title="MSDN: InterfaceTypeAttribute Class" href="http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.interfacetypeattribute%28v=VS.100%29.aspx" target="_blank">InterfaceTypeAttribute Class on MSDN</a>.</p>
<p>This is just a simple implemetation of the IObjectSafety interface that will mark the control as safe. In "real life" there would probably be some sort of logic to determine if the control is safe or not.</p>
<h2>6. Create a .msi installer for the control</h2>
<p>Before an ActiveX control can be used it must be installed and registered on the client. This can be done in a number of ways, from manually editing the registry to using regasm.exe, but we're going to create a Vistual Studio setup project to handle the installation for us.</p>
<ol>
<li>Right click the Visual Studio solution, select Add -&gt; New Project and select Setup Project under Other Project Types.</li>
<li>Call the project 'AxControlsInstaller' and click OK.<img class="alignnone size-full wp-image-295" style="margin-top: 10px; margin-bottom: 10px;" title="ActiveX-Control-5" alt="" src="http://www.olavaukan.com/wp-content/uploads/2010/06/ActiveX-Control-5.png" width="640" height="409" /></li>
<li>Right click the 'AxControlsInstaller' project, select Add -&gt; Project Output, select 'Primary output' from the 'AxControls' project and click OK.<img class="alignnone size-full wp-image-296" style="margin-top: 10px; margin-bottom: 10px;" title="ActiveX-Control-6" alt="" src="http://www.olavaukan.com/wp-content/uploads/2010/06/ActiveX-Control-6.png" width="377" height="437" /></li>
<li>Right click 'Primary output from AxControls (Active)' and select Properties.</li>
<li>Change the Register property from 'vsdrpDoNotRegister' to 'vsdrpCOM'.</li>
<li>Right click the 'AxControlsInstaller' project and select Build.</li>
</ol>
<p>The installer should now be located in the AxControlsInstaller's output folder (bin\Debug or bin\Release). In the corporate domain this .msi file can de run manually on the client, or automatically with a Group Policy.</p>
<h2>7. Package the installer in a .cab file for web deployment</h2>
<p>For public web sites we obviously can't deploy our ActiveX control to the client with a Group Policy. In this case we're gonna have to use Internet Explores built-in ability to download and install controls that are packaged in .cab files.</p>
<ol>
<li>Download the <a title="Microsofr Cabinet Software Development Kit" href="http://support.microsoft.com/kb/310618" target="_blank">Microsoft Cabinet Software Development Kit</a>.</li>
<li>Unpack the kit to a local folder and copy Cabarc.exe to the 'AxControlsInstaller' folder.</li>
<li>Create a new file named 'AxControls.inf' in the 'AxControlsInstaller' folder and add the following content:
<pre class="brush: plain; title: ; notranslate">
[version]
signature=&quot;$CHICAGO$&quot;
AdvancedINF=2.0

[Add.Code]
AxControlsInstaller.msi=AxControlsInstaller.msi

[AxControlsInstaller.msi]
file-win32-x86=thiscab
clsid={1FC0D50A-4803-4f97-94FB-2F41717F558D}
FileVersion=1,0,0,0

[Setup Hooks]
RunSetup=RunSetup

[RunSetup]
run=&quot;&quot;&quot;msiexec.exe&quot;&quot;&quot; /i &quot;&quot;&quot;%EXTRACT_DIR%\AxControlsInstaller.msi&quot;&quot;&quot; /qn
</pre>
</li>
<li>Click the AxControlsInstaller project and then click the Properties window (View -&gt; Properties Window if it's not visible).</li>
<li>Click the '...' button next to the PostBuildEvent property and add the following content:
<pre class="brush: plain; title: ; notranslate">
&quot;$(ProjectDir)\CABARC.EXE&quot; N &quot;$(ProjectDir)AxControls.cab&quot; &quot;$(ProjectDir)AxControls.inf&quot; &quot;$(ProjectDir)$(Configuration)\AxControlsInstaller.msi&quot;
</pre>
</li>
<li>Right click the 'AxControlsInstaller' project and select Build.</li>
<li>There should now be a 'AxControls.cab' file in the 'AxControlsInstaller' folder.</li>
</ol>
<p>NB! Make sure you use ANSI encoding for the 'AxControls.inf' file or you will be unable to install the control.</p>
<h2>8. Initialize and test the control with JavaScript</h2>
<ol>
<li>Right click the AxControls solution, select Add -&gt; New Project and select 'ASP.Net Web Application' under 'Web'.</li>
<li>Call the project 'WebAppTest' and click OK.</li>
<li>Right click the 'WebAppTest' project, select Add -&gt; New Item and select 'HTML Page'.</li>
<li>Call it 'index.html' and click OK.</li>
<li>Add the following content to index.html:
<pre class="brush: xml; title: ; notranslate">
&lt;html&gt;
    &lt;head&gt;

        &lt;object name=&quot;axHello&quot; style='display:none' id='axHello' classid='CLSID:1FC0D50A-4803-4f97-94FB-2F41717F558D' codebase='AxControls.cab#version=1,0,0,0'&gt;&lt;/object&gt;

      &lt;script language=&quot;javascript&quot;&gt;

        &lt;!-- Load the ActiveX object  --&gt;
        var x = new ActiveXObject(&quot;AxControls.HelloWorld&quot;);

        &lt;!-- Display the String in a messagebox --&gt;
        alert(x.GetText());

      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Note that 'classid' matches the GUID of the HelloWorld control.</li>
<li>Right click 'index.html' and select 'Set as start page'.</li>
<li>Right click the 'WebAppTest' project and select 'Set as startup project'.</li>
<li>Copy 'AxControls.cab' from the 'AxControlsInstaller' folder to the same folder as index.html.</li>
<li>Uninstall the control from the client by going to Control Panel -&gt; Programs and Features, selecting 'AxControlsInstaller' on the list and clicking Uninstall. This forces Internet Explorer to download and install the .cab file and is an important step in case you've already installed the control.</li>
<li>Run the application (F5). This will open 'index.html' in Internet Explorer.</li>
<li>Internet Explorer will display a security warning, asking if you want to install 'AxControls.cab'. Click Install.<img class="alignnone size-full wp-image-301" style="margin-top: 10px; margin-bottom: 10px;" title="ActiveX-Control-11" alt="" src="http://www.olavaukan.com/wp-content/uploads/2010/06/ActiveX-Control-11.png" width="465" height="234" /></li>
<li>When the page loads it should display a message box with the string you defined in HelloWorld's GetText() method.<img class="alignnone size-full wp-image-299" style="margin-top: 10px; margin-bottom: 10px;" title="ActiveX-Control-9" alt="" src="http://www.olavaukan.com/wp-content/uploads/2010/06/ActiveX-Control-9.png" width="218" height="161" /></li>
</ol>
<p>If the message box displayed without any more warnings or errors we've implemented everyting correctly.</p>
<p><strong>UPDATE</strong></p>
<p>I forgot to write that you have to register the assembly containing the ActiveX control for COM interop. Right-click the project, select Properties, go to Build and check the "Register for COM interop" checkbox. This should solve the error some of you are seeing about "Automation Server can’t create this object" and similar error messages. You might need to add the [ComVisible(true)] attribute to the methods and properties you are exposing as well, but I haven't had time to test this.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Share this page</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F08%2Fcreating-an-activex-control-in-net-using-c%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F08%2Fcreating-an-activex-control-in-net-using-c%2F&amp;title=Creating+an+ActiveX+control+in+.Net+using+C%23" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F08%2Fcreating-an-activex-control-in-net-using-c%2F&amp;title=Creating+an+ActiveX+control+in+.Net+using+C%23" rel="nofollow" title="Add to&nbsp;LinkedIn"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Add to&nbsp;LinkedIn" alt="Add to&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F08%2Fcreating-an-activex-control-in-net-using-c%2F&amp;title=Creating+an+ActiveX+control+in+.Net+using+C%23" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F08%2Fcreating-an-activex-control-in-net-using-c%2F&amp;title=Creating+an+ActiveX+control+in+.Net+using+C%23" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Creating+an+ActiveX+control+in+.Net+using+C%23+@+http%3A%2F%2Fwww.olavaukan.com%2F2010%2F08%2Fcreating-an-activex-control-in-net-using-c%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.olavaukan.com/2010/08/creating-an-activex-control-in-net-using-c/feed/</wfw:commentRss>
		<slash:comments>108</slash:comments>
		</item>
		<item>
		<title>Error when editing People Search Core Results Web Part XSL</title>
		<link>http://www.olavaukan.com/2010/03/error-when-editing-people-search-core-results-web-part-xsl/</link>
		<comments>http://www.olavaukan.com/2010/03/error-when-editing-people-search-core-results-web-part-xsl/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 15:34:35 +0000</pubDate>
		<dc:creator>Olav Aukan</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[People Search]]></category>
		<category><![CDATA[Web Part]]></category>
		<category><![CDATA[XSL]]></category>

		<guid isPermaLink="false">http://www.olavaukan.com/?p=259</guid>
		<description><![CDATA[Today I was tasked with removing the "Add to My Colleagues" link from the people search results. I figured this would be easy, just edit the XSL of the People Search Core Results Web Part. I simply commented out the part that added the link: I then went on to save the changes but much [...]]]></description>
				<content:encoded><![CDATA[<p>Today I was tasked with removing the "Add to My Colleagues" link from the people search results. I figured this would be easy, just edit the XSL of the People Search Core Results Web Part. I simply commented out the part that added the link:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;xsl:template name=&quot;DisplayAddToMyColleaguesLink&quot;&gt;
   	&lt;xsl:param name=&quot;url&quot;/&gt;

&lt;!-- Remove &quot;Add to My Colleagues&quot; link

    &lt;a href=&quot;{$url}&quot;&gt;
		&lt;xsl:value-of select=&quot;$AddToMyColleaguesText&quot;/&gt;
    &lt;/a&gt;&lt;br/&gt;

--&gt;

&lt;/xsl:template&gt;
</pre>
<p>I then went on to save the changes but much to my surprise (and horror) the Web Part displayed the following error:</p>
<pre style="padding-left: 30px;">System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)...
</pre>
<p>Of course I assumed I had somehow made the XSL invalid with my editing, so I pasted in the original and clicked Save again, but the error would not go away. Unable to resolve the issue I ended up discarding the checkout and starting all over again. This time I did a simple Select All -&gt; Copy -&gt; Delete -&gt; Paste, but even without making any modifications to the XSL I got the same error.</p>
<p>After some googling I found out that this is a known bug, and the workaround is to simply check in and publish the page. I did so, the error went away, and the "Add to My Colleagues" link was now gone from the search results.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Share this page</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Ferror-when-editing-people-search-core-results-web-part-xsl%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Ferror-when-editing-people-search-core-results-web-part-xsl%2F&amp;title=Error+when+editing+People+Search+Core+Results+Web+Part+XSL" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Ferror-when-editing-people-search-core-results-web-part-xsl%2F&amp;title=Error+when+editing+People+Search+Core+Results+Web+Part+XSL" rel="nofollow" title="Add to&nbsp;LinkedIn"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Add to&nbsp;LinkedIn" alt="Add to&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Ferror-when-editing-people-search-core-results-web-part-xsl%2F&amp;title=Error+when+editing+People+Search+Core+Results+Web+Part+XSL" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Ferror-when-editing-people-search-core-results-web-part-xsl%2F&amp;title=Error+when+editing+People+Search+Core+Results+Web+Part+XSL" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Error+when+editing+People+Search+Core+Results+Web+Part+XSL+@+http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Ferror-when-editing-people-search-core-results-web-part-xsl%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.olavaukan.com/2010/03/error-when-editing-people-search-core-results-web-part-xsl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error when uploading large files to SharePoint running on Windows Server 2008</title>
		<link>http://www.olavaukan.com/2010/03/error-when-uploading-large-files-to-sharepoint-running-on-windows-server-2008/</link>
		<comments>http://www.olavaukan.com/2010/03/error-when-uploading-large-files-to-sharepoint-running-on-windows-server-2008/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 09:00:48 +0000</pubDate>
		<dc:creator>Olav Aukan</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[IIS 7]]></category>
		<category><![CDATA[STSADM]]></category>
		<category><![CDATA[Windows Server 2008]]></category>

		<guid isPermaLink="false">http://www.olavaukan.com/?p=253</guid>
		<description><![CDATA[A client was having problems uploading a 29 MB file to their SharePoint server. Internet Explorer would simply show the "This page can not be displayed" error page, so I figured the maximum upload size was probably set too low.  There's two ways to set this limit; through SharePoint Central Administration or with STSADM. Using [...]]]></description>
				<content:encoded><![CDATA[<p>A client was having problems uploading a 29 MB file to their SharePoint server. Internet Explorer would simply show the "This page can not be displayed" error page, so I figured the maximum upload size was probably set too low.  There's two ways to set this limit; through SharePoint Central Administration or with STSADM.</p>
<h1>Using SharePoint Central Administration</h1>
<ol>
<li>Click Start -&gt; All Programs -&gt; Administrative Tools -&gt; SharePoint Central Administration</li>
<li>Click Application Management -&gt; Web application general settings</li>
<li>On the Web Application General Settings page, click the Web application that you want to change.</li>
<li>On Maximum upload size, type the maximum file size in megabytes that you want,  and then click OK.</li>
</ol>
<p>You can specify a maximum file size of 2047 MB.</p>
<h1>Using STSADM</h1>
<p>To set the max upload size to 100 MB use the following command:</p>
<ol>
<li>Click Start -&gt; Run</li>
<li>Type 'cmd' and click OK.</li>
<li>Type 'stsadm -o setproperty -pn max-file-post-size -pv 100 -url http://server' and hit Enter.</li>
</ol>
<p>However in the client's case the maximum upload size was already set to 100 MB, so clearly this was not the cause of the error. I thought maybe IIS was timing out, but realized that this couldn't be the problem either since the error happened the second the user clicked the Upload button and not 120 seconds later as would be expected with a time out. The default timeout value is 120 seconds, and I confirmed that this had not been changed.</p>
<p>It turns out this is an issue related to Windows Server 2008 when uploading files bigger than 28 MB as described in the bottom of <a title="KB925083" href="http://support.microsoft.com/kb/925083" target="_blank">KB925083</a>. The solution is to add the following snippet of XML to the web application's web.config file after the &lt;configSections&gt; tag.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;system.webServer&gt;
  &lt;security&gt;
    &lt;requestFiltering&gt;
      &lt;requestLimits maxAllowedContentLength=&quot;104857600&quot;/&gt;
    &lt;/requestFiltering&gt;
  &lt;/security&gt;
&lt;/system.webServer&gt;
</pre>
<p>Replace the actual value with the max upload size for you web application in bytes (1 Megabyte = 1048576 Bytes ).</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Share this page</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Ferror-when-uploading-large-files-to-sharepoint-running-on-windows-server-2008%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Ferror-when-uploading-large-files-to-sharepoint-running-on-windows-server-2008%2F&amp;title=Error+when+uploading+large+files+to+SharePoint+running+on+Windows+Server+2008" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Ferror-when-uploading-large-files-to-sharepoint-running-on-windows-server-2008%2F&amp;title=Error+when+uploading+large+files+to+SharePoint+running+on+Windows+Server+2008" rel="nofollow" title="Add to&nbsp;LinkedIn"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Add to&nbsp;LinkedIn" alt="Add to&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Ferror-when-uploading-large-files-to-sharepoint-running-on-windows-server-2008%2F&amp;title=Error+when+uploading+large+files+to+SharePoint+running+on+Windows+Server+2008" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Ferror-when-uploading-large-files-to-sharepoint-running-on-windows-server-2008%2F&amp;title=Error+when+uploading+large+files+to+SharePoint+running+on+Windows+Server+2008" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Error+when+uploading+large+files+to+SharePoint+running+on+Windows+Server+2008+@+http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Ferror-when-uploading-large-files-to-sharepoint-running-on-windows-server-2008%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.olavaukan.com/2010/03/error-when-uploading-large-files-to-sharepoint-running-on-windows-server-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Small Basic &#8211; Because it&#8217;s never to early to start programming!</title>
		<link>http://www.olavaukan.com/2010/03/small-basic-because-its-never-to-early-to-start-programmin/</link>
		<comments>http://www.olavaukan.com/2010/03/small-basic-because-its-never-to-early-to-start-programmin/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 14:16:28 +0000</pubDate>
		<dc:creator>Olav Aukan</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Educational]]></category>
		<category><![CDATA[Programming Language]]></category>
		<category><![CDATA[Small Basic]]></category>

		<guid isPermaLink="false">http://www.olavaukan.com/?p=234</guid>
		<description><![CDATA[I don't remember exactly how old I was when I first started programming, but it was somewhere in early primary school. My dad had just bought us a used Commodore 64 and I started playing around with the Commodore Basic programming language. Those of you who remember BASIC probably also wrote something like this at [...]]]></description>
				<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-235" title="Small Basic" src="http://www.olavaukan.com/wp-content/uploads/2010/03/Small-Basic.jpg" alt="" width="459" height="330" /></p>
<p>I don't remember exactly how old I was when I first started programming, but it was somewhere in early primary school. My dad had just bought us a used <a title="Commodore 64" href="http://en.wikipedia.org/wiki/Commodore_64" target="_blank">Commodore 64</a> and I started playing around with the <a title="Commodore BASIC" href="http://en.wikipedia.org/wiki/Commodore_BASIC" target="_blank">Commodore Basic</a> programming language. Those of you who remember BASIC probably also wrote something like this at one point:</p>
<pre style="padding-left: 30px;">10 PRINT OLAV IS COOL!
20 GOTO 10
RUN
</pre>
<p>Yeah it was fun, but not terribly useful, and doing anything graphical was a nightmare. However it was enough to spur my interest in programming in general, and after a few years on an <a title="IBM PS/2" href="http://en.wikipedia.org/wiki/IBM_Personal_System/2" target="_blank">IBM PS/2 8086</a> with <a title="QuickBASIC" href="http://en.wikipedia.org/wiki/QuickBASIC" target="_blank">QuickBASIC</a> I eventually graduated to <a title="Visual Basic" href="http://en.wikipedia.org/wiki/Visual_Basic" target="_blank">Visual Basic</a> 4.5 with <a title="WinForms" href="http://en.wikipedia.org/wiki/WinForms" target="_blank">WinForms</a> and the rest is history. Had it not been for these early years I might never have become a developer in the first place.</p>
<p>I don't have any kids, but I imagine there's alot of fellow developers out there who do, and I'm sure some of you might already have thought about what your kids will grow up to be one day. I'm not really a fan of parents telling their kids what career to choose, but as Homer Simpson once said "It never hurts to grease the engine a little!".</p>
<p>So if you want your kid to get the taste for programming why not introduce them to <a title="Small Basic" href="http://msdn.microsoft.com/en-us/beginner/ff384126.aspx" target="_blank">Small Basic</a>? It's educational and might be the beginning of a long and prosperous life in the "wonderful world of software development".</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Share this page</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Fsmall-basic-because-its-never-to-early-to-start-programmin%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Fsmall-basic-because-its-never-to-early-to-start-programmin%2F&amp;title=Small+Basic+%26%238211%3B+Because+it%26%238217%3Bs+never+to+early+to+start+programming%21" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Fsmall-basic-because-its-never-to-early-to-start-programmin%2F&amp;title=Small+Basic+%26%238211%3B+Because+it%26%238217%3Bs+never+to+early+to+start+programming%21" rel="nofollow" title="Add to&nbsp;LinkedIn"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Add to&nbsp;LinkedIn" alt="Add to&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Fsmall-basic-because-its-never-to-early-to-start-programmin%2F&amp;title=Small+Basic+%26%238211%3B+Because+it%26%238217%3Bs+never+to+early+to+start+programming%21" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Fsmall-basic-because-its-never-to-early-to-start-programmin%2F&amp;title=Small+Basic+%26%238211%3B+Because+it%26%238217%3Bs+never+to+early+to+start+programming%21" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Small+Basic+%26%238211%3B+Because+it%26%238217%3Bs+never+to+early+to+start+programming%21+@+http%3A%2F%2Fwww.olavaukan.com%2F2010%2F03%2Fsmall-basic-because-its-never-to-early-to-start-programmin%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.olavaukan.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.olavaukan.com/2010/03/small-basic-because-its-never-to-early-to-start-programmin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
