Bugfix retrieving fields from SitePages

This commit is contained in:
Abderahman88 2021-12-24 23:55:25 +01:00
parent 1d84d9a023
commit 0e9ea54d0a
4 changed files with 6 additions and 5 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

@ -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[] = [];