Posts Tagged ‘Tips’

Tools for your SharePoint 2013 development toolbox

January 18th, 2014 by Tobias Zimmergren

Author: Tobias Zimmergren | |


Some of my students, clients and community peers have asked about my favorite tools for working with SharePoint. So with that in mind, I quickly noted down some of my favorite tools that every developer should have in their toolbox. I’ve written posts about this before but as times and technology moves forward, new tools and techniques are evolving. I may post about the tools I recommend for IT-Pros at some point, but right now let’s stay on track with the dev-focus.

If you think I’ve missed out on some great tools, let me know by commenting on the article and I’ll make sure to include it in the post!

Recommended development tools

Here’s a brief list of tools that I would recommend for any SharePoint solution developer. At the very least, I would assume that you already have Visual Studio 2012 or Visual Studio 2013.

CAML Designer 2013

Historically I’ve been using some kind of CAML query generator since the U2U CAML Query Builder tool was released. There’s really no other efficient way to build your CAML queries than have the stubs auto-generated with a tool. For SharePoint 2013 I am now solely using the CAML Designer tool available from

The application is a lot more enhanced than any predecessors and I highly recommend that you download it right away unless you’ve already done so. There’s some tweaks that has to be made in the tool before it’s feature complete, but hey it’s a community tool and the best one I’ve used thus far in the area. The best part is the auto-generated code samples that goes with your query. Yum!

Quick Highlights:

  • Autogenerate the actual CAML Query
  • Autogenerate Server OM code
  • Autogenerate CSOM .NET code
  • Autogenerate CSOM REST code
  • Autogenerate Web Service code
  • Autogenerate PowerShell code

    If you investigate the tool you’ll see that it does not only generate the CAML query itself, but also code-snippets for various technologies for you to copy and paste into your code as a stub to work with. Simple, elegant and so far it only crashes every now and then ;-)



    SharePoint Manager 2013

    Since a friend of mine, Carsten Keutmann, started working on the SPM (SharePoint Manager) tool I have been impressed with it. It has been in the community for a long time and now the 2013 version is pretty slick. Simple and intuitive interface which allows you to quickly and easily navigate down the farm and investigate settings, properties, schema XML and so on. Most of the things in your SharePoint environment can be investigated from this tool.

    So unless you have downloaded this tool already, go get it now. Pow!



    ULS Viewer

    I still keep getting the question about what tool I use to parse my ULS Logs. Honestly, there’s no alternative to the ULS Viewer. I’ve written about logging previously, including the ULSViewer tool: In SharePoint 2013 I use this tool on a daily basis, but I also use the built-in ULS viewer in the Developer Dashboard.

    ULS Viewer Windows Application Screenshot:

    ULS Viewer in the Developer Dashboard:

    For information about how to enable the developer dashboard and launch it, check out my mate Wictor’s blog:

    Windows version download:

    CKS Dev

    A plugin for Visual Studio that is a killer-feature you can’t live without, is CKS:Dev. A team of awesome folks in the community have put together this amazing extension to Visual Studio and it now have support for 2013 as well. It allows you to manage your development routines more efficiently while you are on a coding adventure, it adds a bunch of new project items for your SharePoint projects and contributes to an overall satisfactory SharePoint developer story. You need this extension. Period.


    Color Palette Tool for Branding

    With SharePoint 2013 comes new possibilities for branding. A lot of people are accustomed to wobbling up their own custom CSS files and have a designer do most of the branding parts. If you’re just looking to create new composed looks for SharePoint 2013 without too much effort, you should use the SharePoint Color Palette Tool, provided by Microsoft!



    Debugger Canvas

    A few years ago I blogged about a tool called Debugger Canvas. A tool that can aid you in the debugging process. I’m not using it every day, but when I switch it on it really nails it! What can I say, if you hate the tedious normal debug execution and you want a better and more hierarchical way of displaying your trace in real time, enjoy debugger canvas awesomeness. All the code in your current calls displayed in one view type of thing. You’ve got to check it out.

    Note: The debugger canvas is for VS 2010 Ultimate. I’m not sure if they’ve gotten around to port it up to VS 2012 or VS 2013 yet; But if you’re lingering with 2010 Ultimate, you should get this now. Period.

    (Screenshot is from the Visual Studio Gallery)


    SharePoint 2013 Search Tool

    As we all know search is one of the biggest things in SharePoint 2013. This tool allows us to learn and understand how the queries can be formatted and allows us to easily configure a Search REST Query. Pretty slick if you ask me. Use the tool to create the queries for you, then you can analyze them and better understand how to tweak and modify the output. Great job with the tool!



    Fiddler. Always use Fiddler!

    For most experienced web developers, Fiddler has been a constant tool in the basket. It is an addition to many of the existing tools you can use, but it’s extremely slick for analyzing SharePoint requests on the client side. I’ve saved countless hours by using this awesome tool to analyze the requests and responses from SharePoint. Download it, learn it, use it.



    SPCAF – SharePoint Code Analysis Framework

    My friend Matthias Einig created a tool called SPCAF which analyzes your solutions and code. Truly a beneficial tool in your toolbox that will aid you in the direction of awesomeness. If you’ve developed crappy solutions, you’ll know it before you ship it off to production environments. It integrates with Visual Studio, there’s a stand-alone client application and you can even have it hooked up to your build process – something I’m doing with my Iterative Development Processes.

    (Image from


    .NET Reflector from Red Gate

    It’s no secret that we want to peek into other peoples’ code. With the .NET reflector from Red Gate you can do just that. It’s an awesome reverse-engineering tool which allows you to peek into the code of a compiled assembly! I use it to debug Microsoft.SharePoint*.dll assemblies and to investigate third-party assemblies.



    F12 Debugging experience in your browser

    As Anders mentions in the comments, I forgot to mention the most obvious one. The F12-experience in your web browser. It enables you to debug and investigate HTML, CSS, JavaScript and other resources on your web pages on the client. Internet Explorer, Google Chrome and FireFox all have some type of developer tools available. For me personally, I use Chrome as my main debugging tool and IE for verification. I seldom use Firefox anymore to be honest.

  • How to use F12 Developer Tools to Debug your Webpages
  • How to access the Chrome Developer Tools

    PowerShell Tools for Visual Studio

    As Matthias points out in the comments, there’s another great extension for Visual Studio called PowerShell Tools for Visual Studio. It allows you to get syntax-highlighting on your PowerShell files directly in Visual Studio.




    Are you developing Apps for SharePoint 2013? Steve Curran commented about using the SPFastDeploy tool that he has created. It’s a great extension for quickly pushing changes to your dev site without having to re-deploy the entire app. Pretty neat!

    (Image from Steve Curran’s blog)


    Advanced REST Client plugin for Google Chrome

    As pointed out by Peter in the comments, there’s an awesome plugin for Chrome called Advanced REST Client which allows you to investigate the REST calls and configure your queries pretty simply through the UI. You get to see the results and the request times directly in the browser and you can play with the parameters etc easily until you get it just right. Great tip!



    Postman – REST Client plugin for Google Chrome

    The previous REST Client I mentioned above is awesome, and here’s another really great tool that AC tipped us about. The Postman REST Client plugin for Google Chrome. Similar to the previous plugin for Chrome, but slightly different for the one who prefers that tool instead. An idea is to try them out both and figure out which one you like best yourself.



    SharePoint 2013 Client Browser

    As pointed out in the comments by André, the SharePoint 2013 Client Browser is a tool similar to SharePoint Managed which I’ve mentioned above in this article. With this tool you can connect remotely to a SharePoint environment and investigate the data through the Client API’s. In my screenshot I’m connected from my laptop to my Office 365 SharePoint Online dev-account for development. Pretty sweet!


  • Download:

    Note: There’s a similar tool available called SharePoint Explorer 365, which also allows for connecting to Office 365 which can be found here ( I prefer the previously mentioned one though, the SharePoint 2013 Client Browser, but that’s a matter of preference.


    I can’t believe I originally forgot to put this in. Thanks to the tip in the comments from Caroline I got around to add it to the list here. Smtp4dev is an awesome tool for testing out if SharePoint are sending its e-mails properly, but instead of actually sending the e-mails to the recipients (which may not be wanted if you’re testing on real data for example..) it will catch all e-mails sent through the smtp server and allow you to view them directly in the tool’s UI. It’s pretty neat, and I do use it a lot when working with things related to e-mails and specifically automated processes where e-mails may be sent at various points in time but you still need to verify the logic and correctness.




    So there you go. For everyone who asked what common tools I keep in my toolbox; There’s the most common ones.

    If I missed to mention a tool, feel free to enlighten me and perhaps I can add it to the post.


    Author: Tobias Zimmergren | |

    Introduction to the problem

    It’s not uncommon when upgrading to SharePoint 2013 from a previous version of SharePoint that you’ll get encoded claims usernames in the places you may have seen normal usernames (DOMAIN\Username) syntaxes before. In my case it was a matter of finding a ton of custom code and have it check whether the username was a claims encoded username or not.

    This is what we saw:


    However, what we really wanted our code to output was this:


    There’s a good reason for why the username that is claims encoded look the way it does. The format tells us what type of claim it is. Wictor has done a nice breakdown and explained the claims here:

    The solution to this problem

    There’s a pretty simple solution for this that it looks like a lot of people are missing out on. The code snippets I’ve seen in the last project are all parsing the string manually with custom logic and then trying to determine on a string.split() if it is a claim and what type of claim it is.

    Instead of going down that dark and horrible road, you should take a look at the built-in functions in the API that does this just fine for us:

    private string GetUsernameFromClaim(string claimsEncodedUsername)
        using (new SPMonitoredScope("GetUsernameFromClaim method start"))
                SPClaimProviderManager spClaimProviderManager = SPClaimProviderManager.Local;
                if (spClaimProviderManager != null)
                    if (SPClaimProviderManager.IsEncodedClaim(claimsEncodedUsername))
                        // return the normal domain/username without any claims identification data
                        return spClaimProviderManager.ConvertClaimToIdentifier(claimsEncodedUsername);
            catch (Exception ex)
                // You should handle any exceptions in here instead of ignoring them!
                // Logger.Log("An exception occured in the GetUsernameFromClaim() method");
                return claimsUsername; // Or just return the original username.
            // Return the original username value if it couldn't be resolved as a claims username
            return claimsUsername;


    Since I saw so many places in the previous few projects where people have been referencing custom methods for string-splits to sort out the claims usernames into default domain\username formats, I thought you’d benefit from knowing that there’s a built-in method for that. Nothing fancy, but worth to know about it.

    Check out these resources for additional and more in-depth information about related things:

    Programmatically converting login name to claim and vice versa, by Waldek Mastykarz

    How claims work in SharePoint 2010, by Wictor Wilén

    Enjoy this quick tip.

    Author: Tobias Zimmergren | | @zimmergren


    So recently, while working with the (awesome!) Work Management Service Application in some of our environments, we got the common problem of not receiving any actual tasks on our My Sites. The reason is that we see this message instead:

    Last updated at 1/1/1901 12:00 AM

    Now, throw a google query and you’ll find plenty of resources and fixes for how to configure the permissions of your Service Applications in order to make this service work.

    My Solution

    Due to various policies, restrictions and IT related stuff we couldn’t just configure permissions in any way we wanted. So we needed to figure out another way to fix this simple problem.

    The solution is simple, for us:

    • Delete your Work Management Service Application
    • Re-create a new Work Management Service Application
      • Create a new Application Pool, but use the same account as for the Application Pool hosting your My Sites/Social or Portal.
    • Run a crawl
      • Incremental, continuous or full crawl should suffice.
    • Bingo.

    In some scenarios this may work, in others it may not work. For our various farms (Test, Pre-Production, Production) it works great, and given it works in 3 different environments (with different accounts et al) it’s pretty neat.

    After the crawl did it’s job, I could start engaging the Tasks list on my My Site with collective tasks throughout my entire farm:


    Looks like it did the trick, and the tasks are now working like a charm including all data related to the task.


    Other options

    If this still doesn’t work,  check this TechNet article out about configuring the service permissions. Doing the above and configuring the permissions should definitely do the trick (

    And here’s another tip if you’re still having issues:


    Instead of messing about with permissions (for various reasons) we’ve managed to get it started and working with simply configuring the same Application Pool account. Should that not suffice, a combination will more likely work.

    Author: Tobias Zimmergren | | @zimmergren


    In one of the projects I’m currently involved, we’re in the process of upgrading from SharePoint 2010 to SharePoint 2013. One of the problems we faced were the fact that we had some orphaned content databases in our production environments, but the problem didn’t surface in SharePoint 2010 but was given light in 2013. So this short post is talking about how I fixed those issues, which was a bit of a pain to be honest.

    In the environments we’re working, we’ve set up a scheduled upgrade that takes place once every week on a schedule. The reason for this is to re-iterate the upgrade process as many times we can, with production data, before the actual upgrade which will take place later down the road when all bugs, code tweaks/customizations and other random problems have been taken care of. One of the problems that surfaced recently was that we couldn’t create any new Site Collections, where the ULS spit out the unfortunate message:

    Application error when access /_admin/createsite.aspx, Error=Object reference not set to an instance of an object.  
    at Microsoft.SharePoint.Administration.SPContentDatabaseCollection.FindBestContentDatabaseForSiteCreation(IEnumerable`1 contentDatabases, Guid siteIdToAvoid, Guid webIdToAvoid, SPContentDatabase database, SPContentDatabase databaseTheSiteWillBeDeletedFrom)

    While it took some time to boil down the nuts of what was going on, here’s the details in case you end up with the same issues.

    Cannot create new Site Collections

    So the problem we faced of not being able to create new Site Collections surfaced itself in the ULS logs, stating this message:

    Application error when access /_admin/createsite.aspx, Error=Object reference not set to an instance of an object.  
    at Microsoft.SharePoint.Administration.SPContentDatabaseCollection.FindBestContentDatabaseForSiteCreation(IEnumerable`1 contentDatabases, Guid siteIdToAvoid, Guid webIdToAvoid, SPContentDatabase database, SPContentDatabase databaseTheSiteWillBeDeletedFrom)    
    at Microsoft.SharePoint.Administration.SPContentDatabaseCollection.FindBestContentDatabaseForSiteCreation(SPSiteCreationParameters siteCreationParameters, Guid siteIdToAvoid, Guid webIdToAvoid, SPContentDatabase database, SPContentDatabase databaseTheSiteWillBeDeletedFrom)    
    at Microsoft.SharePoint.Administration.SPContentDatabaseCollection.FindBestContentDatabaseForSiteCreation(SPSiteCreationParameters siteCreationParameters)    
    at Microsoft.SharePoint.Administration.SPSiteCollection.Add(SPContentDatabase database, SPSiteSubscription siteSubscription, String siteUrl, String title, String description, UInt32 nLCID, Int32 compatibilityLevel, String webTemplate, String ownerLogin, String ownerName, String ownerEmail, String secondaryContactLogin, String secondaryContactName, String secondaryContactEmail, String quotaTemplate, String sscRootWebUrl, Boolean useHostHeaderAsSiteName, Boolean overrideCompatibilityRestriction)    
    at Microsoft.SharePoint.Administration.SPSiteCollection.Add(SPSiteSubscription siteSubscription, String siteUrl, String title, String description, UInt32 nLCID, Int32 compatibilityLevel, String webTemplate, String ownerLogin, String ownerName, String ownerEmail, String secondaryContactLogin, String secondaryContactName, String secondaryContactEmail, Boolean useHostHeaderAsSiteName)    
    at Microsoft.SharePoint.ApplicationPages.CreateSitePage.BtnCreateSite_Click(Object sender, EventArgs e)    
    at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)    
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Given some reflector magic and investigations I found out that this specific method causing the problem was looking for the best Content Database to put the new Site Collection in. While it was trying to do this, it obviously want to balance the Site Collections in a way that means they’re evenly distributed over the Content Databases.

    The reason for why we got this error message is due to invalid references in our Config database pointing to Content Databases that no longer exist, for whatever reason. The result of this is that the method tried to create the new Site Collection into a Content Database that doesn’t really exist, even though SharePoint thought it existed.

    Steps to find and kill the broken/invalid references to the non-existent content databases

    After some SQL magic, finding out the null-references were rather easy. Following these steps allowed me to figure out the details of the broken databases:

    Step 1: Get the Web Application ID

    Either use SharePoint Manager or simply a quick PowerShell statement to quickly figure out the GUID of your Web Application where the problem is persisted:

    $wa = Get-SPWebApplication

    Obviously you should note/save this ID for reference in the next steps.

    Step 2: Query your Config database for the appropriate information

    Save this ID, head on over to your SQL server and run this command (replace GUID with your ID from Web App)

    USE SP13_Config
    SELECT ID, CAST(Properties as XML) AS 'Properties'
    FROM Objects
    WHERE ID = 'GUID' -- GUID of the Web Application

    As you can see when using the CAST(Properties as XML) bit of the query, you can get a clickable link in the results window given you an awesome overview of the XML represented. Thanks to a SQL friend of mine for pointing that out, saved the day :-)

    Here’s what the results looks like (1 row):


    Step 3: Investigate the returned results (XML) and find your null-values

    Click the XML link and find this section containing the Microsoft.SharePoint.Administration.SPContentDatabaseCollection and see if you find any place where the fld value is null, something like this:


    As you can see, most of the databases in our environment has a sFld and a fld xml node where the GUID of the database are stored. However in some cases (in 2 places in our environment!) you may find that it says null instead. That is essentially your invalid reference pointing to nothing at all. So SharePoint tries to create the Site Collection in the Content Database with the null-fld.

    As with previous steps, make a note of the GUID from your broken database references.

    Step 4: Delete the database(s) using PowerShell

    The best way we found to delete these databases were by using PowerShell. At first I didn’t think it actually worked, but after re-running the SQL query after running the PowerShell command it occurred to me that the command had actually removed the invalid reference. The reason for why I didn’t think it worked is because PowerShell is throwing some errors on the screen for you, but it looks as if it’s actually working the right magic under the hood for us – thus leaving us with an intact and working farm again.

    So, make sure you’ve got the ID’s of your broken databases and first and foremost make sure that you haven’t copied the incorrect GUID (!) – what I did was simply query my Web Application and filtered the query to give me the ID and Names of all Content Databases so I could make sure that I didn’t delete an actual Content Database by mistake.

    Verification command:

    $wa.ContentDatabases | ft ID, Name

    After running this command we got a list of databases where we could just make sure that the GUID’s we’ve coped didn’t actually represent any of our real databases that were intact:


    Great, now that I’m sure the ID of the databases I copied isn’t the ID of a production DB which I know is intact, but represents my broken ones, I can execute the delete-command on those buggers!

    In order to do that, I simply ran this PowerShell command:


    The results of this were as follows, causing a lot of nice error messages.. However, the magic under the hood still worked:


    Step 5: Verify by running the SQL query again

    So the PowerShell throws an error message stating that “Object reference not set to an instance of an object.”, however under the hood the magic has been applied properly and in my Config-database the values that were incorrect are now deleted as can be verified if we re-run the SQL query:



    Well, I’ve learnt a lot this week about the Config database and playing around with the GUIDs within. The scary part was that these errors didn’t surface in SharePoint 2010, but they did in 2013 once we upgraded. Another good reason to get a good iterative upgrade-routine in place before an actual upgrade is attempted.

    Speaking about iterative upgrade processes I might discuss that in a future post, namely how we commence our upgrades every week without lifting a finger (almost) :-)


    Twenty (20) Rich Text Editors to use in your applications

    July 14th, 2009 by Tobias Zimmergren

    Author: Tobias Zimmergren 
    URL: |


    Lately I’ve been looking around for some decent rich text editors for use in my (and SharePoint) applications.

    I found this awesome article explaining 20 free rich text editors you can use, some better than others:

    My favorite ones

    As for which ones I would call my favorite (based on functionality, compatibility, performance and ease of deployment) – I would have to say:

    Just be sure to read the license for each of the different editors. Some are GPL/LGPL, others are completely unlicensed and some uses other licensing models.

    Have fun :-)

    Zimmergren MOSS 2007 Tip #2: Retrieve stuff by code

    April 5th, 2007 by Tobias Zimmergren

    This is by no means meant to be anything other than a small tip on how to interact with the object model. If you need more information on how to interact and code with the object model, drop me a comment. But for now this is just to show you guys out there who havn’t done any coding with SharePoint, that it’s actually a piece of cake!

    Start off by creating a new Visual Studio 2005 Windows Forms application.

    Add the following namespaces: (Administration-namespace might not be needed depending what you want to do further from this point)

    Also make sure you’ve got something in the Recyclebin that will show up when we launch our application later:

    I made an interface like this, really hot:

    Then just add the following simple code:

    That’s all there’s too it! It’s not hard at all to interact with the object model. As you can see I’ve used the commonly used SPSite which contains the SPRecycleBinItem. From this point, you should know how to move on with this. An example, all you need to do in order to enable deletion of things in that recyclebin from your application is to use the .Delete() method of the SPRecycleBinItem called rItem in this case.

    All very basic, should get you interested if nothing else!

    Zimmergren MOSS 2007 Tip #1: Anonymous Access

    March 18th, 2007 by Tobias Zimmergren

    This is the first post I’m making in a series of small "how-to’s" and "aha!"-posts. It will be basic stuff that you often want to know, and why not write them down here instead of in a hidden document that I’ll forget about..

    Today’s tip is: Enabling Annonymous Access to your site

    1. Begin by navigating to central administration (CA from now)
    2. Choose Application Management
    3. Choose Authentication Providers in the Application Security section
    4. Select the correct web application
    5. Click the Default Zone link
    6. Check Enable Anonymous Access and hit Save

    From the Permissions-page in your site you can choose Settings -> Anonymous Access and from there make ajustments to what permissions anonymous access will have.

    MOSS 2007: Search and Indexing

    November 16th, 2006 by Tobias Zimmergren

    In this post I will show you how to configure search by creating a content source that should be indexed and a search scope to limit the results when searcing. I will also show you how to customize the Search Center and adding a tab with a custom search and search results page.

    I will walk you though how to set up searchscopes and content sources (such as fileshares).

    We will begin by creating a content source and a search scope This will presume that youve got a network share with files and folders, e.g. the share whateversomeShare mapped against Z: on your local system.

    1. Open SharePoint Central Administration and the Shared Services Provider admin site.
    2. Open the Search Settings page
    3. Choose the Content Sources link in the Crawl Settings section.
    4. Choose New Content Source in the toolbar menu
    5. Enter a name (I used "Demo Documents")
    6. Choose File Shares as Content Source Type
    7. Enter the start address (e.g. whateversomeShare)
    8. Choose if it should include all subfolders or not under Crawl Settings
    9. Set a schedule of your preference and choose to start the crawl if you want, then click OK
    10. It should now look something similar to this image:

    Screendump (Image broken due to crash )


    Now you need to start the crawl, if you didn’t do so when creating the content source

    Creating a scope to narrow down the search results to only file shares
    1. Navigate to Site Settings
    2. Click on View Scopes in the Scope Settings section
    3. Click Create New Scope in the toolbar and enter e.g. "File Shares" as the name and click OK
    4. Note that the "Items" column states "Empty".
    5. Click on the name (File Shares) to navigate to the Scope Properties and Rules page
    6. Select "Empty > Add rules"
    7. Select "Demo Documents" in the Content Scope and press OK to create the rule.
    8. Now note that it says "New Scope – Ready after the next update (starts in n minutes)." To avoid this waitint time, go back to the Search Settings and click "Start Update Now" under the Scopes section.
    9. Click the Site Settings menu at the top right of this site collection and choose Search scopes
    10. Click the "Search Dropdown" display group and then check the "File Shares" scope and click OK.
    11. Go to the Search Center to validate that the scope actually works and shows in the drop down

    T2617 – Introduction to SharePoint 2007

    October 26th, 2006 by Tobias Zimmergren

    Monday through wednesday (today) I went the T2617 course held by Göran Husman, Sweden’s only MVP in sharePoint. The overall impression was great, and my thanks goes out to Göran who did a great job as the tutor.

    I will in my upcoming post(s) describe some of the subjects covered, and what that really means. I will set up a MOSS 2007 labenvironment on which I’ll make some examples and try to explain some general concepts that are new for 2007.

    I’ll update you guys in a couple of days.

    Creating a custom Master Page for your MOSS 2007 portals and sites

    September 28th, 2006 by Tobias Zimmergren

    When I first started discovering Master pages I didn’t know where to start and what would be needed in order for a basic and as minimalistic master page as possible to work.
    I gathered information to be able to make myself a minimal masterpage which would be the startingpoint of my upcoming customizations and changes.
    At first nothing worked, and since there’s no good list of what elements and contentplaceholders are needed for a masterpage to work it had to do with a lot of “trial-and-error” until I finally had a completely working basic master page.
    With the help of google and some other sites around the web I noted which placeholders showed up on every master page.
    Below you will see the code for a very very basic master page, in which you can insert your own custom html-tags and assign a css-theme later to make your customizations a reality.
    With this small template, you can make all your existing static designs work as a master page if you just put a little time and effort into it.
    ######### Page file starts here ############
    <%@ Master language=”C#” %>
    <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” ““>
    <%@ Import Namespace=”Microsoft.SharePoint” %>
    <%@ Register Tagprefix=”SPSWC” Namespace=”Microsoft.SharePoint.Portal.WebControls” Assembly=”Microsoft.SharePoint.Portal, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
    <%@ Register Tagprefix=”SharePoint” Namespace=”Microsoft.SharePoint.WebControls” Assembly=”Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
    <%@ Register Tagprefix=”WebPartPages” Namespace=”Microsoft.SharePoint.WebPartPages” Assembly=”Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
    <%@ Register Tagprefix=”PublishingWebControls” Namespace=”Microsoft.SharePoint.Publishing.WebControls” Assembly=”Microsoft.SharePoint.Publishing, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
    <%@ Register Tagprefix=”PublishingNavigation” Namespace=”Microsoft.SharePoint.Publishing.Navigation” Assembly=”Microsoft.SharePoint.Publishing, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
    <%@ Register TagPrefix=”wssuc” TagName=”Welcome” src=”~/_controltemplates/Welcome.ascx” %>
    <%@ Register TagPrefix=”wssuc” TagName=”DesignModeConsole” src=”~/_controltemplates/DesignModeConsole.ascx” %>
    <%@ Register TagPrefix=”PublishingVariations” TagName=”VariationsLabelMenu” src=”~/_controltemplates/VariationsLabelMenu.ascx” %>
    <%@ Register Tagprefix=”PublishingConsole” TagName=”Console” src=”~/_controltemplates/PublishingConsole.ascx” %>
    <%@ Register TagPrefix=”PublishingSiteAction” TagName=”SiteActionMenu” src=”~/_controltemplates/PublishingActionMenu.ascx” %>
    <WebPartPages:SPWebPartManager runat=”server”/>
    <SharePoint:RobotsMetaTag runat=”server”/>
    <head runat=”server”>
    <asp:ContentPlaceHolder runat=”server” id=”head”>
    <asp:ContentPlaceHolder id=”PlaceHolderPageTitle” runat=”server” />
    <Sharepoint:CssLink runat=”server”/>
    <asp:ContentPlaceHolder id=”PlaceHolderAdditionalPageHead” runat=”server” />
    <body onload=”BLOCKED SCRIPT_spBodyOnLoadWrapper();”>
    <form runat=”server” onsubmit=”return _spFormOnSubmitWrapper();”>
    <wssuc:Welcome id=”explitLogout” runat=”server”/>
    <PublishingSiteAction:SiteActionMenu runat=”server”/>
    <PublishingWebControls:AuthoringContainer id=”authoringcontrols” runat=”server”>
    <PublishingConsole:Console runat=”server” />
    <asp:ContentPlaceHolder id=”PlaceHolderMain” runat=”server” />
    <asp:Panel visible=”false” runat=”server”>
    <asp:ContentPlaceHolder id=”PlaceHolderSearchArea” runat=”server”/>
    <asp:ContentPlaceHolder id=”PlaceHolderTitleBreadcrumb” runat=”server”/>
    <asp:ContentPlaceHolder id=”PlaceHolderPageTitleInTitleArea” runat=”server”/>
    <asp:ContentPlaceHolder id=”PlaceHolderLeftNavBar” runat=”server”/>
    <asp:ContentPlaceHolder ID=”PlaceHolderPageImage” runat=”server”/>
    <asp:ContentPlaceHolder ID=”PlaceHolderBodyLeftBorder” runat=”server”/>
    <asp:ContentPlaceHolder ID=”PlaceHolderNavSpacer” runat=”server”/>
    <asp:ContentPlaceHolder ID=”PlaceHolderTitleLeftBorder” runat=”server”/>
    <asp:ContentPlaceHolder ID=”PlaceHolderTitleAreaSeparator” runat=”server”/>
    <asp:ContentPlaceHolder ID=”PlaceHolderMiniConsole” runat=”server”/>
    <asp:ContentPlaceHolder id=”PlaceHolderCalendarNavigator” runat =”server” />
    <asp:ContentPlaceHolder id=”PlaceHolderLeftActions” runat =”server”/>
    <asp:ContentPlaceHolder id=”PlaceHolderPageDescription” runat =”server”/>
    <asp:ContentPlaceHolder id=”PlaceHolderBodyAreaClass” runat =”server”/>
    <asp:ContentPlaceHolder id=”PlaceHolderTitleAreaClass” runat =”server”/>
    ######### Page file ends here ############
    As you can see there’s a javascript method in the body-tag called SpBodyOnLoadWrapper. This class is automatically loaded by MOSS 2007 and handles javascript calls.
    SPWebPartManager is needed for functionality and events to work as desired. Also handles web part controls if I’m not mistaken.
    The PlaceHolderMain placeholder is the placeholder that contains the page content and what not. Still unsure on the details about these placeholders, so bear with me will you.
    The contentplaceholders within the <asp:panel>-block are nessesary to maintain full out-of-the-box functionality for pages to work with your own defined masterpage.
    I hope this will guide you in the right direction as to starting with master page-customization. The possibilites are endless but time isn’t, therefore you can without any problems just copy/paste the above code and it should work wonders right away.