Tuesday, May 26, 2009
When changed through the API or ONET.XML, the following is true:
Site Master Page is set via SPWeb.CustomMasterUrl (Publishing Pages use this)
System Master Page is set via SPWeb.MasterUrl (Forms and Views pages use this)
Try it at home (the code below doesn't work with sub sites):
In Visual Studio, create a new C# Windows Project, Console Application. Add a reference to the Microsoft.SharePoint namespace. In the Program.cs file, paste this just inside the static void Main(string[] args):
try
{
string siteURL = "http://changethistoyoursite";
string newCustomMasterUrl = "/_catalogs/masterpage/???.master"; //replace ??? with your master
string newMasterUrl = "/_catalogs/masterpage/???.master"; //replace ??? with your master
using (SPSite site = new SPSite(siteURL))
{
using (SPWeb web = site.OpenWeb())
{
string relativeUrl = (site.ServerRelativeUrl);
if (relativeUrl == @"/")
relativeUrl = "";
Console.WriteLine("Current settings: ");
Console.WriteLine("MasterUrl:" + web.MasterUrl);
Console.WriteLine("CustomMasterUrl: " + web.CustomMasterUrl);
Console.WriteLine();
Console.WriteLine("Changing to: ");
Console.WriteLine("MasterUrl:" + relativeUrl + newMasterUrl);
Console.WriteLine("CustomMasterUrl: " + relativeUrl + newCustomMasterUrl);
web.MasterUrl = relativeUrl + newMasterUrl;
web.CustomMasterUrl = relativeUrl + newCustomMasterUrl;
web.Update();
Console.WriteLine("Changed.");
Console.WriteLine();
Console.WriteLine("Changed to: ");
Console.WriteLine("MasterUrl:" + web.MasterUrl);
Console.WriteLine("CustomMasterUrl:" + web.CustomMasterUrl);
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.WriteLine();
Console.WriteLine("Press ENTER to exit.");
Console.ReadKey();
Reference:
http://msdn.microsoft.com/en-us/library/bb687712.aspx
Saturday, May 09, 2009
"The crawler could not communicate with the server. Check that the server is available and that the firewall access is configured correctly.."
This error sometimes shows up in the Crawl Log in the SSP.
The issue in my case was a custom database that the crawler account did not have access to. Of course an easy way to figure this out is to login to the website as the crawler account -- to see what it sees... It worked. A quick adjustment of SQL permissions and voila, we're crawling again.
Pesky little thing. MS introduced a loopback security check for websites accessed locally on the server.
To fix:http://support.microsoft.com/kb/896861
Click Start, click Run, type regedit, and then click OK.
In Registry Editor, locate and then click the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
Right-click Lsa, point to New, and then click DWORD Value.
Type DisableLoopbackCheck, and then press ENTER.
Right-click DisableLoopbackCheck, and then click Modify.
In the Value data box, type 1, and then click OK.
Quit Registry Editor, and then restart your computer.
Monday, April 27, 2009
Here is an error that is somewhat puzzling. But the solution was simple enough.
When converting an existing Microsoft Virtual PC instance to WMWare, I got this error:
Unable to load the source virtual machine or image. The file might be corrupt, or of an unsupported format.

The Log Info link directed me to C:\Windows\Temp\vmware-temp\
Opened vmware-converter-0.log file to find this:
[#3] [2009-04-27 19:28:38.626 'App' 5696 verbose] [,0] DISKLIB-LIB : Failed to open 'D:\VPC\MOSSDEV\CommonStore.vhd' with flags 0x15 (The system cannot find the file specified).
The VPC to be converted references a VHD file in a different folder than where the .VMC file is. Apparently the wizard is looking for .VHD files in the same folder, regardless of the actual setting...
A quick edit of the VPC settings (remove or move the VHD file) and all is well.
Sunday, November 02, 2008
Wednesday, October 29, 2008
When deploying custom SPOneTimeSchedule job definitions sometimes the timer service (OWSTIMER.EXE) just sorta sits there. Your job definition is created, but isn't executed. It will most likely eventually run, but I have better things to do than sit around wait for it. Setting the time for the job in the past seems to move things along faster.
// Create new job
CustomJob MyJob = new CustomJob(Constants.JOB_NAME, webApp, properties.Definition.DisplayName);
MyJob.Title = Constants.JOB_TITLE;
// Set up the job to run once
MyJob.Schedule = new SPOneTimeSchedule(DateTime.Now.AddHours(-4));
MyJob.Update();
Monday, September 29, 2008
Do you know the difference between .Net CLR versions? Is 2.0.50727.1433 newere than 2.0.50727.42? What's the difference?
Here is a nice reference:
http://alt.pluralsight.com/wiki/default.aspx/Keith/DotnetVersionWiki.html
Tuesday, July 15, 2008
What should be a simple engagement turned into a headache this evening. Importing from Excel in Sql 2005 has become more cumbersome due to various 'issues' with the import/export wizard. So here is a good solution:
SELECT * INTO XLImport4 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=C:\test\xltest.xls', [Customers$])
May have to enable Ad Hoc Remote queries in SAC.
May have to place the Excel file on the SQL server's file system.
Reference: http://support.microsoft.com/kb/321686/en-us
Wednesday, June 18, 2008
Today I was finishing up an application to be used in MOSS. It's been a fun process building this app with another developer at work. He did the biz objects (using a 3rd party framework our company owns to hide the data layer) and I'm putting together the UI. Setting up use cases was handy. When it comes to UI controls, there are several ways to bind data to them. But having a clear visual map of where the UI needs to be helps focus on the actual work, instead of guessing how many pixels to the left of the drop down the NEW button needs to be. I'll let the designer worry about that. :) CSS rocks!
This evening setup Windows Mobile Center on my Vista Ultimate. Of course I crashed Vista before I could make the Q sync or even connect. The solution is to unplug the Q before installing MDC. Once MDC is happily running, plug in Q and sync away. Happy world! That was a nice distraction. Now back to WSS 3.0 web parts and wsp building.
Thursday, June 05, 2008
Bill Gates was at the Tech Ed in Orlando. I found a spot about 5 rows back so I could actually see him. He looked pretty real. All those rumors about him being projected on the stage with secret holographic technology are untrue. :) He's actually leaving the board of Microsoft (going part time) to work full-time on his Foundation's board.
Overall the whole Tech Ed experience is awesome. 6000 developers (some females too) from all over the world. Ran into a guy from Denmark. He works for a beer company. How cool can that be? SharePoint and beer...
I still can't get my mind wrapped around Silverlight. Though I do belive it has its uses especially for Intranet implementations. But - as someone pointed out - it won't be long before SilverLight is pushed down by a Windows Update to ALL PCs running Windows. So public implementations of Silverlight applications are just a stone throw away.
SWAG is in full swing. Got a bunch of T-shirts and such. Oh, almost forgot,
Andrew Connell signed his new book,
Professional SharePoint 2007 Web Content Management Development: Building Publishing Sites with Office SharePoint Server 2007
. As far as I'm concerned, he "wrote the book" on customizing Moss (Heather Solomon is my other hero). It was like seeing a celebrity.
Actual solutions. I'm getting convinced about upgrading to
Visual Studio Team Server. It's possible to track bugs and EVEN maybe not too long from now let my designer have access to the same files the developers are working on USING Expression Web. I'm optimistic Mr. Gates will make it happen.
I'm looking forward to some sessions on SharePoint on Thursday and Friday.
Andrew Connell is presenting on Thursday and
Rob Bogue on Friday.
My wife is flying in to Orlando tomorrow. Can't wait to see her. We're headed off to Daytona for the weekend. In a convertible and all...