Posts

Showing posts from April, 2010

Getting a usable SPItem URL to a display form

This is definitely from the "I can't believe I hadn't blogged this already department". When you try to use the SPListItem.Url property you wind up getting a url that's relative to the site (even though it starts with a '/'). I've written this method that will return a list item url and takes into account the fact that the urls differ when they're lists or document libraries: private string GetItemUrl(SPListItem listItem)         {             string result;             string itemUrlTemp = listItem.Url.Replace("Lists/", "");             string siteRelativeListUrl = itemUrlTemp.Substring(0, itemUrlTemp.IndexOf('/'));             if (listItem.ListItems.List.BaseTemplate == SPListTemplateType.DocumentLibrary)                 result = SPEncode.UrlEncodeAsUrl(String.Format("{0}/{1}/Forms/Dispform.aspx?ID={2}", listItem.ListItems.List.ParentWeb.Url, siteRelativeListUrl, listItem.ID));             els

Setting up a SharePoint 2010 Developer VM using VirtualBox

I spent a few hours this weekend creating a SharePoint 2010 Developer environment using the RTM. For now, I'm approaching my dev build the same way I had my MOSS 2007 VM set up - a standalone MOSS install with Visual Studio installed. Because I wanted to use a 64bit guest OS (64bit Server 2008), I decided to use VirtualBox as my VM solution, if you want to use VirtualBox, you can get it here . I should note that when I set up my VirtualBox VM I gave it 20GB of hard drive space which was not enough so I had to expand the drive ( described later orange text ). I'd suggest going to 40 or more if you can because Windows,SP2010, SQL, and Visual Studio take up about 18GB (and setting it up right the first time will save you from having to do this . Once I had Server 2008 installed on a VirtualBox VM I downloaded the RTM version of SharePoint from MSDN. I then attached the SharePoint 2010 .iso file to my VM, opened the mounted SharePoint 2010 image and ran the Prerequisite

Expanding a VirtualBox VDI file for Server 2008 x64 R2

I use virtual box as my SharePoint VM host because I want to be able to run 64bit Server 2008 R2 on my Windows 7 host machine.   When I first installed SharePoint 2010, the VDI (Virtual Disk for VirtualBox) I created was too small, so I had to expand it.   This is a bit of a challenge, but by doing some research I figured out how to do it. The process involves creating a new, larger disk and copying the original boot and main partitions to the newer disk.   This can be done with gparted .  and the steps to do so are well documented here However there are a few more steps you'll need to follow because you are using 64bit Server 2008 R2: After you've followed the above instructions, mount the newer larger drive as the Primary Master and mount the Server 2008 R2 ISO. Boot to the ISO (hitting any key when prompted) Choose your language then on the next screen select repair Select the partition and click ok Choose the command line option Switch to your c: drive Type bootr