We just released a new version of the CAML Designer 2013. It does not contain a lot of new features but they are rather important changes:
- As of now there is only one CAML Designer anymore: you can use the CAML Designer 2013 to connect to both SharePoint 2013 and SharePoint 2010.
- The CAML Designer can now connect to Office 365
A big thank you to Peter Karpinski who enabled the connection to Office 365! He enforced our team a few weeks ago. Peter Karpinski is a Swedish SharePoint expert and teacher who is highly involved in Office 365 for the last couple of years.
Complete documentation on the CAML Designer 2013 can be found here.
Only one CAML Designer
As of now you only need one CAML Designer to both access SharePoint 2010 and SharePoint 2013. If you want to access a SharePoint 2010 environment, you will have to connect with the client-side object model and web services. Because the CAML Designer 2013 is compiled against the .NET framework 4.5, you are not able to connect to SharePoint 2010 with the server object model BUT the code snippets for the server-side object model remain available.
Once connected to the SharePoint 2010 environment, you will only get the code snippets that are available on SharePoint 2010; i.e. no REST snippets and limited set of code snippets for the client-side object model (which are lot extended in SharePoint 2010).
Connect to Office 365
The CAML Designer can now also connect to your Office 365 environment. Click the Office 365 button, and fill out the URL to your O365 environment. The UI also asks to fill out your credentials:
In your list of recent connections your O365 connections are represented by a key.
We have to admit that it only supports the Office 365 accounts on SharePoint 2013. As all accounts are migrating towards SharePoint 2013, Peter Kapinski advised us not to support the SP2010 accounts.
Other speakers will be revealed soon on http://www.sharepointsaturday.org/belgium/default.aspx.
The BIWUG board is very proud to announce our first speaker:
Mikael was also speaker at the SharePoint Conference 2012 at Las Vegas, something most of us dream of, but only a happy few are chosen. He presented a session on People Search and Extensibility in SharePoint 2013. He is a well-known SharePoint Server MVP and his contribution to the SharePoint Search domain is highly esteemed.
This is the first speaker we announce but a lot of other speakers will be revealed the coming days and weeks. We will also start filling up the agenda as of following week. So stay tuned to http://www.sharepointsaturday.org/belgium/default.aspx.
Hope to see you there!
Andy Van Steenbergen and I worked very very hard to revamp the CAML Designer and finally the tool is ready to be released: here is the CAML Designer for SharePoint 2013!I don’t need to mention that we are very proud of it
This version is much more user friendly and no hasle with resizing of the different panels anymore. The design is metro style based.
The functionality of this version of the tool is similar to what it offers you for SharePoint 2010:
- you can build CAML queries for single lists
- you can build queries that can be executed with SPSiteDataQuery
With this first version of the tool you are not able to connect to SharePoint 2013 online yet, but it is definitely something we are going to look at for next version.
In the past, a number of additional functionalities have been requested, like f.e. a search box to search for a field in a list with a lot of fields. These functionalities have not yet been built in. Also taxonomy support for client-side object has been enhanced in SharePoint 2013 but these enhancements are not yet reflected in the tool.
As you can see, we still have a lot of work on our plate to make it the perfect tool
You can download the tool from the BIWUG site. Click the download tab, select the CAML Designer and there you will find a link to download the application.
A detailed explanation on how to use the tool can be found here.
Have fun with it and please, don’t hesitate to give us your feedback!!
Yesterday we’ve put a new version of the CAML Designer online. This version introduces support for Site Data Queries. When you open the CAML Designer, you will see that there are 2 buttons on the ribbon now: one for CAML Query and one for Site Data Query. The CAML Query button is enabled by default.
You can execute site data queries with the server-side object model using SPSiteDataQuery. As there is no alternative for web services and client-side object model, this button is disabled when logging on other then with the server-side object model.
More detailed documentation on CAML and the CAML Designer can be found here.
Yesterday we’ve put a new version of the CAML Designer online. This version fixes a number of bugs but also introduces support for SharePoint Online and cross-site lookups.
When you open the CAML Designer and click the CAML Query tab, the logon dialog is immediately displayed. You can fill out the URL to your SharePoint Online site. You don’t have to specify your credentials in the credentials box at the bottom of the logon dialog because they will be asked later on while authenticating. Don’t forget to switch to Client Object model or even the SharePoint Web Services.
Once you click the OK button, a browser is opened which asks you to enter your credentials to get authenticated against SharePoint online.
Once your credentials are validated, you will that the treeview gets populated with the lists and libraries of the SharePoint Online site.
We also changed the flow of the user interface a bit. When you click the Connect button, the logon dialog is displayed. After entering a valid URL and having clicked the OK button, your are automatically redirected to the CAML tab. Once on the CAML tab, the treeview is automatically populated with the lists of the SharePoint site you wanted to connect to. Selecting a list will populate the left panel with fields, but also activate the Where button so you can immediately start building the Where clause.
Another improvement we built in based on input of one of our users, is the dropdown list on the logon page with URLs you already accessed using the CAML Designer.
More detailed documentation on CAML and the CAML Designer can be found here.
One of our “users” – or may we call him beta tester? - Maximilian Melcher also recorded a video on the CAML Designer . Thanks Max!
Finally! The new CAML Designer is released! I did not do this alone this time, I co-developed the tool with Andy Van Steenbergen, one of my friends at the BIWUG board.
When I developed the first version of the U2U CAML Builder back in 2004, CAML was an exotic language that nobody knew and nobody wanted to learn. In the beginning the tool lived on the blog of my dear friend Patrick Tisseghem, who unfortunately died in september 2008, far too early. Thanks to the tool, which is used all around the world, each SharePoint developer knows how to use CAML.
The user interface is completely designed in WPF. If you install the tool on a server where you have installed SharePoint 2010, you can logon using the SharePoint server object model. But if you have to use the tool remotely, you can connect to SharePoint 2010 using the .NET client object or the SharePoint web services.
For the moment you can only build queries for SharePoint 2010, but once SharePoint vNext is out, we will upgrade the tool. Once you are logged in to SharePoint, you are able to build queries from very simple to very complex. You can also view code snippets in C# for the SharePoint server object model, for the .NET client object model and for the SharePoint web services.
Updated: The version downloadable from the site is a click-onnce application, meaning that each time you start the application, it checks online if no newer version exists. If this is inconvenient to you (because f.e. your server is not connected to the internet) and you want to download an off-line version, you can click this link.
The tool is still in beta and I know there are still a few glitches. We are working on it and will post new versions of the tool frequently. But with the click-once way of installing it, you will be asked to update your version of the tool as soon as we release a new version of it. If you find bugs yourself or if you have ideas please do not hesitate to post a message to email@example.com.
I hope you enjoy this one!
There we go again! With our new BIWUG board we are organizing our second SharePoint Saturday on April 28th 2012. This time SharePoint Saturday is hosted at Xylos, located at Business Faculty Brussel, St. Lendriksborre 6 Font Saint Landry, 1120 Brussel (Neder-Over-Heembeek)
Our agenda is not yet complete but we can already tell you that we were able to attract speakers like Chirstina Wheeler, Penny Coventry and Wouter Van Vugt. Naturally we have also Belgian talent that will give sessions based on their experience with SharePoint. All sessions will be based on SharePoint 2010.
This time we will also have at least 3 tracks: a SharePoint Power user track, an IT Pro/Administrator track, and a Developer track.
You can find more details about sessions, speakers and sponsors at our special SharePoint Saturday site. More and more information will become available on the site in the coming days and months. So stay tuned!
Subscriptions started…. TONIGHT! You can subscribe here.
SharePoint 2010 comes with a whole set of new features. One of these novelties is the Client Object Model. (Well it are 3 novelties because there are 3 different Client Object Models that you can use depending on the situation you are in).
When SharePoint 2010 came out, there were some rumours that CAML was dead because now we have LINQ to SharePoint. But these rumors are not true: CAML is still there and is still very important for the performance of your SharePoint application. In this blog post I’m going to detail how CAML can be used with the .NET Client Object Model.
Working with the .NET Client Object Model
Before you can start working with the .NET Client Object Model, you have to add a reference to the assemblies Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll. You can find these assemblies in the 14\ISAPI folder.
The Where clause
The Where clause can range from very simple to very complex with one or more nested <And> or <Or> elements. The CAML for the Where clause has not been changed since SharePoint 2003, and can be used with the SharePoint Server Object Model and with the three Client Object Models. Also the Web Services are still there, for which you can also use CAML to retrieve and/or update list items.
To retrieve list items from a SharePoint list, you have to define an instance of type CamlQuery, defined within the Microsoft.SharePoint.Client.CamlQuery namespace. You can specify your CAML query within the ViewXml property. This property is of type string but its content must be XML. The root element for this property is <View>. The Where clause needs to be embedded within a <Query> element.
Microsoft.SharePoint.Client.CamlQuery query = new Microsoft.SharePoint.Client.CamlQuery(); query.ViewXml = "<View>" + "<Query>" + "<Where><Eq><FieldRef Name='Country' /><Value Type='Text'>Belgium</Value></Eq></Where>" + "</Query>" + "</View>"; // execute the query ListItemCollection listItems = spList.GetItems(query); clientContext.Load(listItems); clientContext.ExecuteQuery();
The OrderBy element is the most simple one: you can define a sort order using one or more <FieldRef> elements that you include in the ViewXml property of the CamlQuery object:
query.ViewXml = "<View>" + "<Query>" + "<Where><Eq><FieldRef Name='Country' /><Value Type='Text'>Belgium</Value></Eq></Where>" + "<OrderBy><FieldRef Name='City'/></OrderBy>" + "</Query>" + "</View>";
You can also limit the number of columns returned to the client, using the good old ViewFields element, which you can also include in the ViewXml property of the CamlQuery object:
CamlQuery query = new CamlQuery(); query.ViewXml = "<View>" + "<Query>" + "<Where><Eq><FieldRef Name='Country' /><Value Type='Text'>Belgium</Value></Eq></Where>" + "</Query>" + "<ViewFields>" + " <FieldRef Name='Title' /><FieldRef Name='City' />" + "</ViewFields>" + "</View>"; // execute the query ListItemCollection listItems = spList.GetItems(query); clientContext.Load(listItems); clientContext.ExecuteQuery();
But this also returns a number of system columns. If you really want to limit the columns returned to the columns you specify, you have to use a LINQ query within the Load method. The code looks as follows:
CamlQuery camlQuery = new CamlQuery(); camlQuery.ViewXml = "<View><Where><Eq><FieldRef Name='Country' /><Value Type='Text'>Belgium</Value></Eq></Where></View>"; ListItemCollection listItems = spList.GetItems(camlQuery); clientContext.Load(listItems, items => items.Include( item => item.Id, item => item.DisplayName, item => item.HasUniqueRoleAssignments)); clientContext.ExecuteQuery();
The different Query Options need to be handled a bit differently than with the SharePoint Server Object Model.
The row limit can also be specified within the ViewXml property:
query.ViewXml = "<View>" + "<Query>" + "<Where><Eq><FieldRef Name='Country' /><Value Type='Text'>Belgium</Value></Eq></Where>" + "<OrderBy><FieldRef Name='City'/></OrderBy>" + "</Query>" + "<RowLimit>5</RowLimit>" + "</View>";
Dates in UTC
You can choose to return dates in UTC (Coordinated Universal Time) by setting the DatesInUtc property of the CamlQuery instance:
query.DatesInUtc = true;
Include attachment URLs
Using CAML you are able to know if list items have attachment by adding a w> element to the ViewFields element in the ViewXml property:
query.ViewXml = "<View>" + "<ViewFields>" + " <FieldRef Name='Title' /><FieldRef Name='City' /><FieldRef Name='Attachments' />" + "</ViewFields>" + "</View>";
SharePoint will return a boolean indicating whether the list item has attachments or not.
The attechments are not stored in the list item itself, but are stored in a sub folder of the list. More specifically, the list contains a folder named Attachments and if a list item has one or more attachments, a folder is created based on the ID of the list item. This sub folder will then contain the attachment(s). The URL of the attachment is not stored in the list item itself.
CAML contains an option IncludeAttachmentURLs that can be used to retreive the URL of the attachment(s), together with the other properties of the list item. It works on the server side SPQuery and with the <QueryOptions> node of the GetListItems method of the Lists.asmx web service , but it doesn’t seem to be available with the CamlQuery object of the .NET Client Object Model.
If you need to retrieving the attachments itself you will have to write some extra code that retrieves the files from the Attachment folder:
Folder folder = clientContext.Web.GetFolderByServerRelativeUrl( spList.RootFolder.ServerRelativeUrl + "/Attachments/" + item.Id); FileCollection files = attFolder.Files; // If you only need the URLs ctx.Load(files, fs => fs.Include(f => f.ServerRelativeUrl)); ctx.ExecuteQuery();
Following CAML subtilities doesn’t seem to be working with the CamlQuery object of the .NET Client Object Model, although they exist when retrieving list items with the server object model and the SharePoint web services:
- IncludeMandatoryColumns: this option also returns the required fields besides the other fields specified in the ViewFields property or element.
- ExpandUserField: when you query a User field, you only see the login name of the user. When you indicate that you want to expand a user field, SharePoint will also return information like the user name and the email address.
- IncludeAttachmentURLs: cfr. higher
Files and folders options
CAML for retrieving files and folders at different levels of a document library, is always a bit more complex. To make the explanation hereunder a bit more readable, I have created a document library with the following structure:
You can easily query the files and folders in the root folder of a document library without having to use specific CAML elements. Only if you want to start querying the folder structure within a document library, you have to apply specific CAML.
To be able to better demonstrate the subtilities I created a folder structure in my Shared Documents library, and added a set of files to the different folders. (Needless to say that SharePoint Manager 2010 provided me this insight in my document library ).
For example, if you want to query all files and folders in your document library, no matter how deep they are nested, you have to add a Scope attribute to the View element, and set its value to RecursiveAll:
query.ViewXml = "<View Scope='RecursiveAll'></View>";
You can always add a Query element in the View element and specify a Where clause to add an extra filter to the query, or an OrderBy clause to sort the result.
If you want to query only the folders, you have to add an extra where clause:
query.ViewXml = "<View Scope='RecursiveAll'>" + "<Query>" + " <Where>" + " <Eq><FieldRef Name='FSObjType' /><Value Type='Integer'>1</Value></Eq>" + " </Where>" + "</Query>" + "</View>";
If you want to query only the files, the extra where clause can be changed as follows:
query.ViewXml = "<View Scope='RecursiveAll'>" + "<Query>" + " <Where>" + " <Eq><FieldRef Name='FSObjType' /><Value Type='Integer'>0</Value></Eq>" + " </Where>" + "</Query>" + "</View>";
If you want to retrieve the content of a specific folder, i.e files and folders, you have to add the relative URL to that folder to the FolderServerRelativeUrl property of the query instance:
query.FolderServerRelativeUrl = "/Shared Documents/Folder 1";
If you only want to see the files of a specific sub folder, you have to set the Scope attribute of the ViewXml property to FilesOnly:
query.ViewXml = "<View Scope='FilesOnly' />"; query.FolderServerRelativeUrl = "/Shared Documents/Folder 1";
Of course you can also query all files in a specific sub folder and its underlying sub folders. In that case you also have to specify the relative URL to the folder, but you also have to set the Scope attribute of the ViewXml property to Recursive:
query.ViewXml = "<View Scope='Recursive' />"; query.FolderServerRelativeUrl = "/Shared Documents/Folder 1";
If you want to retrieve all files AND folders from a specific folder and its underlying sub folders, you have to set the Scope attribute of the ViewXml property to RecursiveAll:
query.ViewXml = "<View Scope='RecursiveAll' />"; query.FolderServerRelativeUrl = "/Shared Documents/Folder 1";
And for all those who read through the whole post: Yes, CAML girl is back
On 21th December 2011 BIWUG organizes a deep dive session on Variations in SharePoint 2010. This presentation is done by Pascal Benois, one of Microsofts Premier Field engineers and an expert in this domain.
This session will cover level 400 topics on SharePoint 2010 Variations. The following topics will be covered: concepts and internals of variations (page vs. site variations), concepts and internals of configuration, variation Timer Jobs internals, different flavors of variations (automatic, manual, different site templates, same site templates, …), the “famous relationships list”, stsadm and PowerShell commands which assist variations, changes between 2007 and 2010.
Demos will be performed while some coding aspects will be covered. It will be shown how variations can be used for other purposes than just implementing multilingual solutions.
There are 80 seats available. You can register here.