Category: SharePoint

  • Configuring a host name with a SSL Certificates in IIS 7

    Configuring a host name with a SSL Certificates in IIS 7

    A customer asked me if I could help troubleshoot their SharePoint environment – they had extended a web application and configured it to use Forms Based Authentication (FBA) with SSL however they were getting errors when accessing the new site.

    I started troubleshooting the configuration across all the servers in their SharePoint 2013 farm. I stepped through the configuration for the web application in Central Administration – reviewing the authentication provider settings and alternate access mappings. I then reviewed the web.config and made sure that the FBA settings were present and correct along with the IIS website bindings. This is when I noticed that there was no hostname against the https/443 binding –  the option to add one was also disabled.

    IIS binding - host name disabled
    IIS binding – host name disabled

    After a little research, I found an article from ArmgaSys.  It turns out that my customer’s wildcard SSL certificate was issued without an * in the name, therefore, the hostname cannot be specified once the SSL certificate is selected. I followed the steps in this article from and the customer was able to access their SharePoint site without any errors this time.

    IIS binding - host name editable
    IIS binding – host name editable

    A summary of these instructions are included below: –

    1. To resolve this and make the hostname field editable launch Microsoft Management Console (MMC) and open the Certificates snap-in.
    2. Locate the wildcard certificate, right click on it and select properties.
    3. If the Friend Name property doesn’t start with a * then add one and apply any changes you make.
    4. Now go back to IIS and select the SSL certificate in the bindings of the SharePoint website with the issue.
    5. The hostname field should now be editable where you should then enter the hostname for your SharePoint site.
  • Easily add jQuery tabs using the “Reusable Content” feature

    Easily add jQuery tabs using the “Reusable Content” feature

    This post is quite a fun one. Whilst I was working with a customer today someone came up to me and asked if it was possible to add tabs to their content pages to which I gave it a few seconds thought and I responded “sure that’s absolutely possible – leave it with me!”.

    I then spent my commute home thinking about how tabs could be delivered for end-users to make use of without them having to meddle around with any code. Sure getting tabs to work in SharePoint is pretty straight forward and is something we’ve all done at least on a couple of occasions but I give more thought about making it easier for the end-users to consume rather than just meeting the customer’s requirement by putting in a solution that isn’t pretty nor easy to use.

    Solution

    I eventually decided to use, what I thought was a very simple approach to giving users the option to use tabs. My solution makes use of the tabs from the jQuery UI (http://jqueryui.com/tabs/) library. It starts with a small modification to the master page that is currently being used. The following code should be added before the closing </head> tag.

    <link href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet" />
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    <script type="text/javascript">
    // <![CDATA[
    $(function() {
    $("#tabs").tabs();
    });
    // ]]>
    </script>

    I then added the following to the “Reusable Content” list in the root site of the Site Collection where I was adding tabs. Make sure that the “Automatic Update” is unchecked for this piece of reusable content.

    Reusable Content item
    Reusable Content item
    Reusable Content Lists
    Reusable Content Lists

    Below is the code that should be added to the Reusable HTML field.

    <div id="tabs">
    <ul>
    <li><a href="#tabs-1">Overtype tab 1 title here</a></li>
    <li><a href="#tabs-2">Overtype tab 2 title here</a></li>
    <li><a href="#tabs-3">Overtype tab 3 title here</a></li>
    </ul>
    <div id="tabs-1">Overtype tab 1 content here.</div>
    <div id="tabs-2">Overtype tab 2 content here.</div>
    <div id="tabs-3">Overtype tab 3 content here.</div>
    </div>

    To add the tabs onto a content page you can simply select the item that has just been added to “Reusable Content” list by clicking on the “Insert” tab whilst editing the page and expanding the “Resumable Content” menu.

    Reusable Content menu
    Reusable Content menu

    Rich text that represents the HTML markup for the tabs is then added onto the page. Each tab is represented by a bullet list item “<li>” and a content area “<div>”. The names of tabs you require can then be added by carefully overtyping the existing tab names. You must be careful not to introduce or remove any markup as this might prevent the tabs from working correctly.

    Once you have entered the names of the tabs you can then add the appropriate content by overtyping the content that you wish to include in that tab. This content can consist of rich text such as tables, images and also web parts. Again you must be careful not to introduce or remove any markup. Any tabs that are no longer required can be carefully removed by deleting the bullet list item and content area.

    Tabs demonstration
    Tabs demonstration

    There are other ways to achieve the same result but I thought this was a simple approach using out-of-the-box functionality. Happy tabbing!

     
  • Change the default sync interval –  Windows Azure Active Directory Sync

    Change the default sync interval – Windows Azure Active Directory Sync

    The default interval for Windows Azure Active Directory Sync (DirSync) synchronisations is 3 hours. If for instance, your Active Directory has lots of changes you probably want to consider shortening the sync interval.

    The schedule can be modified by changing the “Microsoft.Online.DirSync.Scheduler.exe.Config” configuration file. Before proceeding to make any changes to the sync interval you should evaluate how long it takes to complete synchronisation. You can do this by reviewing the application event log for entries that indicate when sync has started and completed.

    To modify the configuration file open “C:\Program Files\Windows Azure Active Directory Sync\Microsoft.Online.DirSync.Scheduler.exe.Config” in Notepad. You will then need to modify the value of the “Synctimeinterval” key – the notation of this is Hours:Minutes:Seconds.

    Microsoft.Online.DirSync.Scheduler.exe.Config
    Microsoft.Online.DirSync.Scheduler.exe.Config

    Save the configuration file and restart the “Windows Azure Active Directory Sync Service” Windows Service (via PowerShell Restart-Service MSOnlineSyncScheduler) to apply this change.

    Restart-Service MSOnlineSyncScheduler
    Restart-Service MSOnlineSyncScheduler
  • Force a full syncronisation – Windows Azure Active Directory Sync

    Force a full syncronisation – Windows Azure Active Directory Sync

    When configuring Windows Azure Active Directory Sync (or DirSync as it was previously known) it’s useful to be able to run various synchronisation tests. The default synchronisation schedule is 3 hours so unless you want to wait you will need to force a full synchronisation using PowerShell.

    Start-OnlineCoexistenceSync cmdlet
    Start-OnlineCoexistenceSync cmdlet

    To do this you need to load the Windows Azure Active Directory Sync PowerShell module and run a cmdlet. Start by navigating to “C:\Program Files\Windows Azure Active Directory Sync” in PowerShell and then run “.\DirSyncConfigShell.psc1” from this directory. This will launch a new PowerShell console with the Windows Azure Active Directory Sync PowerShell module loaded (Add-PSSnapin Coexistence-Configuration). Then to force a full synchronisation you need to run the Start-OnlineCoexistenceSync cmdlet.

    [code lang=”PowerShell”]
    Start-OnlineCoexistenceSync -fullsync
    [/code]

    You can verify that synchronisation has occurred by reviewing the application event log on the server running DirSync – there should be several items in the log such as “Directory Synchronization, Event ID – 114, Export cycle completed”. There is also a status of the Active Directory Synchronisation on the “Users and Groups” page in the Office 365 admin portal. There are also two other ways to see the status of synchronisation jobs which I will go into in more detail in a later post but these include using the Forefront Identity Manager (FIM) client and Fiddler web debugging proxy.

    Office 365 Active Directory Sync status
    Office 365 Active Directory Sync status

    You can create a shortcut to “C:\Program Files\Windows Azure Active Directory Sync\DirSyncConfigShell.psc1” on the desktop for ease of administration. I, however, take this one step further and create a shortcut to perform a synchronisation as well. Create a shortcut with the following target below.

    %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "%PROGRAMFILES%\Windows Azure Active Directory Sync\DirSyncConfigShell.psc1" -Command "& Start-OnlineCoexistenceSync -fullsync
  • Forms Based Authentication Configuration Manager for SharePoint

    Forms Based Authentication Configuration Manager for SharePoint

    I’ve configured Forms Based Authentication (FBA) in SharePoint on several occasions – from 2007 right through to 2013, but until now I have never discovered a life-saving tool that Steve Peschka has written called Forms Based Authentication Configuration Manager (FBA Configuration Manager for SharePoint 2013) available on his TechNet Blog Share-n-dipity.

    I’ve been there at least once or twice and I’m sure others have as well – where we’re happily modifying the web.config on half-a-dozen or more servers and as Steve so elegantly describes it, we “fat finger some random part of a web.config change” causing complete devastation to the running of SharePoint and to your progress. Well not any more my sysadmin friends, not any more not with this tool. It allows you to edit the connection string, people picker wildcard, membership provider, role provider details within the web.config for a specific web application. It then creates a backup copy and updates the web.config across all the servers in your farm through a timer job which is a really neat trick.

    FBA Configuration Manager
    FBA Configuration Manager

    Having done this now on several occasions I thought I was pretty confident flying through the steps necessary within an hour or so…the occasional error would sneak in and then I would spend as long again troubleshooting the configuration. Steve’s Forms Based Authentication Configuration Manager has now completely removed the chances of any errors sneaking in and will make me even quicker configuring FBA in SharePoint. Thank you, Steve!

  • Install standalone OneDrive for Business (formally SkyDrive Pro)

    Install standalone OneDrive for Business (formally SkyDrive Pro)

    Ok, so this has bothered me for some time – until now, there has been standalone OneDrive for Business SkyDrive Pro client. Users have had to install Office 2013 to experience the new way of synchronising files with SharePoint.

    The reason it has bothered me is that it is such a limitation to require the client to be installed in this way. For most organisations, it is just not feasible to install the latest and greatest software from day one due to budgets and wider IT constraints, resources and policies where software has to be tested, licensed and patched for example.

    Let’s put that aside now as I’m really happy to see that Microsoft released a standalone installer for the OneDrive for Business SkyDrive Pro client earlier this week.

    Download

    The standalone OneDrive for Business client is available on the Microsoft Downloads site. Both 32-bit and 64-bit versions of the client are available.

    The client can also be installed alongside previous versions of Office and can be used to synchronise libraries from SharePoint 2010, SharePoint 2013 and SharePoint Online in Office 365.

  • Determining the version of your SharePoint Online servers

    Determining the version of your SharePoint Online servers

    If you need to check what version of SharePoint server your Office 365 tenant is running especially during the Office 365 and SharePoint Online service upgrade (aside from checking through the Admin Portal via https://portal.microsoftonline.com) then you can add the following /_vti_pvt/service.cnf to the end of your SharePoint site – as shown below.

    https://jcallaghan.sharepoint.com/_vti_pvt/service.cnf

    The page will output two lines of text from which we can determine the version of the SharePoint servers. If the second row starts with 14 then you are running SharePoint 2010, if it starts with 15 then you are running SharePoint 2013.

    /_vti_pvt/service.cnf output displayed
    /_vti_pvt/service.cnf output displayed

    SharePoint Online on SharePoint 2010 servers:

    vti_encoding:SR|utf8-nl
    vti_extenderversion:SR|14.0.0.6120

    SharePoint Online on SharePoint 2013 servers:

    vti_encoding:SR|utf8-nl
    vti_extenderversion:SR|15.0.0.4454

    After the service upgrade, you may be running SharePoint 2010 on SharePoint 2013 servers (technically known as 14 mode) until you upgrade your site collections to SharePoint 2013 (15 mode).

  • Embed code in a SharePoint 2013 web part page

    Embed code in a SharePoint 2013 web part page

    A quick post here to share a new feature in SharePoint 2013 that enables you to easily embed code such as javascript and CSS into the content area of a web part page for example.

    Insert action to embed code
    Insert action to embed code

    Previously we did this by editing the page source or by creating lots of text files and linked them using the “Content Link” parameter in “Content Editor Web Parts (CEWP’s)”. Now we can easily embed code on a content page where SharePoint places it is in a lovely dedicated snippet section that is only visible when you edit the page.

    Code embed in page content
    Code embed in page content
    Embed code window
    Embed code window

    When you add any javascript SharePoint converts the “edit snippet” link as shown above to a web part where you then edit the content much like the “Content Editor Web Part”.

  • The Sign in as Different User option is missing in SharePoint 2013

    The Sign in as Different User option is missing in SharePoint 2013

    I’ve been exploring SharePoint 2013 in recent days and noticed that the ‘Sign in as Different User’ option or action from the welcome control (user menu) seems to have been removed or forgotten from the user interface in this build.

    Sign in as Different User in SharePoint 2010
    Sign in as Different User in SharePoint 2010
    No sign in as different user missing in SharePoint 2013
    No sign in as different user missing in SharePoint 2013

    For someone who works with SharePoint as I do, any kind of administration, developing or testing that requires you to sign in as another you will now become convoluted from the previous version and is somewhat frustrating and annoying. Others such as Nick Grattan have discussed this issue and possible workarounds.

    Of all the workarounds currently available such as browsing to the closeConnection page directly, modifying the welcome control and adding the control back (I do not recommend this approach), creating a javascript bookmark, embedding jQuery into the master page to insert the option back in the menu and lastly launching the browser with the RunAs option my preference will remain to browse directly to the closeConnection page:

    /_layouts/closeConnection.aspx?loginasanotheruser=true

    Or alternatively, use the javascript bookmark Cory Peters has kindly created:

    javascript:window.location.href=”http://”+window.location.host+”/_layouts/closeConnection.aspx?loginasanotheruser=true”;

    It will be interesting to see what others do and as to whether or not the option gets added back by Microsoft in a future update.

  • Security trimmed top navigation links

    Security trimmed top navigation links

    I was asked to review a client environment yesterday to find out why the links in their top navigation bar were displaying for users that did not have permission to the particular sites.

    Creating sites

    It turns out that when sites were being created by the client on SharePoint Foundation 2010 they were being created without the ‘include on the top navigation bar’ check box ticked. As a result, the link was then not automatically added to the top navigation bar but instead later manually added and so was not security trimmed link.

    Display this site on the top link bar of the parent site
    Display this site on the top link bar of the parent site

    It was then after removing permissions to the various sites that it became clear that users were able to see the top navigation bar link to the sites even though they did not have access.

    Obviously, there are situations when users don’t have permissions to a site and you don’t want them to see that the site even exists. An example of this might be in an extranet scenario when you have third parties accessing project sites and you don’t want those third parties seeing the names of other project sites that may exist let alone the content…so how do we prevent this?

    Identifying security trimmed links

    By reviewing the URLs of the links in the top navigation bar I was able to identify whether the links were security trimmed or not. If the field for the URL is disabled then the link is security trimmed and most probably created when as the site was created.

    Custom top navigation link that is not security trimmed
    Custom top navigation link that is not security trimmed
    Security trimmed top navigation link
    Security trimmed top navigation link

    Adding new security trimmed links

    After identifying the problem, I then had to make the existing links security trimmed. I did this in two stages. The first was to make a note of the position of the link that needed to be replaced. I then deleted it from the top navigation bar using the ‘Top Link Bar’ site settings page (_layouts/topnav.aspx). The second stage was then to create the new security trimmed link by using the PowerShell code below.

    Modify the $SPWeb and @(“Site Name”, “/sitename/default.aspx”) arguments as required and run the code for each of the top navigation bar links that need to be security trimmed. Remember the old link will need to be removed and the new one ordered as required.

    Conclusion

    It appears SharePoint, specifically SharePoint Foundation 2010 only honours security trimmed links in the top navigation when the links are created automatically as opposed to being created manually.

    Note: this post specifically targets SharePoint 2010 Foundation which does not include the extended navigation that is included as part of the Publishing feature.

  • Hiding an empty rich text column in XSLT

    Hiding an empty rich text column in XSLT

    This morning I was trying to create a new style in the itemstyle.xsl stylesheet to use within the content query web part (CQWP). I needed a custom style to display a list of announcements, some of which had content and others didn’t and this style was to improve this output.

    The problem is that the ‘Body’ column of an announcement or more importantly the ‘rich text’ field type is never really empty. Even when the column genuinely empty and has no rich text content, a hidden HTML element (a div) exists and acts as a wrapper for any content. As a result, if you try and use a typical ‘if equals null’ statement to hide the rich text column it won’t work because of this hidden element.

    Examples

    An empty rich text column on SharePoint 2010 always has 37 characters as shown below.

    Empty rich text column in SharePoint 2010
    Empty rich text column in SharePoint 2010

    With SharePoint 2007 the rich text column has 65 characters when empty, again as shown below.

    Empty rich text column in SharePoint 2007
    Empty rich text column in SharePoint 2007

    Solution

    The solution, in the end, was to use the string-length function to determine if the rich text column was longer than the standard 37 characters on SharePoint 2010 as identified above.