Skip Ribbon Commands
Skip to main content

Christina Wheeler Blog

:

Home
August 05
Content Query Web Part – Part One: Using Custom XSL Style Sheets

Some people have said the Content Query Web Part (CQWP) is dead. It is not dead and is still very much alive and used especially in O365 SharePoint sites. Also, the Content Search Web Part (CSWP) is not available in O365 (however should be available in the near future) so the CQWP is the only OOTB option for rolling up content.

This is the first post of a multipart series on customizing the CQWP. Part one includes the steps to use customized XSL style sheets.

XSL Style Sheets

There are 3 XSL style sheets used for the CQWP which include the following:

File Location Purpose
ContentQueryMain.xsl \Style Library\XSL Style Sheets\ContentQueryMain.xsl Contains the logic that generates the calls to the Header and Item templates for each item.
ItemStyle.xsl \Style Library\XSL Style Sheets\ItemStyle.xsl Templates that define how to display the items returned by the query.
Header.xsl \Style Library\XSL Style Sheets\Header.xsl Templates that define how to display the headers (group by).

 

Create Custom XSL Style Sheets

It is best practice to create your own custom XSL style sheets and link them to the CQWP instead of modifying the OOTB ones.

  1. Open your site in SharePoint Designer 2013.
  2. Navigate to All Files > Style Library > XSL Style Sheets.
  3. Create 3 XSL files:
    • CustomContentQueryMain.xsl
    • CustomItemStyle.xsl
    • CustomHeader.xsl 

      CQWP_P1_01
  4. Copy the source from each original file to the corresponding file.
  5. Save and publish.
  6. Open the site in the browser and add a CQWP to the page.

    CQWP_P1_02
    CQWP_P1_03 
  7. Edit the Web Part properties and change the Title to Custom Content Query.
  8. Export the Web Part and save it locally.

    CQWP_P1_04
  9. Open the Web Part in a text editor.
  10. Modify the MainXslLink, ItemXslLink, and HeaderXslLink properties setting it to the location of your custom XSL files.
    <property name="MainXslLink" type="string">/Style Library/XSL Style Sheets/CustomContentQueryMain.xsl</property>
    <property name="ItemXslLink" type="string">/Style Library/XSL Style Sheets/CustomItemStyle.xsl</property>
    <property name="HeaderXslLink" type="string">/Style Library/XSL Style Sheets/CustomHeader.xsl</property>
     
    CQWP_P1_05 
  11. Save the .webpart file.
  12. Go back to your site and navigate to the Web Part Gallery. Site Actions > Site Settings > Web parts (Web Designer Galleries).
  13. Upload your customized .webpart file.

    CQWP_P1_06
    CQWP_P1_07
  14. Now you can add your custom CQWP to a page.

    CQWP_P1_08
  15. The Web Part is linked to your custom XSL files and any changes needed would be made to the custom XSL files (CustomContentQuery.xsl, CustomItemStyle.xsl, and CustomHeader.xsl)  instead of the OOTB files.
August 31
Create Windows Scheduled Task to Kill OWSTIMER

As most of you know, the OWSTimer memory leak is still an issue with SharePoint 2010. I created a scheduled task to run using PowerShell to stop the process nightly. Here are the instructions to create the scheduled task.

TaskManager

Open up your Windows Task Scheduler and right-click on Task Scheduler Library and then choose “Create Task” to start the Create Task panel.

Note: If you don’t know where the task scheduler is either search for it or type %windir%\system32\taskschd.msc /s in your Windows start menu search bar.

General
Type in the name and Description (optional) and change the security options to “Run whether user is logged on or not”.

CreateTask02

Triggers
Set your preferred scheduling options. Make sure to set it at a time that that will NOT conflict with backups and other scheduled SharePoint jobs.
 
CreateTask03
 
Actions
 
CreateTask04
 
Program/Script: %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
Add Arguments: Get-Process OWSTimer| Stop-Process –Force
Once you’re done manually run the process to make sure it’s working. I keep my Task Manager open during testing to make sure the process is being stopped. Don’t worry about restarting the OWSTimer process manually because it will automatically restart on it’s own.

August 31
Visual Studio 2012 Not Recognizing Installed SharePoint 2013

If you try to create a SharePoint project in VS2012 and get the following error, you will need to install the Visual Studio 2013 Developer Tools.

Visual Studio 2013 Developer Tools - http://go.microsoft.com/fwlink/?LinkID=257068
August 31
Login as Different User in SharePoint 2013 Preview

When you login to SharePoint 2013 you'll notice the "Sign in as Different User" is missing from the Personal Menu.

 

Here are two workaround options:

  1. Manually append the following URL to your site:

    /_layouts/closeConnection.aspx?loginasanotheruser=true
  2. Add a Custom Action to the SharePoint Personal Menu:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <CustomAction
    Id="MyLoginDifferentUser"
    GroupId="PersonalActions"
    Location="Microsoft.SharePoint.StandardMenu"
    Sequence="1000"
    Title="Sign in as Different User">
    <UrlAction Url="/_layouts/closeConnection.aspx?loginasanotheruser=true"/>
    </CustomAction>
</Elements>

                    

Click here to download Custom Action Solution

March 16
Real World Project: Transparent Overlays for SharePoint Interface Enhancement (EUSP Article)

Introduction

I have a client that wanted to convert their outdated HTML district website to an external facing SharePoint portal. The client was brand new to SharePoint and brought me in to build an external facing portal using MOSS 2007 Enterprise. After setting up the new farm it was time to brand the site and create content. The one thing I had the client do before I started branding the site was have them send me references to sites they liked along with a list of elements they liked about the sites.

   

Read the full Article on EndUserSharePoint.com

   

About this blog
Based in Bonaire, Ga., Christina (MCTS) is an Independent Consultant and SharePoint Trainer for Critical Path Training, focusing on SharePoint development, administration, branding, and training.
SEF 2013

FPWeb