Posts

Set the logo of all sites in a SharePoint 2013 site collection using PowerShell - Flash post

If you want to quickly set the site logo of a complete SharePoint 2013 site collection, enter the following: (get-spsite  http://YourSiteCollectionURL ).AllWebs | foreach {$_.SiteLogoUrl = “/relative/path/to/companylogo.png”; $_.Update()} Thats all :)

Open termbased navigation links in new window in SharePoint 2013

Term based navigation has been greatly improved in SharePoint 2013, but sometimes you want to open navigation URLs in a new window. However, the term store does not offer such a property so we'll solve it using JavaScript instead. In the masterpage element add this script: script language="JavaScript" // Adding an entry to _spBodyOnLoadFunctionNames array so the function runs on pageLoad _spBodyOnLoadFunctionNames.push("rewriteNavigationLinks"); function rewriteNavigationLinks() { // collecting anchors var anchorArray = document.getElementsByTagName("a"); for (var x=0; x 0) { oldUrl = anchorArray[x].outerHTML; // adding target attribute newUrl = oldUrl.replace(/#targetnewwindow/,'" target="_blank'); anchorArray[x].outerHTML = newUrl; } } } /script Then in the term store append "#targetnewwindow" on the link to activate the specific link. E.g. http://intranet.foo/somepagename.aspx?pid=000#...

Configuring MySite search center settings for SharePoint 2013

I stumbled over this one the other day and I (luckily) discovered the solution by accident. When configuring MySite in SharePoint 2013 you are prompted to give up the URL for your search center. Now, if you’ve set up an Enterprise Search Center as I’ve done redirecting you to the correct result pages will fail when doing a search from MySite. Leaving you with an “The page you're looking for doesn't exist”-error. (Yes, another of MS meaningful errors). The error you’ll discover is that you’ve most likely entered something like http://theUrlFor/MySearchCenter on the MySite configuration, while it should have been http://theUrlFor/MySearchCenter/pages Problem: When searching from MySite you get “The page you're looking for doesn't exist” Reason: The search URL is wrong and SharePoint cannot find the pages that display the search results. Solution: The solution giving you least headache is to use the SharePoint PowerShell and execute the following lines: ...

SharePoint 2013 - Design Manager - Problems connecting to network drive.

Image
I've been working with SharePoint 2013 lately and I came across a problem trying to upload design files for the design manager. This problem occurs when developing directly on Windows Server 2008 R2.  When mapping the provided link to your computer like explained here (MSDN) , you get an error "The network name cannot be found." As many other problems you'll find when developing on a server this is due to a missing feature. The solution to the problem is enabling "Desktop Experience" feature. Go to the Server Manager and click on "Features" in the left side tree structure. In the main pane click "Add Feature" and check the "Desktop Experience" box. Follow the instructions and make sure to save your work because the Server will have to reboot  on finish. When logged in you'll find that mapping the location to your computer will work.

XPath - the keymaster

As you might already know you won't get anywhere without XPath when working with XSLT. As scary as it might sound (at least I thought it sounded scary), it is no more than the pattern you need to learn to find the information you're looking for. Now you might argue that it can be more complicated than that, but we'll keep it simple in this blog post. We'll use the music XML structure from a previous post. Let’s see some examples: <!-- This code will give you a copy of the XML root of the current structure. --> < xsl:template name = " giveMeTheRoot " > < xsl:copy-of select = " // " /> </ xsl:template >   <!-- This template will give you a COPY of the current node. That means that you will also get the subnodes of the current nodes as well. --> < xsl:template name = " giveMeTheCurrentNode " ...

XSLT - Recursion

There are a couple of things that make XSLT hard to manage and recursion is indeed one of them. There is just no way of running a traditional for loop. In order to solve this we need either a structure to iterate on, or we can create a template that calls itself with a counter and control number. If you simply need to iterate on an XML structure, you can do a for-each loop like this: < xsl:for-each select = " .//child::title " > <!-- Do you thing --> </ xsl:for-each > However, if you know that you need to iterate on a procedure "i" times, then we need to complicate things a bit. < xsl:template name = " test3 " > < xsl:param name = " counter " /> < xsl:param name = " i " />   <!-- We do our thing... --> < xsl:copy > < xsl:text > Hello...

Working with XSLT variables

Working with variables can get you into any kind of delight or trouble. It brings in many scenarios making it tricky in ways you don't experience with other programming languages. First of all you need to remember that xsl variables are STATIC. That means that you cannot change them once they are set. Also you need to make sure that they are in the correct scope. If you create a variable inside a template, it will only be available inside the template. However, you can create GLOBAL variables outside a template as well. Now on to the code examples. This post is using the XML example from an earlier post on XML and XSLT . <!-- The following example creates variables in different ways. -->   <!-- This variable is a simple string, hardcoded inside the variable node. --> < xsl:variable name = " myString " > < xsl:text > Hello Nerd! </ xsl:text > </ ...