K2 Blackpoint Blackpearl not showing in Sharepoint Central Administration
By peter.stilgoe
If you are installing K2 Blackpoint / K2 Blackpearl in a distributed Sharepoint environment, you install K2 for Sharepoint on your web front ends but the K2 section still doesnt appear in Sharepoint Central Administration.
This is probably because you are hosting your central admin web app on a different server ie. an application server, if this is the case you need to install K2 on this server hosting your central admin as well as your Sharepoint Web Front End servers.
More From pstilgoe
Sharepoint CQWP: XSL to link document icon to document and open in edit mode
By peter.stilgoe
The xsl code will display & make the document icon link to the sepcific document & open it in edit mode in your content query webpart:
<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>
Sharepoint CQWP How to format date from mm/dd/yyyy to UK dd/mm/yyyy
By peter.stilgoe
To format your Sharepoint content query webpart to UK date format do the following:
In your ItemStyle.xsl add the following line to your declarations:
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
Then use the following line to display & format your date field in UK date format:
<xsl:value-of disable-output-escaping="no" select="ddwrt:FormatDate(string(@Modified), 2057, 5)" />
@Modified is your date field that you want to format
Sharepoint Workflow Task Error: This task is currently locked by a running workflow and cannot be edited
By peter.stilgoe
Error in Event Log on Sharepoint Server: This task is currently locked by a running workflow and cannot be edited
When a workflow processes a task normally, the following sequence of events is expected to occur:
1. The process begins.
2. The workflow places a ‘lock’ on the task so nothing else can change the values while the workflow is processing.
3. The workflow processes the task.
4. The lock is released when the task processing is finished.
The error occurs because the lock never gets released, which usually occurs between steps 2 – 4. You can read more from this forum post.
http://connect.nintex.com/forums/thread/6503.aspx
Anyway I was getting this problem in a K2 Blackpoint / Blackpearl workflow which was preventing my workflow from moving to the next step. I resolved it by creating a new task list & pointing my K2 process to the new task list, no locking errors & the workflow runs fine now.
You may get similar errors with any workflow product ie. Nintex, Sharepoint Designer Workflow, C# Workflow etc, anything that uses the Sharepoint Workflow Engine & Sharepoint Task Lists.
Sharepoint – How to setup a one way trust & required ports
By peter.stilgoe
1. Open Command Prompt.
2. Type: netdom trustTrustingDomainName/d:TrustedDomainName/add
TrustingDomainName – Specifies the DNS name (or NetBIOS name) of the trusting domain in the trust being created.
TrustedDomainName – Specifies the DNS name (or NetBIOS name) of the domain that will be trusted in the trust being created.
• To perform this procedure, you must be a member of the Domain Admins group or the Enterprise Admins group in Active Directory, or you must have been delegated the appropriate authority. As a security best practice, consider using Run as to perform this procedure. For more information, see Default local groups [http://technet2.microsoft.com/WindowsServer/en/library/f6e01e51-14ea-48f4-97fc-5288a9a4a9b11033.mspx], Default groups [http://technet2.microsoft.com/WindowsServer/en/library/1631acad-ef34-4f77-9c2e-94a62f8846cf1033.mspx], and Using Run as [http://technet2.microsoft.com/WindowsServer/en/library/8782f8ab-9538-4111-8a68-7bfd130c21c01033.mspx].
• To open a command prompt, click Start, point to All programs, point to Accessories, and then click Command prompt.
• This command-line method requires the Netdom Windows support tool. For information about installing Windows support tools, see Related Topics.
• Other switches can be used to assign a password or determine the direction of the trust. For example, to make a two-way, transitive trust, you can use the following syntax:
netdom trustTrustingDomainName/d:TrustedDomainName/add/twoway
• To view the complete syntax for this command, at a command prompt, type:
netdom trust | more
One Way trust validation
Inbound
————–
LDAP 389 UDP and TCP
MS DS 445 TCP
DCE Endpoint resolution – portmapper 135TCP
Netlogon fixed port
Using object / people picker
Outgoing
—————
LDAP 389 UDP and TCP
LSA fixed port
Kerberos 88 UDP
DCE endpoint 135 TCP
Netlogon to external forest with NTLM
Outgoing
————
DCE endpoint 135 TCP
netlogon fixed port
K2 Blackpoint Blackpearl – How to update a Sharepoint list items using common meta data
By peter.stilgoe
In a K2 Sharepoint process you will quite often have to update the same piece of meta data in multiple locations ie. you have a status column which is part of the list your process is attached to but you may need to reflect this status update on another list item in another list for reporting purposes or something similar. Your lists will need to have a common piece of metadata like a ‘reference number’ or something similar in order for you to return the List IDs’.
You can do this fairly easily using the ‘Sharepoint Search’ event wizard in K2.
- Drop the Sharepoint Search Event wizard on to your design canvas
- Choose ‘Search in a Sharepoint List or Library’ this will just search the specific list your point it at
- Add the URL of the Sharepoint site where the list resides & pick the list you want to search
- Now specify you search parameters ie
Content Type: Order
Field: Reference Number
Operator: Equal
Value: Order Number (This column exists on your other list ie. the one attached to your existing process)
This is now searching your list for a reference number that matches the order number on your original list.
- Create a content field in order to store the results on the next screen
- Finish the process and save
- Now if you go into your process explorer you can browse your new content field that will contain the List ID of your item everytime your search event fires
ie. Object Browser –> XML Fields –> ‘Process Name’ –> ‘Content Field Name’ –> Items –> Item –> Item (This contains the List Item ID of the item you wish to update on the other list)
ps: I wrote this in a hurry which is probably apparent!
How to delete a corrupted Sharepoint list
By peter.stilgoe
Sometime you will find you have a currupted list that you cant delete through the normal way as when you try & access the list or the list settings the webpage throws errors. In this case use STSADM
stsadm.exe -o forcedeletelist -url http://devapp01/Lists/<MyListName>/
More From pstilgoe
Creating custom reports using K2 Blackpoint and ADO.net
By peter.stilgoe
In K2 Blackpearl you have access to a K2 Report Designer making it fairly easy to create custom reports, however in Blackpoint there is no report designer. The good news is you can still create custom reports by creating a new Web Application in Visual Studio & using the ADO.net provider that ships with Blackpoint for interacting with Smartobject data.
“K2 blackpoint ships with an ADO.net provider for interacting with SmartObjects. This includes any SmartObjects that you create against SharePoint content, Workflow SmartObjects that you can configure when designing your process, as well as some pre-configured reporting SmartObjects which are used by the out of the box reports in the process portal.
The ADO.net provider allows you to build ASP.net forms as well as SQL Reporting Services reports in much the same way as you would use any other ADO.net provider.
Today I will show you the ASP.net example. The recording attached to this post also discusses using the ADO.net Provider in a SQL Reporting Services report. The configuration of the data source is similar for ASP.net and SQLRS.
For this example I have created a basic web page project. There are 2 things that you will need to configure to ensure that your ASP.net page works properly with the data provider”
Read more Creating Custom Reports With K2 Blackpoint
More From pstilgoe
Modifying an Open XML Document in a SharePoint Document Library
By peter.stilgoe
C# Console Application code to query a Sharepoint Library, Open a document, Make a change & then save the document.
You need references to WindowsBase.dll, Microsoft.Sharepoint & DocumentFormat.OpenXml
You also need to ensure your project is .Net 3.5 & set to target ‘Any CPU’ in the project properties.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using Microsoft.SharePoint;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;
class Program
{
static void Main(string[] args)
{
string siteUrl = "http://localhost";
using (SPSite spSite = new SPSite(siteUrl))
{
Console.WriteLine("Querying for Test.docx");
SPList list = spSite.RootWeb.Lists["Shared Documents"];
SPQuery query = new SPQuery();
query.ViewFields = @"<FieldRef Name='FileLeafRef' />";
query.Query =
@"<Where>
<Eq>
<FieldRef Name='FileLeafRef' />
<Value Type='Text'>Test.docx</Value>
</Eq>
</Where>";
SPListItemCollection collection = list.GetItems(query);
if (collection.Count != 1)
{
Console.WriteLine("Test.docx not found");
Environment.Exit(0);
}
Console.WriteLine("Opening");
SPFile file = collection[0].File;
byte[] byteArray = file.OpenBinary();
using (MemoryStream memStr = new MemoryStream())
{
memStr.Write(byteArray, 0, byteArray.Length);
using (WordprocessingDocument wordDoc =
WordprocessingDocument.Open(memStr, true))
{
Document document = wordDoc.MainDocumentPart.Document;
Paragraph firstParagraph = document.Body.Elements<Paragraph>()
.FirstOrDefault();
if (firstParagraph != null)
{
Paragraph testParagraph = new Paragraph(
new Run(
new Text("Test")));
firstParagraph.Parent.InsertBefore(testParagraph,
firstParagraph);
}
}
Console.WriteLine("Saving");
string linkFileName = file.Item["LinkFilename"] as string;
file.ParentFolder.Files.Add(linkFileName, memStr, true);
}
}
}
}
Code written by Eric White
More From pstilgoe
Sharepoint Object Model C# Error The Web Application at could not be found. Verify that you have typed the URL correctly
By peter.stilgoe
When running some C# code containing a reference to SPSite ie
string siteUrl = "http://devapp01/";
using (SPSite spSite = new SPSite(siteUrl))
I was getting the following error:
The Web Application at could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.
Looking at various forums people have spent along time troubleshooting this problem, in my case it was easily fixed by:
Go to Project Properties -> Build -> Target Platform -> Make it Any CPU (default is x86)
More From pstilgoe
- Error: Cannot retrieve the information for application credential key
- Deploying K2 process: Error occurred adding the feature to the farm Server was unable to process request. —> Access denied.
- Sharepoint 2010 CQWP: Make the CQWP portable by using tokens to point to the current site instead of static URL
Page cannot be found when trying to view a K2 Sharepoint Workflow Integration Task
By peter.stilgoe
If you are creating a K2 Blackpearl / K2 Blackpoint process using the ‘Sharepoint Workflow Integration Client’ and when trying to open a particular task item to complete it & you get a ‘page cannot be found’ error in you web browser, its probably because the task title in your workflow contains a ‘&’ char.
Replace ‘&’ with ‘and’ or something and you will be able to view & complete your K2 task as expected.
More From pstilgoe
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
More From pstilgoe
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.
More From pstilgoe
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.
More From pstilgoe
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
More From pstilgoe
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>
More From pstilgoe
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
More From pstilgoe
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”.
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>
SpServices Display Related Info Function
More From pstilgoe
Populate a Sharepoint list from an SQL Database
By peter.stilgoe
If you are wanting to populate a Sharepoint list from an SQL database or populate a SQL database from a Sharepoint list you can do this failry easily using SSIS & the SharePoint List Source and Destination Adapter project on Codeplex.
Introduction
This sample illustrates the creation of a a source and destination adapter in C#, using the public APIs for Microsoft SQL Server Integration Services. The component connects to SharePoint through a proxy dll, which wraps the complexities of working with the SharePoint Lists Webservice.
The Specific Features of the included SSIS Components are:
SharePoint Source Component
- Auto-detects all of the public fields from a SharePoint List or view of the list.
- Supports removal of fields from the output flow, which optimizes the query against SharePoint for increased performance.
- Supports restricting SharePoint data by a custom CAML query, which can be provided through a variable expression for fine tuned filtering over large lists.
- Provides a tuning feature for the # of rows to return at a time. Often with SharePoint, large lists need to be brought over in smaller batches than wide (many field) lists, or else the Webservice will die. The batchsize lets you specify a solid size that works for your list.
SharePoint Destination Component
- Auto-detects all of the editable fields from a SharePoint List
- Only fields bound to columns from the input flow will be ‘updated’, for performance.
- Supports deleting rows by ID
Included Bonus – SharePoint Utility
To simplify the adapter code and keep the SharePoint routines generic, a proxy VB.Net component is included which access the SharePoint Webservice API. It includes a very flexible api for getting SharePoint List information, which is used by the Components above. In addition, it can publish and remove files from a document library.
Component Features
Unique features that may inspire you to create great custom SSIS components:
• Extensive Validation: Validation for this component actively goes against the SharePoint Site to verify the properties are valid.
• Values from Expressions: This component supports external variables, which can be expressions, and can be attached to the source component to customize the query. Similar to the CommandText for the other Sql Components
• Linq: The Component has been written using Linq with .net 3.5 and shows how elements such as the metadata and columns can be combined to create a readable usage in a Linq format.
• Custom properties: The component keeps its configuration in custom properties on itself, inputs, and input columns.
• SharePointUtility Component: Simplifies access to the SharePoint Lists / Views WS using Linq friendly objects
Sharepoint List Source & Destination project on Codeplex



April 21st, 2011
