Iam developing a content query webpart wich should show a user all items from all document libraries within the current site collection with the following criteria:
-Created by me in the last 20 days OR -Modified by me in the last 20 days
As the standard content query webpart only allows 3 filters, I tried to customize the "QueryOverride" property with the Sharepoint Designer:
<Where>
<Or>
<And>
<Geq>
<FieldRef Name='Created' />
<Value Type="Datetime"><Today OffsetDays="-20"/></Value>
</Geq>
<Eq>
<FieldRef Name='Author' />
<Value Type='Integer'><UserID Type='Integer'/></Value>
</Eq>
</And>
<And>
<Geq>
<FieldRef Name='Modified' />
<Value Type="Datetime"><Today OffsetDays="-20"/></Value>
</Geq>
<Eq>
<FieldRef Name='Editor' />
<Value Type='Integer'><UserID Type='Integer'/></Value>
</Eq>
</And>
</Or>
</Where>
I have two different CAML Query builder tools and both returning correct results. But when I insert the webpart into my Sharepoint page its showing this error message: "This query has returned no items. To configure the query for this Web Part, open the tool pane."
The complete webpart code with encoded query:
<webParts>
<webPart xmlns="http://ift.tt/1fI5tWY">
<metaData>
<type name="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="GroupBy" type="string" />
<property name="FilterValue2" type="string" />
<property name="BaseType" type="string" />
<property name="AllowConnect" type="bool">True</property>
<property name="ShowUntargetedItems" type="bool">False</property>
<property name="DisplayName" type="string" />
<property name="Title" type="string">My last modified documents</property>
<property name="ContentTypeName" type="string" />
<property name="ViewFlag" type="string">0</property>
<property name="MediaPlayerStyleSource" type="string" null="true" />
<property name="AdditionalGroupAndSortFields" type="string" />
<property name="GroupByDirection" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+SortDirection, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Desc</property>
<property name="GroupByFieldType" type="string" />
<property name="FilterOperator1" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+FilterFieldQueryOperator, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Eq</property>
<property name="FeedTitle" type="string" />
<property name="FilterOperator3" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+FilterFieldQueryOperator, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Eq</property>
<property name="SortByDirection" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+SortDirection, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Desc</property>
<property name="FilterDisplayValue3" type="string" />
<property name="FilterDisplayValue2" type="string" />
<property name="FilterDisplayValue1" type="string" />
<property name="FilterValue3" type="string" />
<property name="DataMappings" type="string">Description:{28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f},Modified,DateTime;|DisplayTitle:{8553196d-ec8d-4564-9861-3dbe931050c8},FileLeafRef,File;|ModifiedBy:|Title:{8553196d-ec8d-4564-9861-3dbe931050c8},FileLeafRef,File;|Location:{56605df6-8fa1-47e4-a04c-5b384d59609f},FileDirRef,Lookup;|Modified:{28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f},Modified,DateTime;|ImageUrl:{b9e6f3ae-5632-4b13-b636-9d1a2bd67120},EncodedAbsThumbnailUrl,Computed;{543bc2cf-1f30-488e-8f25-6fe3b689d9ac},PublishingRollupImage,Image;|LinkUrl:{94f89715-e097-4e8b-ba79-ea02aa8b7adb},FileRef,Lookup;|CutLocation:{e2a07293-596a-4c59-9089-5c4f9339077f},Whereabout,Whereabout;|</property>
<property name="ListGuid" type="string" />
<property name="ListUrl" type="string" null="true" />
<property name="FilterValue1" type="string" />
<property name="CacheXslStorage" type="bool">True</property>
<property name="MissingAssembly" type="string">Cannot import this Web Part.</property>
<property name="ItemLimit" type="int">20</property>
<property name="DataMappingViewFields" type="string">{94f89715-e097-4e8b-ba79-ea02aa8b7adb},Lookup;{b9e6f3ae-5632-4b13-b636-9d1a2bd67120},Computed;{543bc2cf-1f30-488e-8f25-6fe3b689d9ac},Image;{8553196d-ec8d-4564-9861-3dbe931050c8},File;{28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f},DateTime;{56605df6-8fa1-47e4-a04c-5b384d59609f},Lookup;{28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f},DateTime;</property>
<property name="XslLink" type="string" null="true" />
<property name="EnableOriginalValue" type="bool">False</property>
<property name="AllowMinimize" type="bool">True</property>
<property name="ContentTypeBeginsWithId" type="string" />
<property name="ListDisplayName" type="string" null="true" />
<property name="ListsOverride" type="string" />
<property name="ItemXslLink" type="string">/sites/IT/Style Library/XSL Style Sheets/ItemStyle_Grolman.xsl</property>
<property name="Height" type="string" />
<property name="SortBy" type="string">{28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f}</property>
<property name="CatalogIconImageUrl" type="string" />
<property name="Default" type="string" />
<property name="FilterType1" type="string" />
<property name="FireInitialRow" type="bool">True</property>
<property name="AsyncRefresh" type="bool">False</property>
<property name="ItemStyle" type="string">SPGrid</property>
<property name="AdditionalFilterFields" type="string" />
<property name="WebUrl" type="string" />
<property name="ViewFlags" type="Microsoft.SharePoint.SPViewFlags, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">None</property>
<property name="Width" type="string" />
<property name="DataSourceID" type="string" />
<property name="HelpUrl" type="string" />
<property name="ManualRefresh" type="bool">False</property>
<property name="PlayMediaInBrowser" type="bool">True</property>
<property name="QueryOverride" type="string">
<Where>
<Or>
<And>
<Geq>
<FieldRef Name='Created' />
<Value Type="Datetime"><Today OffsetDays="-20"/></Value>
</Geq>
<Eq>
<FieldRef Name='Author' />
<Value Type='Integer'><UserID Type='Integer'/></Value>
</Eq>
</And>
<And>
<Geq>
<FieldRef Name='Modified' />
<Value Type="Datetime"><Today OffsetDays="-20"/></Value>
</Geq>
<Eq>
<FieldRef Name='Editor' />
<Value Type='Integer'><UserID Type='Integer'/></Value>
</Eq>
</And>
</Or>
</Where>
</property>
<property name="CacheXslTimeOut" type="int">86400</property>
<property name="PageSize" type="int">-1</property>
<property name="UseSQLDataSourcePaging" type="bool">True</property>
<property name="FeedEnabled" type="bool">False</property>
<property name="CommonViewFields" type="string" />
<property name="FilterField3" type="string">{1df5e554-ec7e-46a6-901d-d85a3881cb18}</property>
<property name="Hidden" type="bool">False</property>
<property name="MainXslLink" type="string">/sites/IT/Style Library/XSL Style Sheets/ContentQueryMain_Grolman.xsl</property>
<property name="ExportMode" type="exportmode">All</property>
<property name="FilterType3" type="string">User</property>
<property name="FilterType2" type="string">User</property>
<property name="ViewFieldsOverride" type="string" />
<property name="DisplayColumns" type="int">1</property>
<property name="FilterIncludeChildren2" type="bool">False</property>
<property name="ParameterBindings" type="string" null="true" />
<property name="FilterByAudience" type="bool">False</property>
<property name="DataSourcesString" type="string" />
<property name="AllowHide" type="bool">True</property>
<property name="Filter2ChainingOperator" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+FilterChainingOperator, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Or</property>
<property name="ListId" type="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">00000000-0000-0000-0000-000000000000</property>
<property name="XmlDefinitionLink" type="string" />
<property name="DataFields" type="string" />
<property name="FilterIncludeChildren1" type="bool">False</property>
<property name="SortByFieldType" type="string">DateTime</property>
<property name="DataColumnRenames" type="string" />
<property name="InitialAsyncDataFetch" type="bool">False</property>
<property name="ChromeType" type="chrometype">TitleOnly</property>
<property name="SystemViewFields" type="string" />
<property name="XmlDefinition" type="string" />
<property name="ChromeState" type="chromestate">Normal</property>
<property name="Filter2IsCustomValue" type="bool">False</property>
<property name="PageType" type="Microsoft.SharePoint.PAGETYPE, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">PAGE_NORMALVIEW</property>
<property name="FeedDescription" type="string" />
<property name="Filter3IsCustomValue" type="bool">False</property>
<property name="SampleData" type="string"><dsQueryResponse>
<Rows>
<Row Title="Item 1" LinkUrl="http://Item1" Group="Group Header" __begincolumn="True" __begingroup="True" />
<Row Title="Item 2" LinkUrl="http://Item2" __begincolumn="False" __begingroup="False" />
<Row Title="Item 3" LinkUrl="http://Item3" __begincolumn="False" __begingroup="False" />
</Rows>
</dsQueryResponse></property>
<property name="FilterOperator2" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+FilterFieldQueryOperator, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Eq</property>
<property name="GroupStyle" type="string">DefaultHeader</property>
<property name="WebsOverride" type="string" />
<property name="AutoRefreshInterval" type="int">60</property>
<property name="UseCopyUtil" type="bool">False</property>
<property name="TitleUrl" type="string" />
<property name="Filter1ChainingOperator" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+FilterChainingOperator, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">And</property>
<property name="ViewContentTypeId" type="string" />
<property name="HeaderXslLink" type="string">/sites/IT/Style Library/XSL Style Sheets/Header_Grolman.xsl</property>
<property name="Xsl" type="string"><xsl:stylesheet xmlns:x="http://ift.tt/tphNwY" version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR" xmlns:cmswrt="http://ift.tt/1tDc2vZ" exclude-result-prefixes="xsl cmswrt x" > <xsl:import href="/Style Library/XSL Style Sheets/Header_Grolman.xsl" /> <xsl:import href="/Style Library/XSL Style Sheets/ItemStyle_Grolman.xsl" /> <xsl:import href="/Style Library/XSL Style Sheets/ContentQueryMain_Grolman.xsl" /> </xsl:stylesheet></property>
<property name="TitleIconImageUrl" type="string" />
<property name="HelpMode" type="helpmode">Modeless</property>
<property name="Direction" type="direction">NotSet</property>
<property name="FilterField2" type="string">{d31655d1-1d5b-4511-95a1-7a09e9b75bf2}</property>
<property name="ListName" type="string" />
<property name="ShowWithSampleData" type="bool">False</property>
<property name="AllowClose" type="bool">True</property>
<property name="Filter1IsCustomValue" type="bool">True</property>
<property name="Description" type="string">Displays a dynamic view of content from your site.</property>
<property name="UseCache" type="bool">True</property>
<property name="FilterField1" type="string">{28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f}</property>
<property name="AutoRefresh" type="bool">False</property>
<property name="AllowZoneChange" type="bool">True</property>
<property name="ServerTemplate" type="string">101</property>
<property name="NoDefaultStyle" type="string" null="true" />
<property name="AllowEdit" type="bool">True</property>
<property name="FilterIncludeChildren3" type="bool">False</property>
</properties>
</data>
</webPart>
</webParts>
No comments:
Post a Comment