Archive for June, 2007

Overriding the Content Query Web Part

Friday, June 29th, 2007

Out of the box, the content query web part can only get items from one content type, but what happens if you want it to display items from more than one content type?  You don't have to write a custom web part to do this thanks to Microsoft adding overrides in their content query web part. 

First, build the CQWP (Content Query Web Part) with everything how you want it, including the query, then you will need to export it to a location on your drive.  To export the web part, navigate to the page that contains the web part.  Open up the page in edit mode and on that page, click on the edit drop down menu for the web part and click "Export."

Save the file locally.  Once you have exported the web part as a .webpart file, open it with notepad and edit the ListsOverride property.

If you want to get everything based on a Generic List (BaseType = 0), you would use the following property:

 <property name="ListsOverride" type="string"><![CDATA[ <Lists BaseType="0"> </Lists>]]></property>


 
If you want to get everything based on a document library (BaseType = 1), you would use the following property:

 <property name="ListsOverride" type="string"><![CDATA[ <Lists BaseType="1"> </Lists>]]></property>

 Once you have finished editting the webpart, save the file.  Now we have to import the new .webpart file.  To do this, go to "Site Actions" -> "Site Settings" -> "Modify All Site Settings" on the top level site.

 Under "Galleries", click on "Web Parts".  Now click the "Upload" button.

Click on the "Browse" button and select the .webpart file that you made changes to.

Now set all of the properties for the webpart and click "OK" when finished.

Now browse to the page you want to add the web part to.  Open up the page in edit mode and in the web part zone where you want to add the web part, click on "Add a web part" and select your new webpart and then click "Add."

How to: Customize the Content Query Web Part by using Custom Properties
http://msdn2.microsoft.com/en-us/library/aa981241.aspx

 

 

 

Development Tools and Techniques for Working with Code in Windows SharePoint Services 3.0

Friday, June 22nd, 2007
Patrick Tisseghem has posted a two part article on the MSDN library about development tools and techniques for coding in WSS.  These are very great articles and I encourage you to look into them.
 

Summary: Learn the skills you need to develop for Windows SharePoint Services 3.0, about the differences from traditional ASP.NET development, about the required development environment, and the steps to build a Windows SharePoint Services solution with Visual Studio 2005 Extensions for Windows SharePoint Services 3.0. This article is part 1 of 2. (33 printed pages)

Patrick Tisseghem, U2U

June 2007

Applies to: Windows SharePoint Services 3.0, Visual Studio 2005 Extensions for Windows SharePoint Services 3.0

Contents

Summary: Explore Windows SharePoint Services solutions, solution architecture, and techniques for creating, deploying, maintaining, and upgrading Windows SharePoint Services solutions. This article is part 2 of 2. (26 printed pages)

Patrick Tisseghem, U2U

June 2007

Applies to: Windows SharePoint Services 3.0, Visual Studio 2005 Extensions for Windows SharePoint Services 3.0

Contents

SPSiteDataQuery – The query cannot be completed because the number of lists in the query exceeded the allowable limit

Saturday, June 2nd, 2007

Today I learned a hard lesson.  A single letter was causing a big problem for me: The query cannot be completed because the number of lists in the query exceeded the allowable limit. For better results, limit the scope of the query to the current site or list or use a custom column index to help reduce the number of lists.MaxListsLimit vs MaxListLimit

After a while of researching, I found out that the original example that I had been using for the basis of my SPSiteDataQuery had used MaxListsLimit where MaxListLimit should have been for the Lists property of my SPSiteDataQuery
I was using

"<Lists BaseType='1' MaxListsLimit='0'/>"

When what I needed was just:

"<Lists BaseType='1' MaxListLimit='0'/>"

This made the error go away as it let me search all of the lists in the entire site.  Not specifying a MaxListLimit would only search 1000 lists, but seems to throw an error if there are more than 1000 lists, instead of just searching the first 1000 that it finds.  I would recommend always using '0' if you are not sure that the client will have less than 1000 lists.