Master page cannot be loaded…

There is an interesting bug in SharePoint Designer: sometimes when you browse SharePoint pages in the design view of the SharePoint Designer, you will see an error stating that the master page cannot be loaded. At that point you get presented with two options: either attach a different master page or work in the code view. Neither of those options actually solves the problem, they just allow you to work around it. I have never liked workarounds; I prefer solving the problems instead of working around them. J

With a little bit research I have found that the reason why my custom master page cannot be displayed in SharePoint Designer is that the default master page (default.master) has been checked out. Once I have checked in the master page, SharePoint Designer went back to displaying my master pages in the design view.

Please note that sometimes SharePoint Designer locks up the pages if you have checked out the page and then closed the application without checking in the page. So, you will have to check out the page and then check it back in. Sometimes, the only way to do is that is through the Site Content and Structure part of the SharePoint site.



Related resources:

Issue with migrating custom list templates

If you're trying to export custom list template (with or without content) from one SharePoint collection or farm to the other, you might notice that your recently imported list template does not appear on the "Create Page" page of that site, which means that you cannot use the new template to create new list. This issue appears to be caused by the fact that your list definition ID of the new custom template is different

The workaround is to:

  • After you have imported your template, go to List templates section (Site Actions >> Site Settings >> List Templates) and write down the Title and Feature ID fields.
  • Now create new empty custom list and call it EmptyList
  • Create new list template based on the EmptyList (Settings >> List Settings >> Save List as Template)
  • Now when you try to create new list, you will see EmptyList on the list gallery. If you hover your mouse over the EmptyList item in the list gallery, your browser's status bar should display the URL similar to:
    http://SHAREPOINT/_layouts/new.aspx?NewPageFilename=EmptyList%2Estp&FeatureId={00bfea22-ec85-4403-972d-ebe475780216 }&ListTemplate=100
  • Replace the NewPageFilename and FeatureId entries with the values noted at the step one. Your new URL will look something like that:
    http://SHAREPOINT/_layouts/new.aspx?NewPageFilename=ImportedListName%2Estp&FeatureId={00bfea71-de22-43b2-a848-c05709900100}&ListTemplate=100
  • Copy modified URL to the address bar and hit Enter
  • Configure the name and the description of the list and hit Create. Your newly created list will be based on the imported list template.

Be cautious of the automatic web part installers

If one beautiful morning your SharePoint designers complain that they now get "The server sent a response which SharePoint Designer could not parse…" error when they try to edit SharePoint page or page layout, and/or your SharePoint developers all of the sudden are unable to access any of the SharePoint services under _vti_bin folder (like _vti_bin/lists.asmx), then check your web.config file. The tags in <httpHandlers> section in web.config file are probably out of order.

<remove verb="*" path="*.asmx" /> tag needs to be posted before any of the <add > tags in <httpHandlers> section in web.config file, otherwise the SharePoint web services path configuration breaks.

In our case this issue was caused by the web part install that incorrectly modified web.config file to configure AJAX in SharePoint. I guess the lesson is always be cautious of the automatic web part installers J

Toronto SharePoint Camp - January 24

It is that time of year again - the Toronto SharePoint Camp taking place next Saturday at Manulife Financial (200 Bloor Street - between Yonge and Jarvis) .  This free event is organized by the people from the Toronto SharePoint User Group and will be of interest to developers, administrators, and end-users alike. 

I'll be doing two developer talks:
- SharePoint 2007: A Developers Primer, and
- Building SharePoint Web Parts from A to Z

The other topics for the 2009 Camp include:
- Integrating SQL Server with MOSS,
- Social Computing with SharePoint and Silverlight,
- Advanced InfoPath Development with SharePoint, and
- MOSS Search: Why it’s not enough to just turn it on

It should be a great turnout so please visit the website and regsiter ASAP to secure your spot.

Elevating Privileges in SharePoint

Here’s a good tip for elevating privileges in SharePoint.

http://blogs.devhorizon.com/blogs/reza_on_blogging/archive/2007/07/12/484.aspx

For those who doesn’t want to click on that link (like myself when I searching for this post again), here’s the code.

//Don't dispose the following two objects. Sharepoint will take care of their disposal when page is completely rendered.
SPWeb  webInUserContext = SPContext.Current.Web;
SPSite SiteInUserContext = SPContext.Current.Site;
Guid webGuid = webInUserContext.ID;
Guid siteGuid = SiteInUserContext.ID;

SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    // get the site in impersonated context
                    using (SPSite site = new SPSite(siteGuid))
                    {

                        // get the web in the impersonated context
                        SPWeb web = site.OpenWeb(webGuid);
                       // Do your work here  

                     web.Dispose();
                    }

               });

There we go. I used this piece of code to access the SPFile of a document within SharePoint. SPFile requires elevated privileges, and can’t be access with just your normal privileges.

My code works now, and I’m happy. :)

Where is my Check-In in SharePoint Designer?

sharepointdesigner-checkin

If you notice, the master page file in SharePoint Designer is checked out (from the check symbol at the side). It’s supposed to show me “Check In” and “Undo Check Out” and all that. Where is it?

It is under your “Edit” toolbar, “Check In”.

image

So when it doesn’t display, you know where to go.

Hiding Sign In Link For Anonymous Access Users in SharePoint

To customize SharePoint “Sign In” link, we need to modify or duplicate Welcome.ascx in your Control Templates directory.

Here’s a good post specifying how to hide your sign in link.

Hide the Sign In link for the anonymous access user in anonymous access enabled site - Bend the Welcome.ascx - SharePoint MOSS

You can play around with Welcome.ascx and come up with your custom style sign in.

SharePoint and Vista: a problem with “Explorer View” and “Create list from spreadsheet”

We have recently encountered a problem with some of the SharePoint (WSS or MOSS) features not working properly in Windows Vista:

  • When users attempt to display a document library in the Explorer view within the web application that uses Kerberos authentication, nothing happens: Explorer view never comes up and no errors displayed either
  • Or, when users attempt to display a document library within the web application that uses NTLM authentication, they get "Your client does not support opening this list with Windows Explorer" error;
  • When users attempt to create list from Excel spreadsheet they get "Method 'Post' of object 'IOWSPostData' failed" error

After a lot of research and many unsuccessful attempts to fix these problems using various solutions found on the web, I have finally able to find a workaround that have worked on Windows Vista 32-bit.

Solutions that did not work in our situation:

  • Installing and enabling WebDav on IIS 7
  • Installing Desktop Experience on Windows 2008 server 64 bit
  • Modifying EXPTOOWS.XLA macro file to force using a different version number
  • Etc…

The workaround that worked:

  • Install hotfix KB945015 on the client machine to fix a bug caused by an extra forward slash mark (/)appended to the query path of a WebDAV PROPFIND request
  • Install Web folder hotfix on the client machine to get Vista map a drive to a web location on SharePoint
  • Map a "Web Network Location" on your PC to the root of the SharePoint site in question and ensure that you save the credentials

This workaround only worked for Windows Vista 32-bit.



Related resources:

Easy(er) ASP.NET Workflow Forms with the WSS 3.0 Workflow Tools

[via Wouter Van Vugt]

WSS3 Workflow Tools helps developers create better WSS 3.0 workflows by providing a development framework and by integrating into the Visual Studio development environment. The primary focus for this first release is on making it easier to create ASP.NET workflow forms.

The first release consists of:

  • Base classes for all workflow form types
  • UserControl framework, quite similar to what InfoPath is providing in MOSS
  • Visual designers for InputForm, InputFormSection, InputFormControl and ButtonSection
  • Visual Studio templates for VS2005 / VS2008, for all forms and controls
  • Easy to use installer

Check it out at http://www.codeplex.com/wss3workflow.

Technorati Tags: [], [], []

Two Great Sites for ASP.NET Developers Who Want to Learn SharePoint 2007

MSDN RampUp - SharePoint for Developers and mssharepointdeveloper.com
Both these sites have articles, webcasts and hands-on labs designed to help .NET developers to learn the key points of SharePoint development. A variety of materials with different learning styles help you get started doing SharePoint 2007 development.

The Great SharePoint Adventure - WSS 3.0 and MOSS 2007 for Developers
If you want more than the quick boost provided by the resources above, you can get a broader and deeper picture by taking our five-day course. It's about 70% instructor demos and labs and you get to take all the code back to the office with you for reference.