diff --git a/samples/react-content-query-webpart/README.md b/samples/react-content-query-webpart/README.md index 0c07aaf0e..6b42a02ce 100644 --- a/samples/react-content-query-webpart/README.md +++ b/samples/react-content-query-webpart/README.md @@ -32,6 +32,7 @@ Version|Date|Comments 1.0.6|September 19, 2017|Upgraded to SharePoint drop 1.2.0 and added the site url and web url preselection when adding the WebPart for the first time on a page. Also fixed a bug with fields that had spaces in their internal names (automatically replaced with `_x0020_` by SharePoint). 1.0.7|November 17, 2017|Reverted to drop 1.1.0 in order to keep compatibility for SP2016 on-premise 1.0.8|March 17, 2018|Updated to store the selected list using its ID instead of its title, so the webpart keeps working if the list title gets updated. +1.0.9|March 28, 2018|Added a switch to enable the WebPart to apply it's query recursively within folders, and fixed a bug where webs could sometimes not appear under the web url dropdown ## Disclaimer **THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.** diff --git a/samples/react-content-query-webpart/config/package-solution.json b/samples/react-content-query-webpart/config/package-solution.json index 292f9410f..b67c785b6 100644 --- a/samples/react-content-query-webpart/config/package-solution.json +++ b/samples/react-content-query-webpart/config/package-solution.json @@ -3,7 +3,7 @@ "solution": { "name": "React Content Query", "id": "00406271-0276-406f-9666-512623eb6709", - "version": "1.0.8.0" + "version": "1.0.9.0" }, "paths": { "zippedPackage": "solution/react-content-query-webpart.sppkg" diff --git a/samples/react-content-query-webpart/config/write-manifests.json b/samples/react-content-query-webpart/config/write-manifests.json index 08ffeeacd..6410f6050 100644 --- a/samples/react-content-query-webpart/config/write-manifests.json +++ b/samples/react-content-query-webpart/config/write-manifests.json @@ -1,4 +1,4 @@ { "$schema": "https://dev.office.com/json-schemas/spfx-build/write-manifests.schema.json", - "cdnBasePath": "https://publiccdn.sharepointonline.com/spptechnologies.sharepoint.com/110700492eeea162ee5bad0f35b1f0061ded8bf436ce0199efe2a4d24109e1c0df1ec594/react-content-query-1.0.8" + "cdnBasePath": "https://publiccdn.sharepointonline.com/spptechnologies.sharepoint.com/110700492eeea162ee5bad0f35b1f0061ded8bf436ce0199efe2a4d24109e1c0df1ec594/react-content-query-1.0.9" } \ No newline at end of file diff --git a/samples/react-content-query-webpart/package-lock.json b/samples/react-content-query-webpart/package-lock.json index 5a3c6cf98..817c94fd7 100644 --- a/samples/react-content-query-webpart/package-lock.json +++ b/samples/react-content-query-webpart/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-content-query-webpart", - "version": "1.0.7", + "version": "1.0.8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/samples/react-content-query-webpart/package.json b/samples/react-content-query-webpart/package.json index 88de6a05d..e9a7750d4 100644 --- a/samples/react-content-query-webpart/package.json +++ b/samples/react-content-query-webpart/package.json @@ -1,6 +1,6 @@ { "name": "react-content-query-webpart", - "version": "1.0.8", + "version": "1.0.9", "private": true, "engines": { "node": ">=0.10.0" diff --git a/samples/react-content-query-webpart/sharepoint/solution/react-content-query-webpart.sppkg b/samples/react-content-query-webpart/sharepoint/solution/react-content-query-webpart.sppkg index 154a43953..155dd21a1 100644 Binary files a/samples/react-content-query-webpart/sharepoint/solution/react-content-query-webpart.sppkg and b/samples/react-content-query-webpart/sharepoint/solution/react-content-query-webpart.sppkg differ diff --git a/samples/react-content-query-webpart/src/common/constants/ContentQueryConstants.ts b/samples/react-content-query-webpart/src/common/constants/ContentQueryConstants.ts index 2dc4a3f90..765f6709b 100644 --- a/samples/react-content-query-webpart/src/common/constants/ContentQueryConstants.ts +++ b/samples/react-content-query-webpart/src/common/constants/ContentQueryConstants.ts @@ -11,6 +11,7 @@ export class ContentQueryConstants { public static readonly propertOrderByDirection = "orderByDirection"; public static readonly propertyLimitEnabled = "limitEnabled"; public static readonly propertyItemLimit = "itemLimit"; + public static readonly propertyRecursiveEnabled = "recursiveEnabled"; public static readonly propertyFilters = "filters"; public static readonly propertyViewFields = "viewFields"; public static readonly propertyTemplateText = "templateText"; diff --git a/samples/react-content-query-webpart/src/common/helpers/CamlQueryHelper.ts b/samples/react-content-query-webpart/src/common/helpers/CamlQueryHelper.ts index 2ddc3d872..9e64bb124 100644 --- a/samples/react-content-query-webpart/src/common/helpers/CamlQueryHelper.ts +++ b/samples/react-content-query-webpart/src/common/helpers/CamlQueryHelper.ts @@ -43,7 +43,12 @@ export class CamlQueryHelper { } // Wraps the everything into a final tag - query = Text.format('{0}', query); + if(querySettings.recursiveEnabled) { + query = Text.format('{0}', query); + } + else { + query = Text.format('{0}', query); + } return query; } diff --git a/samples/react-content-query-webpart/src/common/services/SearchService.ts b/samples/react-content-query-webpart/src/common/services/SearchService.ts index 1a6ebb6a6..2a9bf6e60 100644 --- a/samples/react-content-query-webpart/src/common/services/SearchService.ts +++ b/samples/react-content-query-webpart/src/common/services/SearchService.ts @@ -99,7 +99,7 @@ export class SearchService { **************************************************************************************************/ public getSitesStartingWith(startingUrl: string): Promise { return new Promise((resolve,reject) => { - let queryProperties = Text.format("querytext='Path:{0}/* AND contentclass:STS_Site'&selectproperties='Path'&trimduplicates=false&rowLimit=500", startingUrl); + let queryProperties = Text.format("querytext='Path:{0}/* AND contentclass:STS_Site'&selectproperties='Path'&trimduplicates=false&rowLimit=500&Properties='EnableDynamicGroups:true'", startingUrl); this.getSearchResultsRecursive(startingUrl, queryProperties) .then((results: any) => { @@ -119,7 +119,7 @@ export class SearchService { **************************************************************************************************/ public getWebsFromSite(siteUrl: string): Promise { return new Promise((resolve,reject) => { - let queryProperties = Text.format("querytext='SiteName:{0} AND (contentclass:STS_Site OR contentclass:STS_Web)'&selectproperties='Path'&trimduplicates=false&rowLimit=500&filter=", siteUrl); + let queryProperties = Text.format("querytext='SiteName:{0} AND (contentclass:STS_Site OR contentclass:STS_Web)'&selectproperties='Path'&trimduplicates=false&rowLimit=500&Properties='EnableDynamicGroups:true'", siteUrl); this.getSearchResultsRecursive(siteUrl, queryProperties) .then((results: any) => { diff --git a/samples/react-content-query-webpart/src/webparts/contentQuery/ContentQueryWebPart.ts b/samples/react-content-query-webpart/src/webparts/contentQuery/ContentQueryWebPart.ts index 375143b73..062880679 100644 --- a/samples/react-content-query-webpart/src/webparts/contentQuery/ContentQueryWebPart.ts +++ b/samples/react-content-query-webpart/src/webparts/contentQuery/ContentQueryWebPart.ts @@ -45,6 +45,7 @@ export default class ContentQueryWebPart extends BaseClientSideWebPart; private limitEnabledToggle: IPropertyPaneField; private itemLimitTextField: IPropertyPaneField; + private recursiveEnabledToggle: IPropertyPaneField; private filtersPanel: PropertyPaneQueryFilterPanel; private viewFieldsChecklist: PropertyPaneAsyncChecklist; private templateTextDialog: PropertyPaneTextDialog; @@ -56,7 +57,7 @@ export default class ContentQueryWebPart extends BaseClientSideWebPart { return new Promise((resolve, reject) => { this.ContentQueryService = new ContentQueryService(this.context, this.context.spHttpClient); + this.properties.webUrl = this.properties.siteUrl || this.properties.webUrl ? this.properties.webUrl : this.context.pageContext.web.absoluteUrl.toLocaleLowerCase().trim(); this.properties.siteUrl = this.properties.siteUrl ? this.properties.siteUrl : this.context.pageContext.site.absoluteUrl.toLowerCase().trim(); - this.properties.webUrl = this.properties.webUrl ? this.properties.webUrl : this.context.pageContext.web.absoluteUrl.toLocaleLowerCase().trim(); resolve(); }); } @@ -82,6 +83,7 @@ export default class ContentQueryWebPart extends BaseClientSideWebPart