I’ve been working with my current client on developing a small SharePoint 2010 intranet for the last few months and it’s tossed up a few interesting requirements. Once of these was for a printable version of their phone list, a carryover from the legacy way in which they distributed contact details to their staff. This proved to be a bit more challenging to provide than I originally expected so I thought I’d share my solution as it might prove useful to other people. Read more…

March 31st, 2011 | Tags: , ,

Having just spent half a day tearing my hair out trying to track down this issue, I thought I’d post the solution here to save someone else the frustration. On my current SharePoint 2010 project, users were getting the typically helpful “An unexpected error has occured” when creating new sites. This would occur even though the users had Full Control on the site in question – if they were granted Site Collection Administrator rights the issue would go away.

Read more…

January 19th, 2011 | Tags: , , ,

While performing some testing as part of my current SharePoint 2007 migration project, I encountered the following error when accessing the Add Users link from People and Groups:

Object reference not set to an instance of an object.   at Microsoft.SharePoint.SPRoleDefinitionCollection.Init()
   at Microsoft.SharePoint.SPRoleDefinitionCollection.Undirty()
   at Microsoft.SharePoint.SPBaseCollection.System.Collections.IEnumerable.GetEnumerator()
   at Microsoft.SharePoint.ApplicationPages.AclInv.InitPage()
   at Microsoft.SharePoint.ApplicationPages.CBaseAclPage.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I also received the same error message when going to the Site Permissions page of the same site. Going to either screen in other sites in the same site collection did not have this issue so at least it wasn’t a wide spread problem.

Read more…

January 17th, 2011 | Tags: , ,

My current project (migrating some web applications from one server farm to another) has been throwing up a variety of errors and issues that I’ve not encountered before and I came across another one today. When going into Content and Structure from the top level site of one of my site collections, I encountered the following error:

The given key was not present in the dictionary

In addition, when going to Site Actions -> Site Settings, the option to Modify Navigation is greyed out. It’s worth noting that going to Site Actions -> Site Settings -> Modify all Site Settings -> Navigation (under Look and Feel) does in fact work.

Read more…

January 10th, 2011 | Tags: , ,

My current project involves the migration of a SharePoint 2007 farm from one server farm to another as part of a company de-merger. As part of this process, the client has elected to purchase Standard licenses for the new infrastructure as most of the Enterprise functionality was being used by the other company. The migration itself has proved to be relatively simple as I simply did a restore of the content databases into fresh web applications in the new server farm and deployed a few customisations that had been made to the environment.

Read more…

January 6th, 2011 | Tags: ,

After returning to work after a wonderfully relaxing festive break, I needed to reboot one of the servers in my clients SharePoint 2007 farm. After rebooting, I tried to get back in Central Administration and immediately received that ever so helpful error message – “Unexpected error has occured”. After enabling full debugging on the web application, I received the following (very much unexpected!) error:

This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms

Read more…

December 14th, 2010 | Tags: ,

I’m currently in the middle of building a new MOSS 2007 server farm and hit an error I’ve not encountered before. It’s a standard medium server farm with two web front-end servers and an application server. Everything worked okay during installation and while running the configuration wizard but as is my normal habit I decided to reboot all servers in the farm prior to logging in to Central Administration for the first time. I like to do this to review the event logs post reboot to see if anything odd shows up.

Read more…

December 6th, 2010 | Tags: , ,

I came across a bit of an obscure problem earlier today while doing some content creation on my current project. The solution is a SharePoint 2010 intranet with minor customisation – mainly some branding and some custom XSL for aggregations. Nothing complex. It also has some JQuery that does some manipulation of the quick launch (or left navigation) to automatically place links to Pages beneath a Pages heading since they appear as top level headings in the navigation by default. This isn’t a perfect solution but it does the job for this project…or it seemed to until this afternoon.

I was running through various areas of the site creating some dummy content when I noticed that the JQuery wouldn’t fire when I was browsing an Images library in a site. I noticed there was a javascript error telling me that an object was required on the first line of my JQuery. The same code worked perfectly on every other page of the site (including other libraries/lists) so I didn’t think my JQuery was at fault. After a bit of messing around trying to figure out what was going on I started going through a process of elimination trying to locate what was causing the issue and eventually determined that it was only occuring on the Thumbnails view of the Images library. If I changed the view to the standard All Items view, the JQuery would work as expected. Odd!

I decided to take a copy of the source HTML that was being generated on both the All Items and Thumbnails views and compare them using Windiff to try and identify what was different (other than presentation obviously) between the two views. I eventually narrowed it down to the following Javascript which is loaded in the Thumbnails view:

<script type=”text/javascript”>
          var g_Rev = <xsl:value-of select=”concat($squote,ddwrt:GetCurrentBuildVersion(),$squote)”/>;
          var g_AllowSilverlightPrompt = <xsl:value-of select=”ddwrt:AllowSilverlightPrompt()”/>;
          <![CDATA[
          var g_APD_ScriptsLoaded = 0;
          var g_APD_CsssLoaded = 0;
          function APD_CallbackWssView(who)
          {
            if("function" == typeof(window.status)) window.status('Boot Strap Callback from ' + who);
          }
          function SmtAddWindowLoadEvent(handlerFunc)
          {
            if (window.attachEvent)
            {
                window.attachEvent("onload", handlerFunc);
            }
            else if (window.addEventListener)
            {
                window.addEventListener("load", handlerFunc, false);
            }
          }
          function APD_EnsureLoadHandlers()
          {
            EnsureScript("CMSSiteManager.js", typeof(AssetPickerPageCache), APD_LoadHandlers);
          }
          function APD_LoadHandlers()
          {
            g_AssetPickerPageCache = new AssetPickerPageCache();
            g_AssetPickerXslContext = new AssetPickerXslContext();
            EnsureScript("AssetPickers.js", typeof(AP_IsEmpty), APD_InitializeAssetPickerElements);
          }
          function APD_SimpleCacheControl()
          {
            return g_Rev;
          }
          function APD_AddStyleSheet(hrefValue)
          {
            if (!document.getElementsByTagName
            || !(document.createElement || document.createElementNS)) return;
            var head = document.getElementsByTagName("head")[0];
            var link = document.createElement(“link”);
            link.setAttribute(‘type’, ‘text/css’);
            link.setAttribute(‘rel’, ‘stylesheet’);
            link.setAttribute(‘media’, ‘screen’);
            var rev = APD_SimpleCacheControl();
            var url = hrefValue + “?rev=”+rev;
            link.setAttribute(‘href’, url);
            head.appendChild(link);
            return false;
          }
          function APD_AddScript(hrefValue)
          {
            if (!document.getElementsByTagName
            || !(document.createElement || document.createElementNS)) return;
            var loc = document.getElementsByTagName(“head”)[0];
            var rev = APD_SimpleCacheControl();
            var link = document.createElement(“script”);
            link.setAttribute(‘type’, ‘text/javascript’);
            var url = hrefValue + “?rev=”+rev;
            link.setAttribute(‘src’, url);
            loc.appendChild(link);
            link.onload = function ()
            {
              g_APD_ScriptsLoaded++;
              if(“function” == typeof(window.status)) window.status(“Script #” + g_APD_ScriptsLoaded + ” loaded”);
            }
            return false;
          }
        ]]>
          if(document.g_APD_isFFScriptLoaded == undefined)
          {
          APD_AddStyleSheet(<xsl:value-of select=”concat($squote,$StylePath,’/portal.css’,$squote)”/>);
          APD_AddScript(<xsl:value-of select=”concat($squote,$LocScriptPath,’/CMSSiteManager.js’,$squote)”/>);
          APD_AddScript(<xsl:value-of select=”concat($squote,$LocScriptPath,’/AssetPickers.js’,$squote)”/>);
          APD_AddScript(<xsl:value-of select=”concat($squote,$NonLocScriptPath,’/MediaPlayer.js’,$squote)”/>);
          SmtAddWindowLoadEvent(APD_EnsureLoadHandlers);
          document.g_APD_isFFScriptLoaded = true;
          }
</script>

This script is found in %HIVE%\TEMPLATE\LAYOUTS\AssetPicker.xsl and I have absolutely no idea what it does but wanted to confirm if this was the cause of my problems so commented the block of code out (yes, I edited the hive directly – bad bad – but was only doing this for troubleshooting purposes and obviously took a backup copy of the file first!) to see what would happen. Success! The JQuery fired again.

Now this code obviously does something useful so just commenting it out isn’t a great option. I wanted to narrow down further what exactly was causing the issue so did some very amateurish troubleshooting and started adding functions back in one by one until the JQuery started to fail again. This revealed that the guilty line was:

APD_AddScript(<xsl:value-of select=”concat($squote,$LocScriptPath,’/CMSSiteManager.js’,$squote)”/>);

Opening CMSSiteManager.js revealed that it contained over 3000 lines of what may as well have been hieroglyphics given my basic understanding of Javascript which meant I was a bit stuck. Before making a desperate cry for help, I thought the issue through some more and wondered if the problem was that this script was being called AFTER I’ve included the JQuery code in the heading of the master page. I moved the import of both the JQuery library and my custom javascript file to the end of the master page (just before the closing body tag) and low and behold, everything started working!

So…I have no idea which of those 3000+ lines in CMSSiteManager.js caused the issue but it seems like if you want to use JQuery on any pages that reference that file (no, I don’t know how many other files do!) then you need to ensure you import JQuery and any dependent scripts after that reference…or at the end of the page to be safe.

If anyone can provide any more information on this or narrow down more specifically what the cause is than please let me know in the comments!

December 2nd, 2010 | Tags: ,

As mentioned in a couple of previous posts (here and here), I’ve been using Amazon EC2 as my development environment for a couple of months now. I started this process as part of an internal investigation into improving the performance of the development environments at Content and Code where I have worked for the last five years. My colleague, Tristan Watkins, has carried on this investigation and has just completed a fantastic series of posts about his findings which you can read through here:

Read more…

December 1st, 2010 | Tags: ,

I was asked today to extract the information stored in a large Excel spreadsheet and re-format it for a SharePoint 2010 intranet. The desire was for each row of data in the spreadsheet to be presented on the intranet as a page of web content so that it could be presented in a more readable way. Most of the work was pretty simple - some custom fields, a new content type and a new page layout – but the spreadsheet contained around 300 rows meaning a very tedious content creation exercise for someone.

Not wanting that someone to be me, I decided to look into automating the creation of the pages via Powershell. My coding skills are amateurish at best so I’m sure there’s a better method of doing this but I thought I’d put this up anyway as I couldn’t quickly find any other posts that could give me exactly what I wanted.

Read more…