Sunday, October 17, 2010

Virtual Box Virtual Images won’t start after upgrading

After a few weeks of vacation and some other projects I started using Virtual Box again. As as usual I needed to update the application. I downloaded the new version (3.2.10), also noticed that it’s now all Oracle stuff. I started my a old virtual machine, however I always failed after a few seconds. Created a new virtual machine and again.

I tracked it down to the Storage section. Normally the VM configuration used the IDE controller. However in the new version I noticed that the virtual hard disk was mounted on the SATA controller.

So by default it looks like it attaches the VHD to the SATA Controller. I changed this back, so the VHD is now mounted on the IDE controller.

This fixed the problem, I can now start the VHD without problems. Probably an existing Windows 2008 VHD doesn’t like switching from IDE to SATA.

Monday, May 10, 2010

Running Hyper-V images with Sun VirtualBox

If you want to run your Hyper-V created or downloaded machines on Sun VirtualBox, you might experience some problems. When settings in VirtualBox are incorrect the image won’t start. I first thought it’s was about conflict with Hyper-V Integration Services or incompatibility between the Hyper-V vhd and VirtualBox. But luckily it’s just some configuration of VirtualBox to make it work.
So I have a SharePoint 2010 Hyper-V image and Next week I need to give a training and needed to use Sun VirtualBox as Hyper-V doesn’t run on Windows XP. So I copied the Hyper-V virtual hard disk to my local machine and followed the following steps.
  • Start VirtualBox
  • Create a new Virtual Machine
  • Do the basic settings
  • Add the Hyper-V virtual hard disk
  • Set IO APIC enabled in the Systems Tab (this is is important, otherwise it will hang after like 20 seconds on startup)

  • Start the VM in VirtualBox
  • Stopped the Hyper-V services and set startup type to: Manual

  • Installed the VBoxGuestAdditions for better integration with the virtual machine.
If you didn’t set the correct settings the virtual machine does start however after about 20 seconds (depending of your hardware) it hangs forever, and looks like this:

Thursday, April 15, 2010

Daily and Weekly SharePoint 2010 Site Collection backup using Powershell

Backup instructions for Site Collection, read TechNet http://technet.microsoft.com/en-us/library/ee748617(office.14).aspx
I want to backup the site collection daily and keep a backup of every week of the year. I created a Powershell script and scheduled the script.

The Powershell script does the following:

  • checks if SharePoint Powershell Snapin is loaded;
  • checks if backup location exists;
  • backups the site collection;
  • copies the daily backup to the weekly if necassary;

The ‘Backup Site Collection.ps1’ code:

"-------------------------------------"
"Yellow & Red SharePoint Backup script"
"-------------------------------------"
"- One daily backup"
"- And weekly backup"
#Backup location
$backupLocation = "\\XXX\d$\_backups\XXX\"
#Site collection location
$sitecollection = "http://XXX"
#daily filename
$dailybackupfile = Join-Path -Path $backupLocation -ChildPath "backup_yarintranet_daily.bak"
#weekly filename (using uformat as format doesn't have week option)
$weeklybackupfile = Join-Path -Path $backupLocation -ChildPath ("backup_yarintranet_" + (Get-Date -UFormat %Y%W) + ".bak")
# check to ensure Microsoft.SharePoint.PowerShell is loaded
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null) {
    Write-Host "Loading SharePoint Powershell Snapin"
    Add-PSSnapin "Microsoft.SharePoint.Powershell"
}
if(!(test-path $backupLocation -PathType Container))
{
    "Backup location (" + $backupLocation + ") not found."
    break
}
"Starting backup process"
Backup-SPSite -Identity $sitecollection -Path $dailybackupfile -Force
"Finshed backup process"
"Copy daily backup to weekly if necessary"
if((test-path $weeklybackupfile -PathType Leaf))
{
    "Weekly backup file found, so no backup will be made"
    break
}
copy $dailybackupfile $weeklybackupfile -Force
"Finished"

 

Schedule the a task using the Windows 2008 scheduler.

image

Make sure that:

  • you set the correct Identity that has access to the backup location;
  • task runs even when user is not logged in;
  • Set interval of script execution in ‘Trigger’ tab;

image 

In ‘Action’ Tab set the execution of the Powershell script:

  • Program/script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
  • Arguments: -file "<full path location to your Site Collection backup Powershell script>" (exclude the <, include the ")

And as always, make sure you test your backup. Otherwise you’ll have a very bad day when disaster strikes.

Wednesday, April 14, 2010

SharePoint 2010 - PDF iFilter comparison

Very interesting results in the PDF iFilter products for SharePoint 2010 (beta). Check out this article. Foxit wins big time.

Thursday, April 8, 2010

Schema.xml, onet.xml and baseview doesn’t pick up scope attribute

Again some strange things with SharePoint 2010 (maybe also with MOSS 2007) when using custom list template and a list view web part. It turns out that not all settings from the schema.xml are used in the web part view.

So I created a list template based on document library, added a custom view like this:

<View BaseViewID="41" Type="HTML" WebPartZoneID="Main" DisplayName="LatestChanges" Scope="Recursive" DefaultView="FALSE" TabularView="FALSE" MobileView="FALSE" MobileDefaultView="FALSE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/dlicon.png" Url="Forms/LastChanges.aspx">
        <XslLink Default="TRUE">main.xsl</XslLink>
        <RowLimit Paged="TRUE">10</RowLimit>
        <Toolbar Type="Standard">
        </Toolbar>
        <ViewFields>
          <FieldRef Name="DocIcon" />
          <FieldRef Name="LinkFilename" />
          <FieldRef Name="Modified" />
          <FieldRef Name="Editor" />
        </ViewFields>
        <Query>
          <OrderBy>
            <FieldRef Name="Modified" Ascending="FALSE" />
          </OrderBy>
        </Query>
        <ParameterBindings>
          <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noitemsinview_doclibrary)" />
          <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noitemsinview_doclibrary_howto2)" />
        </ParameterBindings>
      </View>

The view should display the last 10 modified documents, without showing folders. So I changed the Rowlimit, the Orderby and set Scope attribute to Recursive.

To provision a site with a page, with (my custom) document list I added this line to the onet.xml:

<List FeatureId="f8525c7b-c680-4431-94aa-4bb6e55827b5" Type="10000" Title="$Resources:core,shareddocuments_Title;" Url="$Resources:core,shareddocuments_Folder;" QuickLaunchUrl="$Resources:core,shareddocuments_Folder;/Forms/AllItems.aspx"/>

Make sure the web part is set to the correct view added this line to the onet.xml:

<View List="$Resources:core,shareddocuments_Folder;" BaseViewID="41" WebPartZoneID="TopRow" WebPartOrder="2" />

After depoying, and testing the provisioned page with the web part view is created and it looks like all settings of the BaseViewID, in this case 41, are copied to the view settings of the web part. However it does not copy all settings, the Scope="Recursive" is not copied. It turns out that the Scope="Recursive" should be set on the <View> element in the onet.xml itself. So the onet.xml should have a line like this:

<View List="$Resources:core,shareddocuments_Folder;" BaseViewID="41" Scope="Recursive" WebPartZoneID="TopRow" WebPartOrder="2" />

Now the scope is set correctly and the folders are not shown in the web part.

BTW: I don’t know if this is a bug. However when you change the web part view by hand and select the view ‘LatestChanges’, than it does copy the Scope attribute.

“Open the tool pane” javascript error in SharePoint 2010

I was running into trouble when using the out-of-the-box RSS Feed Web Part of SharePoint 2010 on a publishing page. Especially when the Web Part wasn’t configured with a RSS feed, because it shows the following message:
image

If you want to configure the RSS Web Part, you click “Open the tool pane” link. However it displays the following javascript errors:
image

 image

Not much help in this error. A work-around would be to set the publishing page in Edit mode, and than click the “Open the tool pane” link. Not very user friendly.

The “open the tool pane” link calls a function MSOTlPn_ShowToolPane2. Strange thing is that when the Publishing Page is in Edit mode and clicking the “open the tool pane” link doesn’t raise the error. After some research I found out that the “Edit mode” includes a javascript file named “ie55up.js”.

I included the ie55up.js in the Master Page using the <SharePoint:ScriptLink> and it solved the problem.

<SharePoint:ScriptLink language="javascript" name="ie55up.js" OnDemand="false" runat="server" />

Make sure you set OnDemand="false", otherwise the javascript file will not be loaded.

Monday, March 29, 2010

<customError mode=”off”> doesn’t seem to work

I got some strange situation at first. I got a default custom error message when calling search in SharePoint 2010. I first changed the <customError mode=”Off”> tag in the web.config of the current web application. However that didn’t change anything.

I noticed that the page that showed the error was <website URL>/_layouts/, so I checked the <14-hive>\TEMPLATE\LAYOUTS\, and there it was, a web.config. I contained the line:

    <customErrors mode="On" />

So I changed it to “Off”, and worked as expected.

Thursday, March 25, 2010

Navigation options in Onet.xml in SharePoint 2010

I was building some site templates and tried to set the option “sub sites” for Top navigation, but not for the Quicklaunch. After reading these blogs: http://blogs.msdn.com/vesku/archive/2007/03/23/controlling-navigation-options-from-the-onet-xml.aspx and http://sharepointbergen.blogspot.com/2007/03/controlling-site-navigation-in-site.html I noticed there were some changes in SharePoint 2010 navigation when using the publishing feature.

Here are the new properties that are in SharePoint 2010:

  • GlobalDynamicChildLimit
  • CurrentDynamicChildLimit
  • GlobalIncludeSubSites
  • GlobalIncludePages
  • CurrentIncludeSubSites
  • CurrentIncludePages
Note I:
IncludeSubSites and IncludePages still work, however they set the value for of the subsite and page property of both the Global and Current section.
Note II:
The (misspelled) property AutomaticSortingMathod still works, but you can also use AutomaticSortingMethod.