Monday, October 26, 2009

New in SharePoint 2010 Lookup fields

SharePoint 2010 introduces some new features in the lookup fields area.

The bad news are, I'm afraid, that still all lookups are restricted to the same site collection.

But, from now on you will be able to include more then one field in the remote list when creating a lookup. So that if you are creating a lookup to "customers" list, you can ask to see customer's first name, last name, company and email instead of just "full name" or "customer name" as before.

Another new feature allows you to enforce your lookup data integrity, meaning you can either prevent deleting an item that has other items connected to it, or cascade the delete action to delete all dependant items.
This is good for customers who has "project" list and "project tasks" list, where a task is connected to a project.
So, by deleting a project you can make sure that all that project tasks are also deleted.
Or - if you'd like, to prevent deleting a project wiht active tasks! which is also cool.

Finally, there are some news on reverse lookup. Although SharePoint 2010 does not fully support reverse lookup fields it has a new API for getting all related items for a specific list items.
This means, that this new API will get all items in SharePoint that has a lookup that is connected to the current item. This new API also comes with a new web part OOTB you can just drop at any list item view form to see its connected items.
But still, if you want real reverse lookup functionality you will have to go with a 3rd party solution like KWizCom's Cascading lookup plus field type currently available for SharePoint 2007 but will be upgraded as soon as there is a public release of 2010.

Another thing that is greatly missing (and is available in our cascading lookup) is... Cascading feature! :) I mean the option to filter items in one lookup field based on one or more other fields on the same page. Thus creating a 2 or more levels of dependant fields (Country/City/Street fields for example)
Well, good thing SharePoint 2010 is not perfect - gives us more work to do, right? :)


Enjoy your migraion!
If you need help, feel free to contact us,

Using LINQ and REST in SharePoint 2010

Among the new APIs available for SharePoint 2010 developers the 2 new most significant ones are LINQ and REST.

While developing server side code, you can now make use of LINQ to query your lists instead of using CAML.
The benefit of using LINQ is clear, working with strong typed objects and cutting down the development effort by a lot.
The problem comes when you are not sure what type of lists you are going to work on, and if you wish to support custom lists created by customers.
Before you can use LINQ on SharePoint you need to create an object that represent that list structure, and once the list changes (the fields you are querying are removed to renamed) you will not be able to use it anymore :(

But - remember, working on the server site with the SPList object is dengerous as well, as all you get are item[field_name] resutls, which is not strongly types and requies many validations to be done!

While working on the client side, you will be able to work using the client side object model (much like the server side, using Site/Web/List instead of SPSite/SPWeb/SPList we have on the server) but still that will not be strongly typed for you.
The news are that you will be able to use LINQ in the client side, that will allow you to automatically render the correct proxy objects in the client side (accessible from javascript / silverlight) and will be strongly typed!

So, by all means - start learning SharePoint REST syntax and commands...
here are some available commands to get you started:
$filter=
$expand=
$orderby={property}
$skip=n
$top=n
$metadata – bring all metadata of that object

These commands are accessible under the REST service URL which includes (sometimes) the entity name you wish to run against, like so:
http://site/subsite/_vti_bin/ListData.svc/{Entity Name}/{Options...}

This service URL can be registerd to the client using the standard ASP.NET AJAX way for registring services, and everything is made simple after that!

(If you need more info on ASP.NET AJAX you should definitly check these how-to's by Joe Stagner here: http://www.asp.net/learn/ajax-videos/ and specifically on registring services here: http://www.asp.net/learn/ajax-videos/video-82.aspx)

Well, are you excited as I am to move onto SharePoint 2010 yet? :)

Tuesday, October 20, 2009

How to override the sandboxed current site execution limitation

When you publish a solution in SharePoint as a sandbox solution, we already talked about that the proxy API will block any access to other remote site collections.

An easy override to this is simple - simply use the client API and you will be able to access any share point site you wish without going through the proxy API that a sandboxed solution uses.