How to total a column of values in a Sharepoint DVWP
By peter.stilgoe
To total a column of values in a Sharepoint DVWP use:
<xsl:value-of select="sum(/dsQueryResponse/Rows/Row/@TotalHoursWorked)" />
To do something similar in Xpath with formatting:
format-number(sum(/dsQueryResponse/Rows/Row/@TotalHoursWorked), '#,##0.00;-#,##0.00')
How to create a back button in Sharepoint
By peter.stilgoe
How to create a back button in Sharepoint to take you back to the previous page either using a text link or image -
Text link:
<a href="#" onClick="history.go(-1)">Back Link Text</a>
Using a back button image:
<a href="#" onClick="history.go(-1)"><img src="linktobackbuttonimage.gif" alt="Back"/></a>
Note: I have only tested this in Internet Explorer
Sharepoint 2010 Secure Store: An error occurred during the “Generate Key” process. Please try again or contact your administrator
By peter.stilgoe
“Sharepoint 2010 Secure Store: An error occurred during the “Generate Key” process. Please try again or contact your administrator”
Things to check:
– Ensure the logged in user is a member of the farm administrators group
– In my case the ‘Sharepoint Webservices Root’ application pool had stopped on one of my app servers
How to display a URL hyperlink in a CQWP
By peter.stilgoe
In the relevant template section in itemstyle.xsl add a line something like (replacing the column name with the your column containing the URL):
LiveView: <a href="{substring-before(@Live_x005F_x0020_View, ',')}">Click here</a>
K2 – The base type ’SourceCode.SharePoint.ProcessPortal.UI.PortalWebPartPage’ is not allowed for this page. The type is not registered as safe.
By peter.stilgoe
When creating a a process portal or trying to access certain sections of a process portal in K2 Blackpearl or Blackpoint & you get the following error:
“Parser Error Message: The base type ’SourceCode.SharePoint.ProcessPortal.UI.PortalWebPartPage’ is not allowed for this page. The type is not registered as safe.
Source Error:
Assembly Name=”SourceCode.SharePoint.ProcessPortal, Version=4.0.0.0, Culture=neutral, PublicKeyToken=16a2c5aaaa1b130d
Page Language=”C#” MasterPageFile=”~masterurl/default.master” Inherits=”SourceCode.SharePoint.ProcessPortal.UI.PortalWebPartPage
Register TagPrefix=”SharePoint” Namespace=”Microsoft.SharePoint.WebControls
/k2/default.aspx Line: 3
Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927″
Check your web.config & if the below lines dont exist add them & your problem should be fixed:
<SafeControl Assembly="SourceCode.SharePoint.ProcessPortal, Version=4.0.0.0, Culture=neutral, PublicKeyToken=16a2c5aaaa1b130d" Namespace="SourceCode.SharePoint.ProcessPortal.UI" TypeName="*" Safe="True" SafeAgainstScript="True" /> <SafeControl Assembly="SourceCode.SharePoint.ProcessPortal, Version=4.0.0.0, Culture=neutral, PublicKeyToken=16a2c5aaaa1b130d" Namespace="SourceCode.SharePoint.ApplicationPages" TypeName="*" Safe="True" SafeAgainstScript="True" />
How to add Custom Style Sheet CSS to your masterpage file
By peter.stilgoe
Edit your masterpage file, In the
tag add a link to your custom CSS file just above the content place holder named “PlaceHolderAdditonalPageHead” ie.<link href="/Style%20Library/mystyle.css" rel="stylesheet" type="text/css" />
Sharepoint 2010: How to remove columns from content types using powershell
By peter.stilgoe
Some columns once added to a content type dont allow you to remove them, you dont got a delete button. To delete one such column from your cotent type you can use the following Sharepoint Powershell Script:
#Attach to the web and content type $web = Get-SPWeb http://fldev003/sites/pjstest/ $ct = $web.ContentTypes["Post"] #Get link to the columnn from the web $spFieldLink = New-Object Microsoft.SharePoint.SPFieldLink ($web.Fields["Page Image"]) #Remove the column from the content type and update $ct.FieldLinks.Delete($spFieldLink.Id) $ct.Update() #Dispose of the web object $web.Dispose()
Sharepoint: How to find a Sharepoint feature by GUID
By peter.stilgoe
If you need to find a Sharepoint feature by its GUID because you are getting the error:
Error: The site template requires that the feature *GUID* be activated in the site collection
1) Site Actions -> Site Settings -> Site Collection Features
2) Right click on the features page and select ‘View Source’
3) Now do a search/find for the GUID & you will find the one in question (if its still installed on the farm)
Sharepoint: Site collection administrators lose their permissions
By peter.stilgoe
Sharepoint Site collection administrators lose their permissions.
An odd problem where I would login to Sharepoint with my normal Sharepoint Site Collection Administrator account & I would only have basic permissons & various OK buttons were greyed out.
This seems to be caused by having multiple jobs running against your Sharepoint databases at the same time, Sharepoint puts the site collection/database into Read Only mode.
To unlock the Sharepoint site / site collection either use Central Admin:
http://SharepointServer/_admin/sitequota.aspx
or use Stsadm:
stsadm -o -setsitelock -url http://servername/sitename/ -lock None
Sharepoint 2010 Powershell Backup Scripts
By peter.stilgoe
Sharepoint 2010 Powershell Backup Scripts
Backup a Sharepoint 2010 Farm:
Backup-SPFarm -BackupMethod Full -Directory "Destination directory" -BackupThreads 5
List all items included the Sharepoint 2010 Farm backup:
Backup-SPFarm –ShowTree
Backup a Sharepoint 2010 Site Collection:
Backup-SPSite -Identity "http://MySharepointServer/SC1/" -Path "Path and Filename"
Forefront Security for SharePoint: Calling LoadLibraryEx on ISAPI filter D:\Program Files\Microsoft Forefront Protection for SharePoint\FSSPUsernameFilter.dll failed
By peter.stilgoe
When Microsoft Forefront Security for SharePoint is installed on a SharePoint server, non-SharePoint sites may have problems accessing the Internet Server API (ISAPI) filter that is installed by Forefront Security.
On Internet Information Services (IIS) 7, users who browse to these sites may receive the following error message:
HTTP Error 500.0 – Internal Server Error
Calling LoadLibraryEx on ISAPI filter “D:\Program Files\Microsoft Forefront Protection for SharePoint\FSSPUsernameFilter.dll” failed
On IIS 6, users who browse to non-SharePoint sites may receive the following error message:
Service Unavailable
Internet Information Services 7 (IIS 7)
- In IIS Manager, navigate to a non-SharePoint Web site that is experiencing this issue.
- Select the Web site, and then double-click ISAPI filters.
- In the Filter pane, select FSSP Username Filter.
- In the Actions pane, click Remove.
- In the confirmation dialog box, click Yes.
Test the site to determine whether the issue is resolved. If the issue is not resolved, an IIS restart of the Web site may be necessary. You can do this through the IIS administrator.
Internet Information Services 6 (IIS 6)
To determine whether issue that is described in this article is the same issue that you are experiencing, examine in the Application Event Viewer. If if the ISAPI filter is causing this issue, the following error will be logged:
Type: Error
Event ID: 2214
The HTTP Filter DLL C:\\Program Files\Microsoft Forefront Protection for SharePoint\FSSPUsernameFilter.dll failed to load. The data is the error.
On IIS 6 servers, the ISAPI filter is not exposed at the individual site level. To resolve the issue, add the account that the non-SharePoint site is running as to the ISS_WPG and WSS_WPG security groups. On these servers, look up the account that the non-SharePoint site is running as. You can do this by looking at the credentials on the application pool that the site is running under. After you have the account that the non-SharePoint site is running as, follow these steps to resolve the problem:
- Add the account that the non-SharePoint site is running as to the ISS_WPG and WSS_WPG security groups.
- This makes sure that the Web site has permissions to load the ISAPI filter in the Forefront for SharePoint directory.
- For the changes to take effect, you must run an IISReset. To do this, open a command prompt, and then type IISReset. This shuts down and restarts all IIS services.
Publishing Sharepoint 2010 externally using MS UAG 2010
By peter.stilgoe
Making Sharepoint 2010 available externally using MS UAG 2010 you would think would be fairly straightforward however our experience is at best its very flakey! This is kind of backed up by the fact numerous blog posts & guides from Microsoft & 3rd party’s contradict each other, these are just my notes for how I managed to get it to work.
2 x WFE Windows Server NLB IP: 192.168.1.100
Public Host Name – extranet.abccorp.co.uk
Sharepoint Webapp: docs.abccorp.local
DNS: docs.abccorp.local –> 192.168.1.100
1) Making configuration changes on the UAG published application config – our experience was that if you create a new web application config in the UAG from scratch compared to editting an existing one to the same config you would quite often get different results. So when applying any config changes we always deleted the trunk & the published app config and recreated them from scratch with the required new config, this was the only way we felt we we’re getting the ‘true’ result of the config change.
2) The Application Server addresses & the application url – In order to get the UAG Sharepoint web application to work we had the following config:
HTTPS Trunk:
Public Hostname – extranet.abccorp.co.uk
Sharepoint UAG App:
Web Servers (Addresses tab) – docs.abccorp.local (DNS points the the NLB WFE IP Address)
Public Host Name (Addresses tab) – extranet.abccorp.co.uk
Application URL (Portal Link tab) – http://docs.abccorp.local
Notes on above –
# The address we put in for the web servers & application URL had to be the same, if they weren’t the same it seems the UAG didn’t encode the application URL correctly on the client side.
# We used Windows Server NLB as opposed to using the UAG to do the Load Balancing
Sharepoint 2010: Sample CSS to customise Site Actions button
By peter.stilgoe
Sample CSS to customise the ‘Site Actions’ buttons in Sharepoint 2010
/* Site Actions Menu */
.ms-siteactionsmenu{
border:1px solid transparent;
background-color:#F2F2F4;
}
.ms-siteactionsmenu .ms-menu-a span{
color:#000000;
}
.ms-siteactionsmenu .ms-siteactionsmenuhover {
background-color:#FFFFFF;
color:#ffffff;
}
More From pstilgoe
Sharepoint CQWP: XSL template to display document details
By peter.stilgoe
An example XSL template to display document details in a content query webpart:
<xsl:template name="DocumentsDetails" match="Row[@Style='DocumentsDetails']" mode="itemstyle">
<xsl:variable name="SafeLinkUrl">
<xsl:call-template name="OuterTemplate.GetSafeLink">
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="DisplayTitle">
<xsl:call-template name="OuterTemplate.GetTitle">
<xsl:with-param name="Title" select="''"/>
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
<xsl:with-param name="UseFileName" select="1"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="DisplayAuthor">
<xsl:call-template name="OuterTemplate.GetTitle">
<xsl:with-param name="Title" select="''"/>
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
<xsl:with-param name="UseFileName" select="1"/>
</xsl:call-template>
</xsl:variable>
<div class="item link-item">
<xsl:if test="string-length(@DocumentIconImageUrl) != 0">
<div class="image-area-left">
<a href="{$SafeLinkUrl}" title="{@LinkToolTip}">
<xsl:if test="$ItemsHaveStreams = 'True'">
<xsl:attribute name="onclick">
<xsl:value-of select="@OnClickForWebRendering"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$ItemsHaveStreams != 'True' and @OpenInNewWindow = 'True'">
<xsl:attribute name="onclick">
<xsl:value-of disable-output-escaping="yes" select="$OnClickTargetAttribute"/>
</xsl:attribute>
</xsl:if>
<img class="image" src="{@DocumentIconImageUrl}" title="" />
</a>
</div>
</xsl:if>
<div class="link-item">
<div style="color: black; font-family: Arial, Helvetica, sans-serif; line-height: -2%">
<xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>
<a href="{$SafeLinkUrl}" title="{@LinkToolTip}">
<xsl:if test="$ItemsHaveStreams = 'True'">
<xsl:attribute name="onclick">
<xsl:value-of select="@OnClickForWebRendering"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$ItemsHaveStreams != 'True' and @OpenInNewWindow = 'True'">
<xsl:attribute name="onclick">
<xsl:value-of disable-output-escaping="yes" select="$OnClickTargetAttribute"/>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="$DisplayTitle"/>
</a> | <xsl:value-of select="@Author" /> | <xsl:value-of disable-output-escaping="no" select="ddwrt:FormatDate(string(@Description), 2057, 5)" />
</div>
</div>
</div>
</xsl:template>
A returned file in the CQWP will display:
Plan 36 | xxxxxx\StilgoeP | 01/06/2011 09:35
Doc Icon (links to doc) – Doc Title (links to doc) – Author – Modified Date & Time
More From pstilgoe
STSADM -o backup -directory: Error Cannot open backup device Operating system error 5 (error not found)
By peter.stilgoe
STSADM -o backup -directory: Error Cannot open backup device Operating system error 5 (error not found)
Ensure the SQL service account is a domain account and it has permissions to
the Shared folder.
Also ensure the account used to execute the backup command has the correct rights on the DB’s as per MS recommendations ie. Owner, creator etc.
More From pstilgoe
Sharepoint 2010 Service Pack 1 (SP1) – Features
By peter.stilgoe
Sharepoint 2010 SP1 new features include:
- The usual stability, performance and security enhancements rolled up.
- A site recycle bin, basically we could always recover files etc from the recyclye bin but in SP1 you can now recover whole Sharepoint site collections & sites aswell!
- A new improved storage space allocation feature enabling site collection owners to have a better understanding of their storage usage, similar to the one in MOSS 2007 but better.
- Remote storage support for shadow copies ensuring better reliability and recoverability.
- New Powershell cmdlet (Move-spsite) for moving Site Collections between databases without moving content back in the db when using remote blob storage.
- Improved backup & restore functionality for Sharepoint Server 2010
- Project Professional synchronises scheduled tasks with Sharepoint task lists
- Google Chrome Support for SharePoint 2010 and Office Web Apps
More From pstilgoe
Sharepoint: Removing illegal characters from filenames prior to bulk uploading
By peter.stilgoe
If you are doing a migration from a filesystem to Sharepoint you will more than likely come across problems uploading documents to Sharepoint that contain illegal characters in their filenames.
In Sharepoint the following characters are classed as illegal characters – & ” : * ? <> # {} % ~ / \ Tab
The + character can also cause problems & should be avoided in filenames & sitenames.
Below are some useful Powershell scripts to help you remove the illegal characters prior to uploading your documents to Sharepoint.
List all files containing a specific character (in this case ‘&’)
gci -rec | ? {-not $_.psicontainer -and $_.name.Contains("&")}
Count the number of files containing a specific character (in this case ‘&’)
(gci -rec | ? {-not $_.psicontainer -and $_.name.Contains("&")}).Count
Replace a specific character with another, in our case the ‘&’ with the word ‘and’
gci -rec | ? {-not $_.psicontainer -and $_.name.Contains("&")} | % {rename-item $_.fullname -newname ($_ -replace "&","and")}
More From pstilgoe
Pingar – Discover new value from unstructured data
By peter.stilgoe
This looks very interesting tool & very useful in creating and maintaining your companies taxonomy.
“At PINGAR we have been building semantic search applications for business enterprises since 2007.
Consider the facts. The volume of data companies need to manage is growing 40 percent a year. Fifty percent of data searches are unsuccessful — employees may lose up to 25 percent of their productive time searching for information. And the cost to enterprises from failed searches is approximately USD $5.3 million per year, for every 1000 enterprise workers employed.
PINGAR’s research teams had three objectives:
•Deliver applications to assist enterprise workers to find more relevant data, faster
•Improve employees’ search experience
•Improve enterprise productivity and drive down costs.
These objectives were achieved with PINGAR’s Microsoft SharePoint 2007 and 2010, and Apache SOLR semantic search applications. Each can be purchased as an easy to install ‘plug-in’ server application, for distribution across enterprise networks.”
Find out more Pingar.com
More From pstilgoe
K2 Blackpoint In one way trust environment – process not showing as running in K2 Process Portal
By peter.stilgoe
Configuring K2 Blackpoint in a one way trust as per previous post. Deployed a new process & then triggered it by creating a new document. The process started & I could click on it & see it as ‘In progress’.
When I went to the K2 Process Portal the ‘Processes’ webpart showed the process as deployed with all the relevant data. However the process never displayed in the K2 Worklist webparts nor did it show as ‘Running’ in the K2 Instance Summary Webpart.
This is because the account that you are using to run your Sharepoint web application needs ‘Admin’ & ‘Impersonate’ rights on the K2 server.
More From pstilgoe
Sharepoint 2010: 2 service application databases with the same name showing in Central Admin –> Manage Databases Upgrade Status
By peter.stilgoe
I had a strange problem where if I went into:
Central Admin –> Manage Databases Upgrade Status
in Sharepoint 2010 I had 2 Business Data Connectivity Service databases with the same name! The status of the one in use was ‘No action required’ & the rogue one had ‘Database is too old and upgrade is required’
There was only one database showing on the SQL server, the one in use, if you find you get 2 service application databases with the same name (somehow!?) the command to delete it is:
Stsadm -o deleteconfigurationobject -id b9b3e713-9e53-42ab-a634-a2c54e90a0d6
(replace the guid with the rogue database guid)



January 26th, 2012
