Thursday 28 January 2010

Creating Custom Controls - Back to basics

Sometimes you just need to stop and go back to the basics.

Yesterday I had some problems with nested controls in a custom control that was added to a Web part. The nested controls were losing their post back information, in the end it came down to a forgotten Interface, the INamingContainer. The INamingContainer is that small piece of magic that gives your composite control a new ID Namespace which uniquely identifies your control and all of its sub controls.
It is also worth noting that you need to add the child controls to the collection before setting their values for the TrackViewState() to be called, though you can do this manually.

Now I am going back to my old reference books to see what else I have let slip.

Wednesday 22 July 2009

Anonymous Access SharePoint WCM Site prompting for login in IE only.

Watch out for those SharePoint anonymous access demons, while a new site that I have been working on was going through testing on its way to UAT we encountered an odd bug where only IE 6-8 would request a login box when loading some pages, we traced this down to one Custom control that was pulling an item from a SharePoint list and displaying some images with their description.

As this was not an issue in other browsers we concluded that it was not the control or a case that the images were not published (though we checked to be sure), after a long night and a few tufts of hair lost to frustration I had a look at the html output, there plain as day was the culprit, an image tag with no alt or source, I have come across this before and could kick myself for it but what happened was the developer simply fetched the value of the image field and rendered the html supplied by SharePoint. When no image Url is supplied SharePoint outputs a blank image tag like this <img src=”” alt=””></img>, this tag causes IE to try and authenticate the user(don’t know why never botherd to look any deeper).

So the lesson learnt Don’t trust SharePoint’s Html it can be a Demond in disguise.

Tuesday 21 July 2009

SharePoint 2010 and the NDA

I have been lucky enough to be working with the next release of SharePoint 2010 through the TAP program and have wondered what I can and can’t say about it, Joel Oleson has recreantly posted a helpful blog in regards to what we can and can’t say(What’s Up? NDA or NOT? Office 2010 Technical Preview vs. SharePoint 2010 Technical Beta), Till the NDA is lifted I won’t be saying much other than so far I have found 2010 to be looking really good and I can’t wait for it to move on to RTM.

For those that are interested.
My SharePoint 2010 environment is all beta/rc at the moment
Windows Server 2k8 R2 RC hyper-v Host with Windows Server 2k8 R2 RC VMs
With SQL 2008 running as the backend database on one.

So far so good, look forward to sharing what I have found in the future.

Friday 8 May 2009

Finding the language packs installed on a SharePoint Server

I spent a hour or sow looking for a way to find all the installed languages on a server so I could update one of the XML files via a feature (I will post later about Installing a Theme across multiple front end servers targeting multiple languages).

The file I want to modify was SPTHEMES that is located at TEMPLATE\LAYOUTS\{LCID}\SPTHEMES.XML, There is a unique file for each language.
I thought that there must be a class in the OM that would allow me to get the installed languages. After diving in to the SPFarm object, digging in the NewSitePage class and a number of web searches while still getting no where I stumbled on the most simple class. (YaY for Reflector)

SPRegionalSettings and its GlobalInstalledLanguages property.

SPRegionalSettings.GlobalInstalledLanguages is a collection of SPLanguage objects.
each SPLanguage object is a simple data object that contains DisplayName and a LCID propriety.

so with this simple for loop I managed to avoid messing around with searching through the File system.

foreach (SPLanguage language in SPRegionalSettings.GlobalInstalledLanguages)
{
DoSomthingWith(language);
}

Sometimes the simple solution takes the longest to find.
Hope this helps someone.

Tuesday 5 May 2009

A New SharePoint blogger

One of my bosses has started blogging about his experiences skinning SharePoint sites and the work he has done to create a simple CSS frame work that can be used Making SharePoint Beautiful

More than worth a look at some of the secreats behind the magic he has created.

Wednesday 18 March 2009

SharePoint Best practices conference - UK

Looking forward to the SharePoint Best Practices Conference in London comming up this April

for more info see

Thursday 5 March 2009

Twitter And Me

Well i have made the jump in to the Twitter pond you can find me at http://twitter.com/jcvivian not that there will be mutch looking at my blogging history :P

I am trying out the Blu Client though TweetDeck and the like seem to be better clients i just cant bring my self to install yet another platform, I dont have java installed for the same resion.

John