.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Content Query with more thatn on group

Posted By:      Posted Date: August 26, 2010    Points: 0   Category :SharePoint

I want to group the result of the content query web part in two levels but this web part only have one Grouping field. How can I do grouping with more than one field?

<site> and DocumentSubtype (custom property)


  • Site 1
  •   Document Sub type 1
  •        File 1
  •        File 2
  •   Document Sub type 2
  • Site 2
  • Document Sub type 1

View Complete Post

More Related Resource Links

Content Query Web Part missing in SharePoint 2010

If you don't see content query web part listed in the web parts list, this is because you have not enabled "Search Server Web Parts" feature in site collection features. Enable this feature and content query web part will show in the list of web parts.

Need Help in LINQ query for group By with chunks of record


I am assigning and unique id [strShipperIdSequence] on my List on bases of some properties which are grouped together uniquely.
Now what i needed is that my group should be further break down to some maximum amount of chunks.[Let say 10]
that mean's even i am having Same value in 12 records i should get 2 groups[I of 10 items and other of 2 items]

var uniqueGroups = objMdbContentInfoList.GroupBy(p => new
}).Select(g => g.First()).ToList();
foreach (var objUnique in uniqueGroups)
string strShipperIdSequence = APIGlobalMethods.GetShipperRequestID();
foreach (MdbContentInfo obj in objMdbContentInfoList.FindAll(h => (h.CON_ENTRY_POINT == objUnique.CON_ENTRY_POINT &&
h.APPTType == objUnique.APPTType &&

Customizing the Content Query Web Part in SharePoint Server 2007

Walk through how to customize the Content Query Web Part in SharePoint Server 2007 to query content across multiple sites in a site collection and display the results in any way that XSL can support. Learn how to get similar results when customizing the CQWP does not meet your needs.

Group Query

Hi All. Greetings. I have 3 TablsTable =PersonID Person ---------- ----------- 1 ali2 abuTable = DetailID Person_ID Detail---------- ----------- --------------1 1 Good2 1 Excellent 3 2 Normal Table = ReferenceID Detail_ID description---------- ----------- ------------1 1 Has son2 2 Drop3 2 DiedI want result Like this.Ali----------GoodExcellentHas sonAbu----------NormalDropDiedAbove are 3 tables. I want to Show Person Name and then Its sub link or subcategory. If i use only 2 tables then i canshow required result but i have database where i have to fetch the record from 3rd and 4th table and bring under sub category.Thanks

Why is the Content by Query Web Part CommonViewFields attribute not working as expected?

I am using the Content by Query Web Part to show data from a Custom List.  I have already added to the XSL "ItemStyle" sheet so that I can pick the correct Item Style.  That has worked fine - I have been able to show whatever fields I would like and apply any CSS Styles I would like to them.  The issue I am having is in formatting the field correctly.  I have two different fields in my current example that need to be formatted: [1] I want to show an Image, but right now it shows the URL  [2] I want to show Rich Text, but right now it shows all the HTML Code as Plain Text.  I have looked at many articles online, and they all tell me to change the following in the WEBPART file from: <property name="CommonViewFields" type="string" /> to: <property name="CommonViewFields" type="string">Thumbnail, Image;Teaser, RichHTML;</property> What I am doing wrong?  The Web Part still runs, but it does not format the fields any differently.  Thanks for the help!

T-SQL 2005 query for Group BY and not GROUP in same query for SQL reporting service use purpose?

Hi, I have SQL 2005 table like bellow @OrderTable I want to display all row data and GROUP BY data as well for SQL Reporting Service Matrix purpose...   declare @OrderTable TABLE (OrderID varchar(10),OrderType varchar(20),OrderValue decimal(10,2),OrderDate DateTime) INSERT INTO @OrderTable VALUES('P06','O1',25.22,'2010-01-24') INSERT INTO @OrderTable VALUES('P06','O2',105.48,'2010-06-12') INSERT INTO @OrderTable VALUES('P07','O3',555.00,'2010-06-09') INSERT INTO @OrderTable VALUES('P08','O1',10.22,'2010-06-12') INSERT INTO @OrderTable VALUES('P06','O1',55.66,'2010-03-17') INSERT INTO @OrderTable VALUES('P06','O1',45.44,'2010-03-17') INSERT INTO @OrderTable VALUES('P07','O3',477.81,'2010-03-18') INSERT INTO @OrderTable VALUES('P07','O3',78.85,'2010-03-18') INSERT INTO @OrderTable VALUES('P06','O1',78.08,'2010-04-09') INSERT INTO @OrderTable VALUES('P07','O2',899.90,'2010-04-22') INSERT INTO @OrderTable VALUES('P08','O3',25.33,'2010-01-24') INSERT INTO @OrderTable VALUES('P08','O3',859.01,'2010-01-24') INSERT INTO @OrderTable VALUES('P08','O3',7433.89,'2010-01-24') INSERT INTO @OrderTable VALUES('P08','O1',1005.41,'2010-06-12') INSERT INTO @OrderTable VALUES('P06','O2',455.20,'2010-06-09') INSERT INTO @OrderTable VALUES('P07','O3',85.30,'2010-06-12') INSERT INTO @OrderTable VALUES

cross site-collection content query wp

Hi,How can i override the Content query wp so i can query data from other site collection? Is it possible?How? Recommended ways? alternatives? references?the site collection is under another site collectioni did some googling and only found a comercial wp for this..tks

Get the row position of the group? merging query?

Hello! I am using SQLS2005. I have two tables: Unit: UnitId int PK Title varchar UnitOption: UnitOptionId int PK UnitId int FK Title varchar Quote: QuoteId int PK UnitOptionId int FK Title varchar I want to create a scalar UDF that takes a QuoteId param and returns a varchar that contains the following description (pseudu): Quote.Title + '-' + Unit.Title + '-' + Unit.UnitId + /* Here is where my question is: If there are more than 1 UnitOption under this Unit, then return '-' + the UnitOption number under this Unit (i.e.) if under this Unit, there are 3 UnitOption with IDs 13, 17, 55 under the unit, and the current Quote.UnitOptionId is the 17 one, it should return 2. Which means I want to retrieve an ID of this row in the group. Else return '' */

Problem with Content Query Webpart and Custom Userfields

Dear Community, I am using Sharepoint 2007's content query webpart to access content types from 2 lists each contained in a different sitecollection. To achieve this, I used this tutorial: http://www.heathersolomon.com/blog/articles/CustomItemStyle.aspx. The tutorial worked great. By using the property CommonViewFields and modifing the XML Stylesheets accordingly, i could access almost every field. Even User Fieldtypes like editor and author were accessible by adding (editor,User) or (author,User) to the CommonViewFields property. But when I tried to access the custom made userfield "Username" in the same way (adding Username,User to the property), the webpart threw an error and couldn't be displayed anymore. When I changed it to Username,Text , no error occured but it naturally didn't show up, since it is the wrong fieldtype. I hope some of you can help me, since all my researches on this topic only brought up some more people with the same problem, but no solution to it. Thanks in advance, SoundofSilence

Filter out a subsite with Content Query

I'm using a sp 2007 Content Query to pull in news feeds from all over our site collecton.  I'd like to filter out one sub site using the "additional filters" option.   Is there a sub-site guid I could use, or a way to exlude one single site via the additional filter?   Thanks

Why do we need Common view fields in content query web part?

I am a bit confused on the purpose of "CommonViewFields" in CQWP. Almost all the write-ups on the web says that if we need a custom column to be available in the web part's XSL, we need to export the webpart file, add the columns to "CommonViewFields", import the web part to the site. However I noticed that, when I create a custom style template in my "ItemStyle.xsl" and simply add a line like <xsl:value-of select="@MyCustomColmn"/>, then "MyCustomColumn" appears automatically under "Fields to display" in the tool pane as a text box prompt, when I edit the web part and select my style template. I can then simply fill-in my column display name under "MyCustomColumn" and the web part works perfectly fine. (There is NO NEED to export the web part, edit the ".webpart" file and add "commonviewfields" etc..etc..etc) If this works, then what is the real need for "commonviewfields" ? Can someone shed light on this? I am totally confused.. (SharePoint 2010)          

Content Query Web Part (CQWP) fails to show picture items from a document/picture library in an anon

I have a Picture Library and am trying to use the CQWP to display a list of items in the library.  The web part shows the items fine in authenticated mode, but it fails to show the items to anonymous users. The error log message is: Error while executing web part: System.NullReferenceException: Object reference not set to an instance of an object.     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.SetDocumentIconUrlAndOnClickString(SPWeb web, DataRow row, String strDefaultItemOpen, Boolean fSetDocIcon, Boolean fSetOnClick, String fileRefColumnRef, String progIdColumnRef, String fsobjTypeColumnRef, String permMaskColumnRef)     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.PreProcessForDocumentIconAndOnClickAttribute()     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.AddContentQueryData()     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.GetXPathNavigator(String viewPath)     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform) I'm running SP 2010.  I've tried various scenarios including: 1. Using the default publishing template. 2. Using the blank site template with publishing and lock down features enabled. 3. Us

Content Query Web Part, QueryOverride and sorting by site

Hello, I want to display documents from various sub-sites in my portal. These documents must be grouped by site and only documents created in the last 7 days should appear in the CQWP. The first difficulty I encountered was that I cannot apply a filter like " date created< today - 7" in the tool pane of CQWP. So I searched the web and found that I can create a custom query by exporting the web part and changing the QueryOverride property. Thing is that you cannot specify a CAML group clause in the QueryOverride property. It is just not supported. It seems though (thanks to this post: http://social.msdn.microsoft.com/forums/en-US/sharepointdevelopment/thread/92e335ad-48f6-4572-a314-752c8b41ef8f) that if you specify a "order by" clause for the field you want to group by, then you can use this field in the group by section of the CQWP tool pane. Thus, I need to sort my results by site (because I want to group by site afterwards). But how do I do that? After another long research, I found out (http://msdn.microsoft.com/en-us/library/ff380147%28office.12%29.aspx#odcsp2007CustomizeCWQP_CustomizingUsingtUIwebpartFile) that I have to specify the ViewFieldsOverride property in order to include the original site that my document comes from. And in the property I have to include the following property: <ProjectProperty Name="Title"/>. But still I ca

Trying to build query using DISTINCT or GROUP BY...beginner here

Hi all, I have a table with the following format: instanceID    timeStamp  stepID 28B2D4FB-67F6-40CA-84A2-839BF3CC4B91 2010-09-07 20:36:32.807 1 28B2D4FB-67F6-40CA-84A2-839BF3CC4B91 2010-09-07 20:36:33.807 2 28B2D4FB-67F6-40CA-84A2-839BF3CC4B91 2010-09-07 20:36:34.807 3 ... EADD3AAA-5E93-4311-A844-9A7BE53A9606 2010-09-09 22:18:25.757 1 EADD3AAA-5E93-4311-A844-9A7BE53A9606 2010-09-09 22:18:26.773 2 so I need to build a query which will return 1 instanceID and all its stepIDs in one row. So the results would have to be something like this: instanceID    timeStamp  StepIDs 28B2D4FB-67F6-40CA-84A2-839BF3CC4B91 2010-09-07 20:36:32.807 1,2,3 EADD3AAA-5E93-4311-A844-9A7BE53A9606 2010-09-09 22:18:25.757 1,2 and if possible I would like to specify something like...bring me the data where 'timeStamp' > 2010-09-07 20:35 ps: I tried using DISCTINCT and GROUP BY but could not reach the desired results. Thank you!JCD

Sharepoint Content query Webpart

hello all ,             i want to create a webpart, which should display HTML code. and i need to edit the HTML source code.. how can i do it in sharepoint and which project i need to choose to create this webpart

Dynamically Setting the property value FilterValue1 of the Content Query WebPart? Inline? codeblock?

I want to dynamically set the FilterValue1 property of a Content by Query to the querystring ID. I tried to do it with an inline embed FilterValue1="<%= Reponse.Write .. but no luck Without having to code my own webpart, any way to change the value with a small C# code block? How about with javascript? Thank you!    

Content Query Web Part Error

Hi,I get the following error when i try to add a ContentByQuery.webpart using SharePoint Server 2007:   "Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator."   I've seen a lot of people having this problem when they aren't on an admin account, but I am, and this error happens before I can do any configuration at all to the webpart.   The webpart didn't show up in the webpart list at first, so I added it from the webparts gallery. The actual name of the part is Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.Is this the wrong kind of webpart or what seems to be the problem? I don't have much experience in Sharepoint since before, as you might can tell.Help would be VERY appreciated, thanks in advance.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend