Friday, April 8, 2011

Migrating MOSS to BPOS –Part II

This is a great video on how you can pull data from SharePoint using LINQ to SharePoint. I think for an Alpha it is quire stable from what I can tell. To better understand LINQ to SharePoint, the video below goes into how to use Web Services, the SharePoint Object Model, writing your own CAML by hand, how to write you own LINQ syntax and how LINQ works. Very good course on LINQ itself, lamdba expressions, etc.

Highlights:

  • CAML Builder Tool if you want to use Object Model and not hand write the CAML code
  • Everything that can be done in the UI of SharePoint can be done using the Object Model (Sharepoint.dll)
  • LINQ to SharePoint
  • Intro into Extension Methods and Lamdba Expressions (shorter syntax for specifying delegate methods).
  • How to write your own LINQ language such as LINQ to SharePoint which is really just mapping LINQ to CAML
  • Can use LINQ to SharePoint in a SharePoint web part which uses the Object Model, but can ALSO do the same code but have it use the web services model by sending all the CAML to SharePoint at once and getting back result (using LINQ to SharePoint).
  • Linq to SharePoint is not created by Microsoft, but is available on codeplex.
  • Once LINQ to SharePoint is installed, there is a new type (template) that you can select in Visual Studio called LINQ to SharePoint File.
  • LINQ to SharePoint is nice syntax and easy to work with and it is also very fast like CAML.

After watching this, I am excited to use it. I installed LINQ to SharePoint and I like it a lot. It is very nice. Be sure to use the newest example, don’t go to the samples page until you understand that SharePointDataSource is now a SharePointDataContext and the code is a little bit different. I did find out that it ONLY works on lists. It does NOT work on Shared Document Libraries, but it does work on Events and Tasks. Basically, I believe it works on anything that shows up under the List of a site. Also, from what I can tell, it only works on a particular web. This can be good and bad.

In the end, this will NOT give me a list of users or anything like that because it is not a list. It also doesn’t appear to support any kind of updating of data. I think I am back to the SharePoint web services for updating or getting users or document libs, etc. I think LINQ to SharePoint is a great tool for querying list data in SharePoint.

No comments: