How to display a URL in a DVWP using the XSLT ‘substring’ function

By peter.stilgoe









The code below will use the URL held in View_x005F_x0020_Flow but will only use the URL part before the comma

ie original URL

www.petestilgoe.com/&=testing,testing123

<a href="{substring-before(@View_x005F_x0020_Flow, ',')}">View Flow</a></td></tr>

URL after using the above code is:

www.petestilgoe.com/&=testing

Share

Leggi tutto

How to get the current List Item ID in a K2 Blackpoint / Blackpearl process

By peter.stilgoe









The current list item ID in a K2 Blackpoint / Blackpearl process is held in the ‘SpIntegrationData’ hive in XML fields. This hive is hidden by default so in the Object Explorer window you need to click the down arrow top right hand side & click ‘Show Hidden Fields’.

SPIntegrationData –> SPData –> All available data fields show here

This data is populated as soon as the process is started.

Share

Leggi tutto

K2 Blackpoint / Blackpearl: Using Sharepoint lookup columns in K2 processes

By peter.stilgoe









As you probably know lookup columns in Sharepoint are stored in this format “ID;#String” (record number & then the string value). I was trying to use a lookup value in a K2 process to make up the new sites URL when provisioning new sites. Obviously this was failing due to the way lookup columns are stored ie. illegal characters ID;#String.

You can get round this by using the K2 ‘Code Reference Event’

1) Add a ‘Code Reference Event’ to one of your activity containers on the K2 canvas.

2) Give the code event a name

3) Event Method Editor –> Call Constructor –> Add Reference –> Microsoft.Sharepoint.dll

4) Now on the Select Constructor Screen: Microsoft.Sharepoint –> SPFieldLookUpValue –> Constructor(String fieldValue)

5) Assign your Sharepoint Lookup Column to the fieldValue parameter

6) Now map the LookupValue field to whichever field you wish to store the lookup string value in, set ‘Retrieve Value’ and tick ‘after’

7) Now the field you chose to store the lookup string value will contain just the string without the prefix ID;# and can be used throughout the rest of your K2 process.

Share

Leggi tutto

Sharepoint 2010 & K2: The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator

By peter.stilgoe









If when trying to create a workflow on a list using K2 Blackpoint / K2 Blackpearl on Sharepoint 2010 & you get the following error when trying to enumerate lists:

“The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator”

You need to up the ‘List View Threshold’ in Sharepoint 2010:

Central Admin –> Manage Web Applications –> Select your web app & click –> General Settings > Resource Throttling.

The 1st option is List View Threshold which by default is set to 5000, you need to up this to something sensible for your environment.

Share

Leggi tutto

Sharepoint 2010: Create site from site template where alternate CSS url is set – unexpected error occured accessing site settings

By peter.stilgoe









When you create a site template in Sharepoint 2010 where the template is taken from a site that has an alternate CSS url set, you find on the newly created site that when you try & access ‘Site Settings’ or ‘View all site content’ you get the ‘An unexpected error occured’.

In your logs you get something like:

System.Web.HttpException: Error executing child request for /sites/SiteName/Style Library/site-style.css

This appears to be a bug, you can fix the site by running the following Powershell script:

$w = Get-SPWeb http://YourServer/YourWeb; $w.AlternateHeader = $null; $w.Update()

Share

Leggi tutto

Sharepoint Server Template Numbers

By peter.stilgoe









100 Generic list
101 Document library
102 Survey
103 Links list
104 Announcements list
105 Contacts list
106 Events list
107 Tasks list
108 Discussion board
109 Picture library
110 Data sources
111 Site template gallery
112 User Information list
113 Web Part gallery
114 List template gallery
115 XML Form library
116 Master pages gallery
117 No-Code Workflows
118 Custom Workflow Process
119 Wiki Page library
120 Custom grid for a list
130 Data Connection library
140 Workflow History
150 Gantt Tasks list
200 Meeting Series list
201 Meeting Agenda list
202 Meeting Attendees list
204 Meeting Decisions list
207 Meeting Objectives list
210 Meeting text box
211 Meeting Things To Bring list
212 Meeting Workspace Pages list
300 Portal Sites list
301 Blog Posts list
302 Blog Comments list
303 Blog Categories list
850 Page Library
1100 Issue tracking
1200 Administrator tasks list
2002 Personal document library
2003 Private document library

Share

Leggi tutto

Sharepoint DVWP: How to remove the group name when grouping items

By peter.stilgoe









When you create a DVWP & group your items, by default it will group them like this:

Grouped By Name:Specific Item

ie. +Matter_Number: 9999986

If you want the group title to just display the specific item name

ie +9999986

View your Dataview Webpart in code view & remove the following four lines of code:

<b>
<xsl:value-of select="$fieldtitle" />
</b>
<xsl:if test="$fieldtitle">: </xsl:if>

Share

Leggi tutto

SPDataSource Cross List Data View – Roll up all tasks across site collection

By peter.stilgoe









Add the following code to your Data View webpart (tbc)

<SharePointWebControls:SPDataSource runat="server" DataSourceMode="CrossList" SelectCommand="<Webs Scope='Recursive'></Webs><Lists ServerTemplate='107'</Lists><Query /><ViewFields><FieldRef Name='Title' /><FieldRef Name='Status' /><FieldRef Name='PercentComplete' /><FieldRef Name='Matter_x0020_Number' /><FieldRef Name='Task_x0020_KPI' /></ViewFields><QueryOptions />" UseInternalName="True" UseServerDataFormat="True" ID="dataformwebpart1"><SelectParameters><WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{470C3D07-87CE-4FFD-908B-A59223155B15}" Name="ListID"></WebPartPages:DataFormParameter><asp:Parameter DefaultValue="0" Name="StartRowIndex"></asp:Parameter><asp:Parameter DefaultValue="0" Name="nextpagedata"></asp:Parameter><asp:Parameter DefaultValue="10" Name="MaximumRows"></asp:Parameter>

Share

Leggi tutto

Sharepoint 2010 Error: An exception occurred when trying to issue security token Event ID 8306 and Event ID 7557

By peter.stilgoe









After creating a new secure store service application everytime I clicked manage it would say I dont have correct permissions no matter who I was logged in as. In the event logs I was getting the following errors:

Event ID 8306: An exception occurred when trying to issue security token: The server was unable to process the request due to an internal error.

Event ID 7557: The Secure Store Service application Secure Store Service Application is not accessible. The server was unable to process the request due to an internal error

The solution was that the ‘Claims to Windows Token Service’ wasn’t started on the Sharepoint server(s). Once I started this & restarted the Sharepoint services I was able to manage my secure store service application.

Share

Leggi tutto

Sharepoint 2010: Some or all identity references could not be translated

By peter.stilgoe









When adding a managed account in Sharepoint 2010 I was getting the following error:

The specified user *********\sv-2010devappsrvappcore could not be found. Some or all identity references could not be translated.

It seems like its related to the length of the username, something 20 chars or less seems to work.

Share

Leggi tutto

Sharepoint CAML query encoder decoder

By peter.stilgoe









A useful tool to encode and decode your Sharepoint CAML queries.

Use the CAML encoder and decoder to encode or decode CAML while working with SharePoint Data Source Control queries. This script utilizes both HTML rendering to decode and a PHP function to encode.

Sharepoint CAML query Encoder & Decoder

Share

Leggi tutto

Sharepoint 2010: Lookup columns in Data Views using SOAP & REST webservices

By peter.stilgoe









If you are using a webservice & a dataview to display list data across sites in Sharepoint 2010 you may come across this problem when displaying lookup columns.

A lookup field is stored in the format “ID;#Text”

When using a REST data connection the values returned for the lookup column is just the ID part of that item in the lookup list ie. “01″, I couldnt find a way how to return the text part of the lookup.

If you use a SOAP data connection it will retun the whole string ie, “01;#Blue”, so now we are getting the value but we dont want to display the the ID part or the ‘;#’ part. This is easily done changing the XSLT from

<xsl:value-of select="@ows_Colour_x0020_Status"/>

to

<xsl:value-of select="substring-after(@ows_Colour_x0020_Status, ';#')" />

Now in your dataview instead of displaying “01;#Blue”, you will just be displaying the text value “Blue”.




Share

Leggi tutto

Sharepoint 2010: Could not load type ‘System.Data.Services.Providers.IDataServiceUpdateProvider’ from assembly ‘System.Data.Services, Version=3.5.0.0

By peter.stilgoe









If when trying to access REST webservices through Sharepoint (ie http://goatpoint/_vti_bin/ListData.svc)

and you get the following error message:

Could not load type ‘System.Data.Services.Providers.IDataServiceUpdateProvider’ from assembly ‘System.Data.Services, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′.

You need to install the update below on your Sharepoint web front end servers:

ADO.NET Data Services Update for .NET Framework 3.5 SP1 for Windows 7 and Windows Server 2008 R2

http://www.microsoft.com/downloads/en/details.aspx?familyid=79d7f6f8-d6e9-4b8c-8640-17f89452148e&displaylang=en




Share

Leggi tutto

Sharepoint 2010: Database doesnt exist but sill appears in Central Admin –> Manage Databases Upgrade Status

By peter.stilgoe









If you have deleted your database in SQL but they sill appear in Central Admin –> Manage Databases Upgrade Status, you can use the following Powershell script to remove them:

$db = Get-SPDatabase | where{$_.Name -eq "YourDatabaseName"}

$db.Delete()




Share

Leggi tutto

How to display related information in a Sharepoint form based on a column / field choice

By peter.stilgoe









Looking to to automatically complete various columns in your Sharepoint forms based on the selection in a previous column ? If so take a look at SpServices Jquery library.

Here you have a function called: $().SPServices.SPDisplayRelatedInfo that will do just that.

Functionality
SPDisplayRelatedInfo is a function in the jQuery Library for SharePoint Web Services that lets you display information which is related to the selection in a dropdown. This can really bring your forms to life for users: rather than just selecting bland text values, you can show them images and links that are related to their choices.

How Does It Work?
The SPDisplayRelatedInfo function works like this:

When the function is first called, it attaches an event handler to the dropdown control. The logic here varies a bit depending on what type of dropdown it is.
When the selected option in the dropdown changes, SPDisplayRelatedInfo calls two Lists Web Service operations:

- GetList on the relatedList to get information about its columns (fields)
- GetListItems to get the items where the specified column’s value matches the current selection. Note that there can be multiple items returned; generally displayFormat: “table” makes more sense if you’ll want to display multiple items.
- For each column it’s asked to display, SPDisplayRelatedInfo calls a private function (showColumn) to render the column value based on its type. Most of the normal column types are covered, though locale conversions can’t be done from the client side (yet!). The related information is shown in a DIV which is inserted into the form. The DIV is named “SPDisplayRelatedInfo_” + columnStaticName in case you need to do any post-processing.

Tip: If you don’t want to see the column headers, pass in ms-hidden for headerCSSClass. (This is a CSS class in core.css which sets display: none.)

Prerequisites
You’ll need to have a list (relatedList) which contains the values in the dropdown in one column and the related values you’d like to display in additional columns. If you’re already using SPCascadeDropdowns, then you’ll already have a list (or lists) in place which you can use here.

Sample usage:


<script type="text/javascript">
$(document).ready(function() {
$().SPServices.SPDisplayRelatedInfo({
	columnName: "Consultant Lookup",
	relatedList: "Consultants",
	relatedListColumn: "Consultant_x0020_Name",
	relatedColumns: ["Sector"],
	displayFormat: "list",
	debug: true
	});
});
</script>

You will need to reference your Jquery & SpServices either in each page or specify it within your master page so its available throughout the whole site eg.

<script language="javascript" type="text/javascript" src="/jQuery%20Libraries/jquery-1.4.2.min.js"></script>
<script language="javascript" type="text/javascript" src="/jQuery%20Libraries/jquery.SPServices-0.5.6.min.js"></script>

SpService Codeplex Project

SpServices Display Related Info Function

Share

Leggi tutto