Archive for April, 2010
Workflow Foundation Correlation Token error
Posted by Jake in SharePoint, Workflow Foundation on April 22, 2010
Within a workflow that I was developing, there was a requirement to notify a group of SharePoint users that a lookup service had failed. This particular activity was within a parallel activity sequence. I chose to use the SendEmail activity to notify the users, but incorrectly set the Correlation Token to a new value. When testing this functionality in the workflow I received an error:
- WinWF Internal Error, terminating workflow Id#
- System.InvalidOperationException: Correlation value has not been initialized on declaration emailToken_JobNumberCreate for activity sendEmail_JobNumberNotCreated. at System.Workflow.Activities.CorrelationService.InvalidateCorrelationToken
The correct Correlation Token for a SendMail Activity is the “Workflow” token. The reason, which is fairly obvious, is that the SendEmail activity maps to the workflow, not to a task, which would require a Task Token.
Source 1
The U2U CAML Query tag
Posted by Jake in SharePoint on April 9, 2010
While I was building a CAML query for retrieving files from a document library, I used the U2U CAML query tool to construct the query syntax. It worked fine in the tool and returned the proper data, but when I used that query in the code, I found that ALL files were returned and not just the ones I expected.
As it turns out, the U2U CAML Query tool adds the tag <Query> to the query although it should not be included when using it to query items from a SPList. (Note: There are some instances where the Query tag is required, but for this case, it is not)
Here is a sample query:
SPListCollection spBPDLListCollection = spBPDLWeb.Lists;
SPList splist = spBPDLListCollection[documentLibraryName];
SPQuery query = new SPQuery();
// CAML for looking up documents owned by current user
query.Query = “<Where><Contains><FieldRef Name=’Author’ /><Value Type=’User’>”
+ currentDisplayName + “</Value></Contains></Where>“;
// get the items specified with the query
SPListItemCollection items = splist.GetItems(query);
Searching Stored Procedures
Posted by Jake in SQL Server on April 9, 2010
Here is a quick and easy way to search of stored procedures, views, user functions from within a database:
–Search ALL user functions, views, stored procs
USE [PortalData]
SELECT OBJECT_NAME([id]) FROM syscomments
WHERE [id] IN (SELECT [id] FROM sysobjects WHERE xtype IN (‘fn’, ‘P’, ‘v’, ‘TR’, ‘U’, ‘X’))
AND [text] LIKE ‘%TypeSearchStringHere%