Merge pull request #2185 from Abderahman88/patch-2184

[react-advanced-page-properties] Fix retrieving fields from SitePages
This commit is contained in:
Hugo Bernier 2022-01-03 01:45:45 -05:00 committed by GitHub
commit b1a0eb96b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 6 deletions

View File

@ -49,6 +49,7 @@ Version|Date|Comments
-------|----|--------
1.0.0|March 30, 2021|Initial release
1.0.1|September 22, 2021|Added support for multi-language sites
1.0.2|December 24, 2021|Fix retrieving fields from SitePages
## Minimal Path to Awesome

View File

@ -15,7 +15,7 @@
"- Improved support for dates"
],
"creationDateTime": "2021-03-30",
"updateDateTime": "2021-09-22",
"updateDateTime": "2021-12-24",
"products": [
"SharePoint"
],

View File

@ -3,7 +3,7 @@
"solution": {
"name": "Advanced Page Properties",
"id": "daae06a2-8599-445c-93c0-3bd739305f56",
"version": "1.0.1.0",
"version": "1.0.2.0",
"includeClientSideAssets": true,
"isDomainIsolated": false,
"developer": {

View File

@ -68,7 +68,7 @@ export default class AdvancedPagePropertiesWebPart extends BaseClientSideWebPart
private async getPageProperties(): Promise<void> {
Log.Write("Getting Site Page fields...");
const list = await sp.web.lists.ensureSiteAssetsLibrary();
const list = await sp.web.lists.ensureSitePagesLibrary();
const fi = await list.fields();
this.availableProperties = [];

View File

@ -42,9 +42,9 @@ const AdvancedPageProperties: React.FunctionComponent<IAdvancedPagePropertiesPro
// Get the value(s) for the field from the list item itself
var allValues: any = {};
const siteAssetsList = await sp.web.lists.ensureSitePagesLibrary();
const sitePagesList = await sp.web.lists.ensureSitePagesLibrary();
if (props.context.pageContext.listItem !== undefined && props.context.pageContext.listItem !== null) {
allValues = await siteAssetsList.items.getById(props.context.pageContext.listItem.id).select(...props.selectedProperties).get();
allValues = await sitePagesList.items.getById(props.context.pageContext.listItem.id).select(...props.selectedProperties).get();
}
for (let i = 0; i < props.selectedProperties.length; i++) {
@ -53,7 +53,7 @@ const AdvancedPageProperties: React.FunctionComponent<IAdvancedPagePropertiesPro
Log.Write(`Selected Property: ${prop}`);
// Get field information, in case anything is needed in conjunction with value types
const field = await siteAssetsList.fields.getByInternalNameOrTitle(prop)();
const field = await sitePagesList.fields.getByInternalNameOrTitle(prop)();
// Establish the values array
var values: any[] = [];