Whitepaper: The final guide to SharePoint 2010 Site Settings


The Guide is now available as a PDF download from Microsoft Technet Gallery.
Download : The final guide to SharePoint 2010 Site Settings

A preview of the whitepaper:


_________________________________________________________

Enjoy!

Regards

Twitter | Technet Profile | LinkedIn

Whitepaper: The final Kerberos guide for SharePoint technicians


The Guide is now available as a PDF download from Microsoft Technet Gallery.
Download : The final Kerberos guide for SharePoint technicians

A preview of the whitepaper:


_________________________________________________________

Enjoy!

Regards

Twitter | Technet Profile | LinkedIn

Drop everything – SharePoint 2013 IT Pro and Developer training materials released…


SiteIcon2013

Ok, now we’re talking…

SharePoint 2013 IT Pro and Developer training materials released
http://blogs.msdn.com/b/vesku/archive/2012/07/17/sharepoint-2013-it-pro-and-developer-training-materials-released.aspx

Loads of good stuff available, 14 streamed video modules, everything also available as pptx.

Too bad I’m on holiday…now…the real FUN BEGINS!

 

Enjoy!

Regards

Twitter | Technet Profile | LinkedIn

SPB usage guide – 2 Configuration and Modification


SPB usage guide – 2 Configuration and Modification

This is the guide on how to install and use the SharePoint Branding Project.
Download: Visual Studio gallery

The guide is devided into three parts:

1 Download and Installation

2 Configuration and Modification

3 Deployment and verification (soon to be released)

In part 1 of this guide, we left off at the new project dialog:

In the categories, select C#, SharePoint, 2010 and SharePoint 2010 Branding Project.
Name the project(This name will also be the name of the SharePoint Feature), select its file location and Click OK.

Clicking on OK will create a new project for you in Visual Studio, the project will be a complete branding solution ready to deploy or package and install to a SharePoint 2010 farm or even an Office 365/SharePoint online tenant.

The first thing that you will see is the SharePointBrandingProject in the solution explorer:

The solution will by default have a number of components and functionalities.

Custom SPB Masterpages for:
Team sites MyBranding.master, equivalent to the general V4.master.
Meeting Workspaces MyBrandingMWS.master, equivalent to the general MWSDefaultV4.master.
Team sites MyBrandingMinimal.master, equivalent to the minimal.master.

Custom SPB StyleSheets:
MyStyles.css, Contains styles for basic look and feel for most sites and is used in all masterpages.
MyStylesMinimal.css, This is an additional stylesheet loaded and used when the MyBrandingMinimal.master is loaded.

Custom logo:
logo.png
Custom Favicon:

favicon.ico

Custom Eventreciever:
ChildSiteInit, This handles the web provisioned event to apply branding on new subsites.

Custom Feature:
Main, This feature applies the branding to the rootsite and all subsites.

In order to deploy this solution directly from Visual Studio to your test site, enter the url of you site collection in the project properties:

Now you are ready to deploy the solution to SharePoint with the default branding. The default branding is good looking and all that, but perhaps you want to make a few changes first? I would however recommend that you try the deployment so that you can verify that everything really works and that you have the permissions needed and so on. After successful trial deploy and complete awe for the good looking SHarePoint you made for yourself, it is time to start changing the branding.

First thing you will want to do, is replace the logo and favicon(if you did not know this, the favicon is the small tiny image that is located to very left in the address field in your Internet Explorer browser(I guess FF and others too). The favicon is loacated in Solution Explorer in the Images folder under the Style Library/My Branding/Images/
You can replace this file with a new favicon using the same name, but it must have the same properties: 32×32, a 24bit bmp .ico file. There are applications that are made just for the purpose of creating icons available. Or there is a plugin to PhotoShop available if you have access to PhotoShop (ICO (Windows icon) plugin). You can also edit the icon right here in Visual Studio but that is probably not for the thorrow artists…

Same story with the logo, it does not have the same rigorous restrictions on the size and type, but it should be close to what is the default size, use a too big or small image and you will have to make adjustments to the master/Stylesheets to compensate.
The logo can be edited in Visual Studio but that is not something that you do, use a proper image editing application, or simply adjust you current company/Organization/Customer logo to fit. I will now show you how you replace the default logo file with your own custom logo:

The current logo, logo.png – 120×120.
Delete the default logo by right clicking on the imagefile in the solution explorer and Click Delete:

Click OK in the confirmation dialog:

Now the logo file is deleted and we have to replace it with our new custom logo file. For simplicity, use a PNG file if you have one (if you don’t, use another file but then you will HAVE to edit the feature that adds the logo to the site).
To add the image, Right Click on the Images flder in solution explorer, then select Existing Item and Add:

Browse to your logo file in the explorer window, it can be located locally, or on a fileshare somewhere. Select the file and Click Add:

Now the imagefile is added, in my case I have found a wonderful logo from back in the days, when SharePoint 2001 was the talk of the town. SharePoint Portal Server 2001 had a pretty mean logo, this is what I’ll be using in my demo. See this guide part 3 for a presentation of that logo in action.

For the branding project to recognize the image as the logo, it will have to be renamed to logo.png (unless you used another fileformat or if you want to edit the feature to fit anyway).
Right Click on the Image in the Solution explorer window and select Rename.

Beautiful! The solution is again ready to be deployed:

Before we deploy the solution, I want to just quickly show you the basics of how you edit the real source of the branding solution, the master pages and the stylesheets. What you do is that you in Solution explorer, Double Click on the master or stylesheet you want to edit or look at. Try that and you will see something like this for the master:

And this if you Double Click on a StyleSheet(css)…
Did you know that CSS actually stands for Cascading Style Sheets, Cascading comes from the order in which they are applied, the classes in the last css to be applied overruns the previous even if they contain the same classes.

Now we are ready to deploy. So, how do we do that? From Visual Studio, you simply do it in a few Clicks, or really, its just two Clicks away.
Right Click on the Project in Solution explorer, Click Deploy.

Verify that the deployment went ok:

In my case, it did! Happy happy! Over to the browser and verify the new look and feel, go to the site, if allready there, refresh the page.

This is what my site looks like with that beautiful replaced retro logo, don’t you just love it?

In the next section of this guide, I will show you what the branding does and what you will see in the browser ‘onsite’.
The next part is called:

3 Configuration and Modification (soon to be released)

See also the previous part:

1 Download and Installation

Stay tuned!

Enjoy!

Regards

Twitter | Technet Profile | LinkedIn

 

SPB usage guide – 1 Download and Installation


SPB usage guide – 1 Download and Installation

This is the guide on how to install and use the SharePoint Branding Project.
Download: Visual Studio gallery

The guide is devided into three parts:

1 Download and Installation

2 Configuration and Modification

3 Deployment and verification (soon to be released)

Hi friends.

Allow me to welcome you on a journey to the wonderful world of SharePoint Branding. I created this SharePoint Branding Project thinking that the overhead and the learning curve to just get started with branding, was way too high. The amount of blogs to read and discard until you could actually build you very first, very basic custom branding solution, it was rediculous! Now pretty recently, the guides on Technet have been improved and most of them actually work, but it is still a long way to go if you want to start from scratch with little or no knowledge about how you go about creating such a project in Visual Studio.
With the SharePoint Branding Project, you can brand your company, organization or customer SharePoint in about 10 minutes, and you will have full control doing so. Follow this guide and you will cruise all the way to the finnish line.
To use this template, you need a SharePoint 2010 and Visual Studio on the same machine. If you can follow instructions, then you can achieve this.
Now, lets get started and have some fun, this IS fun after all!

There are two ways to download the extension file from the Visual Studio Gallery, the first is to simply go to the Visual Studio gallery, Click SPB.
Then on the large purple button, Click Download.

In the annoying but useful IE download bar, Click Open.

Click ‘Install’ to install the extension into Visual Studio.

When the extension is installed you will get a ‘Complete’ notice. Click Close in the dialog.

You are now done downloading and Installing the actual extension and you can now move on to the interesting stuff,  to create a SharePoint Branding Project in Visual Studio.
But before we go into how, we will show you another way to install the extension. From Visual Studio Extension Manager. The extension manager will show the installed extension regarless of the way you installed it, here you will also be notified of updates that have been released of the same extension.
Follow these steps from Visual Studio:

Start the Extension Manager from Visual Studio, Tools menu, Click Extension Manager

Click Online Gallery and search for SPB or browse the ‘Templates’ category and ‘SharePoint’ and you will find the SPB extension.
Click Download and the file will download and initiate the installation. Click Install in the next dialog:

When the extesion have been installed, you can’t wait to get going with the branding right. Ok, we will start that part, regardless of the way you choose to perform the download and installation, and the installation (Which is very quick) has completed, in Visual Studio, select File, New and Click Project:

In the Installed Templates section, select Visual C#, SharePoint, 2010 and SharePoint 2010 Branding Project.
Name the project (This name will also be the name of the SharePoint Feature once deployed to SharePoint), select the projects file location and Click OK.

Now you are done with the installation and can move on to the next step in this guide:

2 Configuration and Modification

or jump directly to the last step, not recommended:

3 Deployment and verification(soon to be released)

Stay tuned!

Enjoy!

Regards

Twitter | Technet Profile | LinkedIn

 

Replace all instances of a user in Last Modified and Created By using PowerShell


If you for unknown reasons end up with the wrong user in the last modified and author field of documents and folder, or if you simply want to replace a user with a differerent user account, then you can use this script to do it in all documents and flders within an SPWeb.

The script below will iterate thru the Shared Documents library, replace every ‘Last Modified'(Editor) and ‘Created By'(Author) with the user with ID 405.

[Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”)
# don’t leave out the last “/” in the url
$SPSite = New-Object Microsoft.SharePoint.SPSite(“http://www.mycompany.com/“)
$SPWeb = $SPSite.OpenWeb(“MySite”)
$SPList = $SPWeb.Lists[“Shared documents”]
$SPListItemCollection = $SPList.Items
foreach ($ListItem in $SPListItemCollection)  {
   #This example gets the user with ‘SharePoint ID’ of 405.
    $SPFieldUserValue = New-Object Microsoft.SharePoint.SPFieldUserValue ($SPWeb,405)
    If ($ListItem[“Editor”] -eq “1;#Chuck Norris (Admin)” -or $ListItem[“Editor”] -eq “385;#Bruce Lee”) {
        $ListItem[“Author”] = $SPFieldUserValue
        $ListItem[“Editor”] = $SPFieldUserValue
        $ListItem.Update()
    }
}

# Do the same for all folders

$SPListItemCollection = $SPList.folders
foreach ($ListFolder in $SPListItemCollection) {
    $SPFieldUserValue = New-Object Microsoft.SharePoint.SPFieldUserValue ($SPWeb,405)
    If ($ListFolder[“Editor”] -eq “1;#Chuck Norris (Admin)” -or $ListFolder[“Editor”] -eq “385;#Bruce Lee”) {
        $ListFolder[“Author”] = $SPFieldUserValue
        $ListFolder[“Editor”] = $SPFieldUserValue
       $ListFolder.Update()
    }
}
$SPWeb.Update()
$SPSite.Dispose()

Remember though, the last modified date will be updated to the current date.

Stay tuned!

Regards

Update the UI quick on ALL subwebs with SPWeb.UIVersion


When you migrate SharePoint 2007 to 2010, it sometimes happens that the UI gets ‘stuck’ in v.3.0 mode. When you move a database from 2007 and do an attach upgrade, you have a choice to use the -UpdateUserExperience flag when you run the Mount-SPContentDatabase command. This is usefull so that you don’t have to manually update the Visual UI, but this flag can be dangerous as well.

I have used it and sometimes, it causes most sites UI to be upgraded to v.4, but not all. On the not upgraded, the option to upgrade the visual UI is gone which puts you in the spot a bit.

For this occasion, I created this short but effective snippet:

$SPSite = Get-SPSite http://MySiteCollection
foreach ($SPWeb in $SPSite.AllWebs)
{
    $SPWeb.UIVersion = 4;
    $SPWeb.Update();
}

Done!

Stay tuned!

Regards

 

A guide to Branding and SharePoint Foundation part 1


A guide to Branding and SharePoint Foundation
Part 1

Part 1 | Part 2 |

SharePoint branding is something that most everyone wants to do, the default design is pretty good and stylish but it get dull and it does not fit in with any organizations brand book or design policy. A lot of posts have been written on the subject of SharePoint branding, many books have been published and most of what can be covered has been covered. What I found though during my work with the SharePoint Branding Project, is that there is a lack of information about branding and Foundation. Lots of organizations run Foundation, the reasons for doing so are many but the facts remains, SharePoint Foundation 2010 has a very large installed base. So, can’t we just buy the book on SharePoint branding and implement it in our Foundation farm? The answer to that question is most of the time no, or rather, not very likely. SharePoint Server has one vital component that Foundation lacks, it has a publishing infrastructure feature. In most cases the publishing components are used for some vital parts of a branding package, the most common one that you will see in almost every post is the

<% $SPUrl:~sitecollection/pathtosomething/%>

The SPUrl token is very handy when storing files in a centralized location in SharePoint, like for example the ‘sites/mycompany/style library/’. Lets use the FavIcon as an example in the first part.

<link rel=’shortcut icon’ href='<% $SPUrl:~sitecollection/Style Library/My Branding/Images/favicon.ico %>’/>

This tag would in Server farm pick the FavIcon image out from the site collection root. In Foundation you would see an error similar to this:

‘The expression prefix ‘SPUrl’ was not recognized. Please correct the prefix or register the prefix in the <expressionBuilders> section of configuration.’

Accessing CSS or Image files in the Style Library is easy using the $SPUrl expression builder to get the relative Site Collection Root URL(/sites/mycompany) or even the current Web Root URL. In Foundation the SPUrl token can’t be used so we need something else. One solution is pretty easy, just enter the relative path:

<link rel=’shortcut icon’ href=’sites/mycompany/style library/my branding/Images/favicon.ico’/>

For the Site Collection Root the path would resolve to:

http://webapplication/sites/mycompany/Style Library/My Branding/Images/favicon.ico

Perfectly allright, the favicon would be loaded. This is a great solution, with one huge flaw. If you have the branding implemented in all of your subsites then the path will be correct only in the root. Since the path is relative, it would in an example subsite look like this in the master:

<link rel=’shortcut icon’ href=’sites/MyCompany/Style Library/My Branding/Images/favicon.ico %>’/>

For my SubDivision subsite the path would resolve to:

http://webapplication/sites/mycompany/subdivision/Style Library/My Branding/Images/favicon.ico

Not ok! The load would fail since the favicon.ico is not located there. So, the permanent relative is only good for a site collection root with no subsites. You could obviously add the file to every subsite so that the path would work, but that is not really an option in most cases. So, how do we do it then…? In my own SharePoint branding project I use this workaround to replace the <link rel=’shortcut icon’ token:

<asp:literal runat=”server” Text=”&lt;link rel=’shortcut icon’ href='”/>
<SharePoint:ProjectProperty Property=”SiteUrl” runat=”server” />
<asp:literal runat=”server” Text=”/style library/my branding/images/favicon.ico’/&gt;”/>

It is a workaround, but it works. This will in reality build a relative path to the Site Collection Root even in the subsites and it will build up the <link> token by using 2 literal asp controls and the SharePoint:ProjectProperty control that is available in Foundation. The result in runtime will be the same as for a URL built on the $SPUrl expression builder.

<link rel=’shortcut icon’ href=’sites/mycompany/style library/my branding/Images/favicon.ico’/>

Add this to your Masterpage and you will have a functional FavIcon that uses a relative path.

Stay tuned!

Best regards

Site Settings by Powershell part 1 – Navigation


Configuring your site settings is really something that you want to do using PowerShell, this is for many reasons but the most obvious ones are that you get more control. You can test your script with settings in a test environment and see the effect, when it is perfected you simply run the script against a different URL and the result is moved to the proper target environment.
One more benefit is repeatability, you can do one configuration and repeat it for every site or web in your farm. Doing the same thing manually would take time and would increase the risk of making mistakes.
(See more Site settings by Powershell in my Whitepaper that can be downloaded from here: SharePoint 2010 Site Settings explained. I have tried to cover most every site setting and how it can be done using Powershell only. )

All of these settings can also be configured during site creation, in order to do that, get your publishingweb object of the websites you are creating, set the values and same as always, finish off with an update().

In this post I will try to cover most of the settings you can do in the Navigation part of your site settings. The Navigation settings are available only in sites in a site collection that has the SharePoint Server Publishing Infrastructure Site Collection Feature activated.

Activating this feature gives you among many other things, control over the global and current navigations. These settings are available in Site Settings under Look and Feel.

The settings that I will show how to configure using PowerShell are as shown in the below image. There are also ways to add and remove items from the navigations in the same dialog, but these will not be covered here.

First off, we need an object to work with. In this case we need a Publishing Web object, so first we create a spweb object, then a publishing web object:

$SPWeb = Get-SPSPWeb http://server/sitecoll/spweb/spweb
$SPPubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb] 
::GetPublishingWeb($SPWeb)

Some changes, like unchecking the Show subsites, require that you first allow unsafe updates. You can set the show subsites to false, but it will never be reflected unless you first allow unsafe updates. This is done on the SPWeb object by:

$SPWeb.AllowUnsafeUpdates = $true

Using our Publishing Web object, we can now configure the different settings, from the top in the graphical user interface:

Global Navigation

Display the same navigation items as the parent site:

$SPPubWeb.Navigation.InheritGlobal = $true

Display the navigation items below the current site:

$SPPubWeb.Navigation.InheritGlobal = $false

Show subsites:

$SPPubWeb.Navigation.GlobalIncludeSubSites = $true

Show pages:

$SPPubWeb.Navigation.GlobalIncludePages = $true

Maximum number of dynamic items to show within this level of navigation:

$SPPubWeb.Navigation.GlobalDynamicChildLimit = 20 (int32)

Current Navigation

Display the same navigation items as the parent site: (both values in combination)

$SPPubWeb.Navigation.InheritCurrent = $true
$SPPubWeb.Navigation.ShowSiblings = $false

Display the current site, the navigation items below the current site, and the current site’s siblings: (both values in combination)

$SPPubWeb.Navigation.InheritCurrent = $false
$SPPubWeb.Navigation.ShowSiblings = $true

Display only the navigation items below the current site: (both values in combination)

$SPPubWeb.Navigation.InheritCurrent = $false
$SPPubWeb.Navigation.ShowSiblings = $false

Show subsites:

$SPPubWeb.Navigation.CurrentIncludeSubSites = $true

Show pages:

$SPPubWeb.Navigation.CurrentIncludePages = $true

Maximum number of dynamic items to show within this level of navigation:

$SPPubWeb.Navigation.CurrentDynamicChildLimit = 20 (int32)

Sorting

Sort automatically:

$SPPubWeb.Navigation.OrderingMethod = "Automatic"

Sort manually:

$SPPubWeb.Navigation.OrderingMethod = "Manual"

Sort sites manually and pages automatically: (This is option is only available with publishing pages)

$SPPubWeb.Navigation.OrderingMethod = "ManualWithAutomaticPageSorting”

When Sort automatically is selected

Sort by Title (shown left):

$SPPubWeb.Navigation.AutomaticSortingMethod = "Title"

Sort by Created Date:

$SPPubWeb.Navigation.AutomaticSortingMethod = "CreatedDate"

Sort by Last Modified Date:

$SPPubWeb.Navigation.AutomaticSortingMethod = "LastModifiedDate"

Sort in ascending order (shown left):

$SPPubWeb.Navigation.SortAscending = $true

Sort in descending order:

$SPPubWeb.Navigation.SortAscending = $false

 

That’s it, that covers all of the settings I meant to show and this will hopefully be useful to you when scripting the creation and configuration of your sites.
In order to help you get started, you can modify the script included below and that will allow you to configure all of the above settings the same way on all sites in a designated site collection.

Sample script

# get a sitecollection object(SPSite)
$SPSite = Get-SPSite -Identity “http://farm.company.local/sitecollection“
# loop through all the subwebs(SPWebs) in the site collection
foreach ($SPWeb in $SPSite.AllWebs)
{
  # check so that this is not the root web
  if (!$SPWeb.IsRootWeb)
  {

 # Save AllowUnsafeUpdates setting and set it to allow.
    $AllowUnsafeUpdatesStatus = SPWeb.AllowUnsafeUpdates
 SPWeb.AllowUnsafeUpdates = $true
 # Get a PublishingWeb object for the current web
    $SPPubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]
 ::GetPublishingWeb($SPWeb)

    # UnComment the setting you will use:
    # Global settings
    # $SPPubWeb.Navigation.InheritGlobal = $true
    # $SPPubWeb.Navigation.InheritGlobal = $false
    # $SPPubWeb.Navigation.GlobalIncludeSubSites = $true
    # $SPPubWeb.Navigation.GlobalIncludeSubSites = $false
    # $SPPubWeb.Navigation.GlobalIncludePages = $true
    # $SPPubWeb.Navigation.GlobalIncludePages = $false
    # $SPPubWeb.Navigation.GlobalDynamicChildLimit = 20
    # Current settings
    # See combination of the two below
    # $SPPubWeb.Navigation.InheritCurrent = $true
    # $SPPubWeb.Navigation.ShowSiblings = $false
    # $SPPubWeb.Navigation.CurrentIncludeSubSites = $true
    # $SPPubWeb.Navigation.CurrentIncludePages = $true
    # $SPPubWeb.Navigation.CurrentDynamicChildLimit = 20
    # Sorting
    # $SPPubWeb.Navigation.OrderingMethod = "Automatic"
    # $SPPubWeb.Navigation.OrderingMethod = "Manual"
    # $SPPubWeb.Navigation.OrderingMethod = "ManualWithAutomaticPageSorting”
    # $SPPubWeb.Navigation.AutomaticSortingMethod = "Title"
    # $SPPubWeb.Navigation.AutomaticSortingMethod = "CreatedDate"
    # $SPPubWeb.Navigation.AutomaticSortingMethod = "LastModifiedDate"
    # $SPPubWeb.Navigation.SortAscending = $true
    # $SPPubWeb.Navigation.SortAscending = $false
    $SPPubWeb.Update()
  }
  # cleanup 
 # Set AllowUnsafeUpdates back to original value
 $SPWeb.AllowUnsafeUpdates = $AllowUnsafeUpdatesStatus
  $SPWeb.Dispose() }
# cleanup
$SPSite.Dispose()

Please allow some time for the changes to take affect, it can take a couple of minutes until the changes are reflected in your navgation.

Reference:

PortalNavigation Members

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.publishing.navigation.portalnavigation_members.aspx

2012-02-16 Updates: Added $SPWeb.AllowUnsafeUpdates section to script.

I have a site called SITE_2 in IIS, whats this…?


This is just a really short instruction and explaination on the SITE_2 phenomenon.

This site is created for some reason in IIS after you have uninstalled SharePoint from a server.

Delete it by selecting the ‘Sites’ container and then right-clicking in the right pane on SITE_2, Remove.

If you click on it in the leftpane you will get an error…’The application / does not exist’

‘Til next time.

_________________________________________________________

Enjoy!

Regards

Twitter | Technet Profile | LinkedIn