Clinton's profileCherry BytesBlogListsGuestbookMore Tools Help
    September 10

    Case sensitive CAML

    I have been writing some CAML queries recently in my code (for getting items from SharePoint lists), and while this can be frustrating at the best of times, today I started getting an error message I hadn't seen before. No matter what I tried to change the error I kept getting was

    incorrect syntax near the keyword 'with'.

    Incorrect syntax near ')'.

    I discovered the error seemed to be coming from my CAML query at the following point:

    <GT>
         <FieldRef Name="Expires" />
         <Value Type="DateTime">2007-09-10T00:00:00Z</Value>
    </GT>

    After playing around and trying a number of different things, I finally found the source of my problem was purely a casing issue. I had used a capital T in <GT> - the greater than should be <Gt>. Now why couldn't Microsoft have had a more friendly error message when I ran the CAML code to inform me that my CAML syntax was wrong...

    September 04

    Property problems in SharePoint Search

    SharePoint Search can be a very powerful tool. It can also be a very frustrating tool if you get a problem also. Today while testing the search facility I discovered that no matter what search string I attempted to use I would get the following error:

    Property doesn't exist or is used in a manner inconsistent with schema settings.

    As it turns out the problem is due to a results schema, on your search results page, which doesn't match the schema that you are using for your query. This came about because someone had changed the 'Selected Columns' XML in the 'Search Core Results' Web Part.

    Luckily the fix is pretty easy (though trying to find a fix by Googling this error will give you nothing), so I thought I'd share the quick few steps that it takes to fix:

    1. Go to the search results page
    2. Go into Page Edit Mode
    3. Find the 'Search Core Results' Web Part on the page
    4. Modify the Web Part, and go to it's properties
    5. Expand 'Results Query Options'
    6. Go to 'Selected Columns' and edit this field - It will be in here that you have an incorrect property.

    The XML, by default, should look something like:

    <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">    
    <Columns>        
    <Column Name="WorkId"/>        
    <Column Name="Rank"/>        
    <Column Name="Title"/>        
    <Column Name="Author"/>        
    <Column Name="Size"/>        
    <Column Name="Path"/>       
    <Column Name="Description"/>       
    <Column Name="Write"/>        
    <Column Name="SiteName"/>        
    <Column Name="CollapsingStatus"/>        
    <Column Name="HitHighlightedSummary"/>        
    <Column Name="HitHighlightedProperties"/>        
    <Column Name="ContentClass"/>        
    <Column Name="IsDocument"/>        
    <Column Name="PictureThumbnailURL"/>    
    </Columns>    
    </root>