Entries categorized as ‘SharePoint’
November 26, 2009 · 1 Comment
Windows 7 and Windows Server 2008 R2 support booting from a VHD directly. No host OS involved. Very nice! It kind of blows my mind a bit to think of the possibilities.
How Does It Work?
It works like a dual boot machine, where you pick your OS option at startup. Instead of having physical disk partitions, you can multi-boot onto a VHD instead of a disk partition. You can boot directly to a VHD running SharePoint 2010 beta for example. You can have as many of these as you need (and have disk space for).
For people limited to 4GB or RAM on a laptop, this can help SharePoint 2010 run much smoother because it has all the physical memory, no memory sharing with the host. Your physical disk is available from the booted OS (VHD becomes C:, and physical disks looks like a D:, E:, etc.). All physical hardware is available, just as if you installed the OS directly to a disk partition.
You can even get it to work with Vista as your main OS on your machine if you’re not ready to rebuild your machine with Windows 7 or Windows Server 2008 R2.
What’s the Catch?
There are a few catches that I’m aware of:
- It only works if the VHD is stored on an internal disk
- The OS on the VHD must be Windows 7 or 2008 Server R2
- Hibernation and bit-locker don’t work when booted from VHD’s. Suspend does work on my Dell D830 after I installed the NVIDEA drivers for my video card.
- It works best with a fixed-size VHD, dynamic VHD disks will run slower
- There is a slight performance hit, around 3%, when compared to a boot from a physical disk. It’s negligilbe, I haven’t noticed a difference at all.
- The vhd is not portable to other boxes due to hardware differences between machines. You can sysprep and image and move it that way.
Great! Now How Do I Set It Up?
I won’t recreate a detailed walkthrough here, but the basic gist of it is this:
- Insert Windows 7 or Windows Server 2008 R2 media
- Boot from the CD like you’re installing the OS normally
- At the first screen, hit Shift-F10 to open a command window
- Use the DiskPart utility to create and mount the vhd. Type DiskPart at the command prompt cnd enter the following commands:
- create vdisk file=C:\VHD-Windows7.vhd maximum=40960
- select vdisk file=C:\VHD-Windows7.vhd
- attach vdisk
- exit
- Close the command prompt and continue setup
- Select the Custom (Advanced) Install option
- Select the VHD disk you created for the install
- That’s it! The Windows installer takes care of the rest.
- If you want more control, you can use BCDEdit or EasyBCD to edit the boot menu
References
If you need a more detailed walkthrough, the best one I’ve seen is here:
If you’re interested in booting a Windows 7 VHD from a system running Vista (I’m not!), you might find these helpful:
Enjoy!
Categories: Boot to VHD · SharePoint 2010 · Virtualization · Windows 7 · Windows Server 2008
If you’ve installed the SharePoint 2010 public beta, you’ve likely run into the WCF bug. This following errors occur when provisioning Service Applications or when accessing pages that make service calls.
System.Configuration.ConfigurationErrorsException: Unrecognized attribute ‘allowInsecureTransport’. Note that attribute names are case-sensitive. (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebClients\<Service Area>\client.config line <Line Number>).
The service application proxy “User Profile Service Application” could not be provisioned because of the following error: Unrecognized attribute ‘allowInsecureTransport’. Note that attribute names are case-sensitive. (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebClients\Profile\client.config line 56).
You may see this error in the ULS logs after installing SharePoint 2010, or displayed on the page as an error message when provisioning service applications or accessing SharePoint pages that make WCF service calls.
How To Fix It
This is a known WCF issue when installing SharePoint 2010 on Windows 7, Windows Server 2008, or Windows Server 2008 R2. It’s, lovingly called the WCF Sharepoint Shared Services Roll-up issue. To fix it, install a WCF OS patch:
KB971831: WCF fix for Windows Server 2008 and Vista only
http://support.microsoft.com/kb/971831
KB976462: WCF fix for Windows 2008 R2 and Windows 7
http://support.microsoft.com/kb/976462
Note: This link is not activated yet, but you can download the WCF fix at http://go.microsoft.com/fwlink/?LinkID=166231
If you have already installed Microsoft SharePoint Server 2010 on a server running Microsoft Windows Server 2008 R2 or Microsoft Windows 7, Microsoft SharePoint Server 2010 does not need to be reinstalled. You can install the WCF fix afterward. However, Service Applications that have been provisioned without the update installed may need to be removed and re-provisioned once the update has been successfully applied.
References
SharePoint Team Blog: Installation Notice for the SharePoint Server Public Beta on Microsoft Windows Server 2008 R2 and Microsoft Windows 7
Jie Lie’s GeekWorld: SharePoint 2010 Pre-Requisites Download Links
Categories: SharePoint 2010 · WCF · Windows 7 · Windows Server 2008 · Windows Vista
I want to get a reference to a SPList object associated with a given list url. This method works with any of the url’s associated with the list, including view page url’s, or list form url’s.
This should be much easier to achieve by using the object model, in my opinion. String parsing of the url is not my favorite, but I couldn’t find a better way to accomplish it.
If you know of an easier way to accomplish this, please leave me a comment. Otherwise, you can steal this from me, if you want it!
/// <summary>
/// Gets an SPList based on the url to the list
/// </summary>
/// <param name="listUrl">Full url to the list</param>
/// <returns>SPList object, null if list is not found</returns>
public SPList GetListByUrl(string listUrl)
{
SPList list = null;
try
{
using (SPSite site = new SPSite(listUrl))
{
if (site != null)
{
// Strip off the site url, leaving the rest
// We'll use this to open the web
string webUrl = listUrl.Substring(site.Url.Length);
// Strip off anything after /forms/
int formsPos = webUrl.IndexOf("/forms/", 0, StringComparison.InvariantCultureIgnoreCase);
if (formsPos >= 0)
{
webUrl = webUrl.Substring(0, webUrl.LastIndexOf('/', formsPos));
}
// Strip off anything after /lists/
int listPos = webUrl.IndexOf("/lists/", 0, StringComparison.InvariantCultureIgnoreCase);
if (listPos >= 0)
{
// Must be a custom list
// Strip off anything after /lists/
webUrl = webUrl.Substring(0, webUrl.LastIndexOf('/', listPos));
}
else
{
// No lists, must be a document library.
// Strip off the document library name
webUrl = webUrl.Substring(0, webUrl.LastIndexOf('/'));
}
// Get the web site
using (SPWeb web = site.OpenWeb(webUrl))
{
if (web != null)
{
// Initialize the web (avoids COM exceptions)
string title = web.Title;
// Strip off the relative list Url
// Form the full path to the list
//string relativeListUrl = listUrl.Substring(web.Url.Length);
//string url = SPUrlUtility.CombineUrl(web.Url, relativeListUrl);
// Get the list
list = web.GetList(listUrl);
}
}
}
}
}
catch { }
return list;
}
Enjoy!
Categories: .Net · C# · MOSS 2007 · SharePoint
I want to thank everyone who attended my session on SharePoint Workflow with Visual Studio at our TechFest event yesterday. Please feel free to post any comments (good or bad) about my presentation or the event.
Demo source code is posted on Nakido until the Techfest site is updated with session content.
SharePoint WorkFlow with Visual Studio – Downloads
SharePoint WorkFlow with Visual Studio – References
Categories: .Net · C# · MOSS 2007 · Microsoft Office · SharePoint · Visual Studio · WSS 3.0 · Workflow
Problem
SharePoint 2007 Web Front End (WFE) servers crashing repeatedly. Environment is SharePoint 2007 (MOSS Enterprise) 64-bit running on Windows Server 2008 Standard. Server was crashing repeatedly with CPU spiking to 100%, blue screen, and server rebooting itself. System log showing BugCheck event (1000) entry with code 0×0000001d:
The computer has rebooted from a bugcheck. The bugcheck was: 0×000000d1 (0xfffff9802ea0ef50, 0×0000000000000002, 0×0000000000000000, 0xfffffa6004e06ed9). A dump was saved in: C:\Windows\MEMORY.DMP.
Resolution
After a lot of troubleshooting, it turns out it was Trend Micro Common Firewall Driver (Trend Micro OfficeScan Client 8.0). When we disabled the firewall, problem resolved.
Categories: MOSS 2007 · SharePoint · WSS 3.0 · Windows Server 2008
Problem:
I’m creating a SharePoint Sequential Workflow using Visual Studio 2008 (SP1) with .Net 3.5 SP1 installed. This is on a Windows 2003 R2 VPC with SharePoint 2007 (MOSS Enterprise) installed on the local machine for development. A Collaboration Portal is installed on a web site with host headers (portal) assigned to port 80.
When I create a new workflow project, the wizard asks for a path to the SharePoint site. I type in my url (http://portal in my case), and the project wizard fails, saying “SharePoint server not installed. Please run Microsoft Office SharePoint Server 2007 setup.“
I’m logged in as the farm administrator. I thought it might be a permissions issue (my farm admin doesn’t have full rights on the domain), so I went back and gave it full Domain Admin rights in case that was the problem. Still failing!!
What the hell?
Resolution:
It turns out that the wizard does some funny business behind the scenes, calling the database directly. When I give my development account (farm admin) account full rights (dbo) to the SharePoint content database for my portal site, bingo! Works like a champ.
After only an hour or two spinning my wheels. Sigh….
Categories: .Net · C# · MOSS 2007 · SharePoint · Visual Studio · Workflow
Building a SharePoint 2007 workflow using WSPBuilder and Visual Studio 2008. Love, love, love the WSPBuilder tool, but the workflow templates could use some work. Ran into this one today…
Problem
I was receiving “Failed on Start (retrying)” errors. SharePoint logs showed “The workflow failed validation” exceptions. This usually means a problem with the .rules files associated with a Declarative Rule Condition.
I changed my While activities to use code conditions instead, and the problem went away. But I really wanted to find the source of the issue. After much trial and error and fruitless searches on the web, I finally found it. Turns out, it was a missing import target declaration in the .csproj file created by WSPBuilder when I created a workflow project using the “WSPBuilder Workflow with Workflow” project template.
Resolution
To fix the problem, opened up the project file and added the missing import target line (in green), below. Evidently, this line tells studio to include the .rules in the assembly.
<Import Project=”$(MSBuildBinPath)\Microsoft.CSharp.targets” />
<Import Project=”$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets” />
Reopened the project, recompile, build wsp, redeploy. Bingo! Now my workflow works with Declarative Rule Conditions, as it should!
Credits
Thanks to Greg G’s post here that pointed me in the right direction.
Categories: SharePoint · Visual Studio · WSPBuilder · Workflow
Ok, this is painfully easy. Setup a Network Place in Windows Explorer, browse to the web site or folder in question, right-click -> Properties.
Duh!! Sometimes the solution is literally staring you in the face! Thanks to Kelly Ballard for pointing this one out.
Categories: SharePoint
The hardest part about this (by far) is figuring out how to publish the page after you’ve made your changes. Every time I need to do it, I have to dig up some old code.
Thought I’d blog it this time, to make it easier on myself next time around.
using Microsoft.SharePoint;
using Microsoft.SharePoint.Publishing;
...
using (SPSite site = new SPSite("http://portal"))
{
SPWeb web = site.RootWeb;
// Check to ensure the web has publishing turned on
if (!PublishingWeb.IsPublishingWeb(web))
{
throw new ApplicationException("Web does not have publishing enabled");
}
// Get a reference to the publishing web and publishing site
PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(web);
PublishingSite pubSite = new PublishingSite(web.Site);
// Get page layout from the page layouts collection
PageLayoutCollection siteLayouts = pubSite.GetPageLayouts(false);
PageLayout myLayout = siteLayouts["/_catalogs/masterpage/MyLayout.aspx"];
// Get a reference to a publishing page
PublishingPageCollection pages = pubWeb.GetPublishingPages();
PublishingPage page = pages["pages/default.aspx"];
// Check out the list item as needed
bool forceCheckout = page.ListItem.ParentList.ForceCheckout;
if (forceCheckout)
{
// Is the page checked out?
if (page.ListItem.File.CheckedOutBy != null)
{
// Throw an exception if the page is checked out
string pageCheckedOut = string.Format("Page {0} is checked out by {1}", page.Url, page.ListItem.File.CheckedOutBy);
throw new SPException(pageCheckedOut);
}
// Check out the page
page.CheckOut();
}
// Change the page layout
page.Layout= myLayout;
// Update the page and check in changes
page.Update();
// Publish the page
// This handles the page checkin and publishing the draft
ApprovePublishingPage(page, "Modified page layout");
}
/// <summary>
/// Approves changes to a publishing page
/// </summary>
/// <param name="page">PublishingPage with changes to be published</param>
/// <param name="comment">Comment associated with the change</param>
public void ApprovePublishingPage(PublishingPage page, string comment)
{
// Check in the page if required
SPFile pageFile = page.ListItem.File;
if (pageFile.Level == SPFileLevel.Checkout)
{
pageFile.CheckIn(comment, SPCheckinType.MajorCheckIn);
}
// Skip these steps if the parent list doesn't support moderation
if (page.ListItem.ParentList.EnableModeration)
{
// If page is in "pending" status, approve it
SPModerationInformation modInfo = page.ListItem.ModerationInformation;
if (modInfo.Status == SPModerationStatusType.Pending)
{
pageFile.Approve(comment);
}
// If page is in draft status, publish it
if (modInfo.Status == SPModerationStatusType.Draft)
{
pageFile.Publish(comment);
}
}
}
Enjoy!
Categories: C# · MOSS 2007 · SharePoint
October 15, 2008 · 1 Comment
So, what version of SharePoint 2007 is on this server? Sounds like an easy question, doesn’t it? Oh, I forgot, this is SharePoint!
SharePoint Server 2007 (including MOSS 2007) or WSS 3.0
Correct Methods
- Central Administration > Operations > Servers In Farm > Database Schema Version – You will see the Database Schema Version in the top of the screen and a list of servers with the version numbers listed in the relevant column against each server in the farm
- Site Settings > Modify All Site Settings > Site Information > Database Schema Version - You will see the schema version of the site content database
- Query the Versions table of the farm configuration database – The entries in this table will show the version number and the date it was applied to the farm
Misleading Methods – The following methods are documented all over the web, but your results may be misleading
- IIS Web Site Properties > HTTP Headers Tab > Custom HTTP headers box which displays a version number – This shows the build version of MOSS at the time the Virtual Directory [Web Application] was created, which is probably not what you’re looking for.
- Add / Remove Programs - Select Microsoft SharePoint Server 2007 or Windows SharePoint Services 3.0 > Click here for support information. This will show the current version of the software installed on a WFE server, but it does not always update and may differ from other servers on the farm. For better results, use the methods listed above instead.
| Cumulative Update KB956056 & KB956057 |
12.0.0.6327 |
| Infrastructure Update KB951695 & KB951297 |
12.0.0.6318 |
| SP1 + KB948945 |
12.0.0.6303 |
| SP1 + KB941274 |
12.0.0.6301 |
| SP1 + KB941422 |
12.0.0.6300 |
| SP1 |
12.0.0.6219 |
| October 2007 public update |
12.0.0.6039 |
| August 24, 2007 hotfix |
12.0.0.6036 |
| RTM |
12.0.0.4518 |
| Beta 2 |
12.0.0.4017 |
| Beta 2 TR |
12.0.0.4407 |
| Office 12 PDC Pre-beta |
12.0.0.311 |
Running a Prior Version Of SharePoint?
If you’re unfortunate enough to be running an older version of SharePoint (SharePoint Portal Services 2003, 2001, SharePoint Team Services, or WSS 2.0), please see SharePoint Portal Services / Team Services – Determine Service Pack Version.
References
Categories: MOSS 2007 · SharePoint · WSS 3.0