SPQuery Vs CamlQuery

SP2013


Hello everyone,

Today I’ll talk about a mistake I’ve seen several times in the forums, namely the formatting of CAML queries.

When you want to use CAML queries, the two objects that are most often used are SPQuery and CamlQuery.

The SPQuery is used like this

    SPQuery oQuery = new SPQuery();

    oQuery.Query = “<Where><Geq><FieldRef Name=’Field2’/>” +

        “<Value Type=’Number’>1000</Value></Geq></Where>”;

And the CAMLQuery like this

CamlQuery camlQuery = new CamlQuery();

camlQuery.ViewXml = “<View><Query><Where><Geq><FieldRef Name=’Field2’/>” +

        “<Value Type=’Number’>1000</Value></Geq></Where></Query></View>”;

Seeing the two uses you probably already saw the difference, but for those who have not been paying attention, look carefully to the contents of the query.

With SPQuery, the query starts and ends with the « Where » tags while with CAMLQuery, you have  « View » and « Query » tags in extra !

It may sound easy but if you normally use an object and then the other, you can easily put any doubt except formatting the query.

More information on these two objects

SPQuery : http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spquery.query.aspx

CAMLQuery : http://msdn.microsoft.com/en-us/library/ee534956(v=office.14).aspx

Hope this helps

Christopher.

Filter on current user and current user groups

SP2013

Hello everyone,

Today I’ll tell you about a request I often see on the forums, namely “How to display the content assigned to the current user.”

Where simple [me] is not enough that this request also target items assigned to user’s groups.

For this, two options are available to you

1) To use SharePoint Designer to modify the query on a webpart (example here : http://www.makdeniz.com/how-to-filter-sharepoint-2010-tasks-which-are-assigned-to-you-and-the-group-your-are-member-of/ )

2) To create a custom webpart filter that will dynamically filter your content. For that I return you to one of my previous post:

https://christopherclementen.wordpress.com/2012/04/02/filter-a-list-dynamically/

Whatever your choice, the query will be the following

<Or>

<Membership Type=”CurrentUserGroups”>

<FieldRef Name=”AssignedTo”/>

</Membership>

<Eq>

<FieldRef Name=”AssignedTo”/>

<Value Type=”Integer”>

<UserID/>

</Value>

</Eq>

</Or>

For more explanation on the creation of this query, I propose you two of my previous posts:

https://christopherclementen.wordpress.com/2012/03/12/filter-on-current-user-with-caml-query/

https://christopherclementen.wordpress.com/2012/08/27/caml-query-membership-attribute/

Hope this helps !

Christopher.

Browser Compatibility SharePoint 2013

SP2013

Hello everyone,

Today I’m going to talk about a compatibility problem.

In many company, the versions of OS and web browsers are set at group level. So, the update of these browsers and OS is not always possible.

After doing some research, I came across this article describing compatibility for SharePoint 2013: http://technet.microsoft.com/fr-be/library/cc263526.aspx

Having a customer using Internet Explorer 8 and following this table, it seems that it is supported …

« Seems » is the good word.

In fact doing some testing, we came across some strange behavior

– systematic Freezes

– ribbon’s button disappearing

-« Working on it » continuously with a JavaScript error

-Drag & drop unavailable

-other…

We are still compiling the information to really know it is supported but no real answers so far. I opened a topic on msdn forums but I do not really have specific answers: http://social.technet.microsoft.com/Forums/en-US/sharepointgeneral/thread/35741e61-b003-4167-a55f-16a147e54ff7/

However, a configuration allowed us to not have the “working on it” with the JavaScript error. For this configuration we have to go in Internet option->advanced-> and tick the “enable native XMLHTTP support”.

For drag & drop, it seems that with Office 2013 installed, it would work: http://support.microsoft.com/kb/2796734?wa=wsignin1.0

For the rest, we are still investigating.

If you have answers, feel free to reply to this post !

Christopher.

Service Unavailable

SP2013

Hello everyone,

Today, I’ll talk about a « To Remember ».

Sometimes after an action on the SharePoint server you receive the following error message trying to access your SharePoint
01
By “action” I mean for example:

  • Installation / deployment of a package
  • Updating a cumulative update

If it happens, check in the “Internet Information Services (IIS) Manager” that pool applications are started!

Often, one or more of them will not restart properly.
02
Important: make this check on all front-ends of your SharePoint farm!

Reminder:

To see this manager, enter “inetmgr” in the command prompt of the server (windows key + R shortcut), then click on your server on the “Application pool” tab.

Christopher.

SharePoint 2013 Cumulative Update Part 2

SP2013

Hello everyone,

Some time ago, I wrote about the release of the March cumulative update for SharePoint 2013.

Note that a new update was released in April! Always available via the same address: http://technet.microsoft.com/en-US/sharepoint/jj891062

Those cumulative seem to be very important in the context of migration! In fact in the description of March corrections, it is said

« Assume that a SharePoint Server 2010 site contains a navigation link that points to an invalid URL. After you upgrade SharePoint Server 2010 to SharePoint Server 2013, you cannot access the site.”

« Assume that you attach a SharePoint Server 2010 content database to a SharePoint Server 2013-based server. In this situation, when you upgrade the site collection on the SharePoint Server 2013-based server, picture libraries are not updated.

And the April

« When you try to upgrade some site collections from SharePoint Server 2010 to SharePoint Server 2013, you encounter a save conflict error.

Think about it !

Christopher.