Archive for May, 2012

Multilanguage in Navigation using Webtemplate does not work

May 15, 2012

I created a webtemplate ( in SharePoint and added following localized Navigation Bar to the top the navigation in the onet.xml:

<NavBar Name="$Resources:osrvcore,SspAdministrationTopNavBarTitle;" ID="1002">
<NavBarLink Name="$Resources:osrvcore,HelpText;" Url="default.aspx" />

then I created a web site based on the template and turned the multilanguage on.

The problem is that the navigation bar stays always in one language and is never localised to current language of the website. If I use the same xml file in the sitetemplate everything works correctly.

The problem is recognized as designed by Microsoft and there is only workaround available.


  1. Delete the navigation from the onet.xml
  2. Recreate the Navigation with code.

Creating the navigation programmatically

  • Create the xml file called navigation.xml with the navigation and let it be deployed to the layouts folder. The file should have following structure:
<?xml version="1.0" encoding="utf-8" ?>
<NavBar Template="templatename">
<NavBarLink Url="$Resources:cmscore,List_Pages_UrlName;/page1.aspx" Name="$Resources:osrvcore,HelpText"/>
 <NavBarLink Url="$Resources:cmscore,List_Pages_UrlName;/page2.aspx" Name="$Resources:osrvcore,HelpText"/>
  • Load the xml file:
public IList<NavigationNode> GetNavigation(string templateName)
var fileName = SPUtility.GetGenericSetupPath("TEMPLATE\\LAYOUTS\\navigation.xml");
var navigation = new List<NavigationNode>();
var data = new XmlDocument();
var xpath = string.Format("/NavBars/NavBar[@Template='{0}']/NavBarLink", templateName);
var nodes = data.SelectNodes(xpath);

foreach (XmlNode node in nodes)
navigation.Add(new NavigationNode
Name = node.Attributes["Name"].Value,
Url = node.Attributes["Url"].Value

return navigation;
  • Add the navigation nodes to the top navigation. There is also handling if the url contains resources that have to be replaced
foreach (var navigationNode in GetNavigation(templatename))
var parsedUrl =  ParseNavigationUrl(navigationNode.Url, web.Language);
var spNavigationNode = new SPNavigationNode(navigationNode.Name, parsedUrl, true);
private static string ParseNavigationUrl(string url, uint language)
var resourceExpression = GetResourceExpressionFromString(url);
if (string.IsNullOrEmpty(resourceExpression))
return url;
var localizedString = SPUtility.GetLocalizedString(resourceExpression, string.Empty, language);           return url.Replace(resourceExpression, localizedString);
private static string GetResourceExpressionFromString(string text)
if (string.IsNullOrEmpty(text))
return string.Empty;
var dollarIndex = text.IndexOf("$");
var semicolonIndex = text.IndexOf(";");
if ((dollarIndex == -1) || (semicolonIndex == -1))
return string.Empty;
return text.Substring(dollarIndex, semicolonIndex - dollarIndex + 1);

SharePoint 2013 v15 What’s new?

May 2, 2012

I recently found following document SharePoint 15 Technical Preview Interoperability API Documentation. Here can we find some parts of the new SharePoint 15 API.

Here are some information, which you could find interesting. Please keep in mind, that what I write here are only guesses and I can be totally wrong.

Market place

I found following classes: SPApp, SPAppCatalog, SPAppInstance. These new classes suggest that Microsoft will release a market place for the next version of SharePoint. What role will be playing Sandboxed Solution. There exists even a licensing model for the marketplace. The SPWebapplication was extended with the method IsUserLicensedForEntity. The Application will be loaded into SPWeb according to the methods SPWeb.LoadAndInstallApp. You can read more about it here. However in czech.

Extensive usage of JSON

There are following new classes JsonReader, SPFieldServerStub, SPFieldLookupServerStub. These classes contain methods for creating and reading JSON objects. So it will be possible to read information about field in Javascript.


Details: Gets an object containing field schema information for client rendering.

So we can read also the information about the field definition in Javascript.


New Dataholder for SPFile properties. The  class has  following properties:

  • AllowPrint Gets or sets a value indicating whether the viewer can print the document.
  • AllowScript Gets or sets a value indicating whether the viewer can run script on downloaded document.
  • AllowWriteCopy Gets or sets a value indicating whether the viewer can write on a copy of the downloaded document.
  • DocumentAcceExpireDays Gets or sets the number of days before a downloaded document will expire
  • GroupName Gets or sets the group name (email address) to which the permission applies.


Gets the major version of this site collection for purposes of major version-level compatibility checks. For which version is the Site Collection designed?


Returns the versioned layouts folder for the specified site collection.

According to this we can have different versions of laouts folder for different webs. The laouts folder is not Farm scoped anymore.


Class SPOAuth2BearerCredentials and namespace Microsoft.SharePoint.IdentityModel.OAuth2. Support of OAuth2 like Windows Live ID, Twitter, Facebook?

ClientContext extensions


We can start search queries directly from the Client Object Model


We can start multiple search queries  in batch.


OpenBinaryStream:  We can open the file from server on the client.