Monday, March 30, 2009

VSeWSS 1.3 - all DLLs have to be accessible

This tool or extension has some unexpected behaviour :


When you create a deploy package all the DLLs that your project references have to be accessible .... this is normal so far.

But, the problem is that all the DLLs referenced by your directly referenced DLLs also have to be accessible.

The immediate (and obvious) way to solve this problem is to copy these DLLs to the GAC (not so great in large scale production deployment scenarios). However we have found that you can also fix the problem by copying the DLLs to the server side VSeWSS "bin" folder (i.e. the VSeWSS extension has a small web application that generates the wsp for you) which typically resides in “C:\Program Files (x86)\Microsoft SharePoint Developer Tools 9.0\svc\bin”.

Hopefully the tricks above will work for you, but let us know if you have any better work-around or better practice for solving this particular problem ;-)

CAML query - getting more than 10 results

Another thing you should keep in mind when you use CAML QUERING is the fact that by default the query is going to return just the first 10 result so you should specify the maximum number of row that you want the query return to you, you achieve this with the tag : <Range><StartAt>1</StartAt><Count>10000</Count></Range>

 

Using the example above to get 10,000 results your query could look like this:

 

<Query>

   <Where>

      [.....]

   </Where>

  <Range>

    <StartAt>1</StartAt>

    <Count>10000</Count>

  </Range>

</Query>

 

Useful to use this parameters to page results.

 

Another CAML (tip) from Miguel ;-)

 

CAML query with more than two conditions

CAML queries seem to have a weird restriction that prevents you from using more than 2 conditions in a row. For example, this query doesn’t work:

 

<Query>

   <Where>

      <And>

            <Eq>

               <FieldRef Name='Title' />

               <Value Type='Text'>A</Value>

            </Eq>

            <Eq>

               <FieldRef Name='_UIVersionString' />

               <Value Type='Text'>B</Value>

            </Eq>

           <Eq>

              <FieldRef Name='FirstName' />

              <Value Type='Text'>C</Value>

           </Eq>

      </And>

   </Where>

</Query>

 

In the above you will notice that there are three “AND” conditions (the <Eq>’s) in a row so we need to wrap the condition in groups of two and nest the conditions like this:

 

<Query>

   <Where>

      <And>

         <And>

            <Eq>

               <FieldRef Name='Title' />

               <Value Type='Text'>A</Value>

            </Eq>

            <Eq>

               <FieldRef Name='_UIVersionString' />

               <Value Type='Text'>B</Value>

            </Eq>

         </And>

         <Eq>

            <FieldRef Name='FirstName' />

            <Value Type='Text'>C</Value>

         </Eq>

      </And>

   </Where>

</Query>

 

Miguel figured this one out recently and kindly shared.....

Welcome to Tips for SharePoint

Traditionally (and now I am talking a few years), good SharePoint documentation was scarse and hard to come by. This has changed somewhat. Better books are available, there are better best-practices, and Microsoft's own documentation is even getting better.

So .... this blog site is really just our developers' way of logging some of those tips and tricks that we have come across, and some of those we have come up with ourselves.

Feel free to contribute with your comments, tips and tricks. Obviously if you find a trick to solve a particular problem that is better than any that we might provide - shout!!!

So.... Welcome to Tips for SharePoint, from The SharePoint People