March 2010 Entries

Combining LINQ to SharePoint and LINQ to Objects

Although the join syntax in LINQ to SharePoint is very powerful, sometimes there are situations where you won’t be able to retrieve the data that you need using this syntax. Sometimes there may be operations that you require that are not permitted on the LINQ to SharePoint provider since they are considered inefficient. Performing an in memory sub-query As an example, let’s imagine that our sample application requires a list of asset tags and locations codes for a particular contract, but only where the locations are also being used to store assets that are subject to another contract....

posted @ Tuesday, March 16, 2010 12:08 PM | Feedback (0)

Creating a web service to access BCS data in SharePoint 2010

Programmatically accessing BCS data BCS exposes an extensive object model that allows developers to create clients applications that leverage the flexibility of the BDC service. Using this object model we’ll create a simple web service application that will demonstrate some of the major functions of the API. In Visual Studio 2010 create a new ASP.Net Web Service Application project. Name the project ModelDataWebService.Remember to set the CPU to x64. Add references to: Microsoft.BusinessData (listed as Microsoft® SharePoint® Foundation Business Data) and Microsoft.SharePoint. Connecting to the BDC Service Add a new web method as follows: ...

posted @ Monday, March 15, 2010 10:14 AM | Feedback (3)

Using the Refinement Web part in SharePoint 2010

20 Aug 2010 Update : I’ve added an article on creating custom refinement generators here. The RefinementWebPart can be used to automatically generate a series of refinement filters for a given result set. Refinements are basically property filters that derived from a result set. So for example, if a result set contains results of different types such as web pages and Word documents, there refinement web part will show refinement option for only web pages or only Word documents. Let’s look at how the RefinementWebPart works in a bit more detail since a good understanding of the inner...

posted @ Sunday, March 14, 2010 10:20 AM | Feedback (7)

Make a Custom Activity available to SharePoint Designer 2010

Creating custom workflow activities for use in Visual Studio is all fine and well but what happens if we want to make those activities available within SharePoint Designer? Thankfully the process is pretty straightforward. Since SharePoint Designer is a client tool, it’s designed to run remotely as opposed to on the SharePoint Server. As a result of this, when determining which workflow action should be available for use on a particular site, SharePoint Designer connects to the server to retrieve a list of available actions. The list of actions is stored at %SPRoot%\Template\1033\Workflow. In this folder there are a...

posted @ Saturday, March 13, 2010 9:58 AM | Feedback (2)

Joins in LINQ to SharePoint 2010

You may have noticed above that the Join extension method is not permitted within LINQ to SharePoint. However, this does not mean that retrieving related data isn’t possible, only that arbitrary joins are not supported. Where the relationship between two entities is defined by a lookup column, retrieving related data is permitted and in fact is actually achieved using a much simpler syntax than is required by the Join operator. Simple join private void button8_Click(object sender, EventArgs e) { using(SampleDataContext dxRead = new SampleDataContext(SiteUrl.Text)) { StringBuilder...

posted @ Friday, March 12, 2010 9:19 PM | Feedback (0)

Debugging Excel Services UDFs using Visual Studio 2010

Debugging UDF’s is not quite as simple as debugging other SharePoint artefacts. The UDF is called by the Excel Services service application which runs as a separate process. Bearing this in mind we have two options, we can either attach our debugger to all instances of the w3wp.exe process, or we can find out which process is being used to run service applications on out server. Discovering the ProcessID used to run a User-Defined Function Even though I’m sure that everybody will take the lazy option of attaching to all worker processes, here’s how we can find out...

posted @ Thursday, March 11, 2010 9:02 PM | Feedback (0)

How Deploy a WCF Service To SharePoint 2010

The new packaging and deployment stuff for SharePoint 2010 is certainly a lot better than VSeWSS but there are a few things missing, such as the ability to add a WCF service as a project item. One of these days I’ll build a template to do it but for now here’s a quick step by step guide. Add SVC file to Layouts folder To make a Windows Communication Framework service available we need to host it somewhere. Since SharePoint runs on IIS, we need to create a .svc file with details of the service implementation. Of course before...

posted @ Wednesday, March 10, 2010 8:39 PM | Feedback (2)