Target site for PropertyFieldListPicker control

The latest release of PnP Reusable property pane controls (1.8.0) adds an additional property (webAbsoluteUrl) to the PropertyFieldListPicker control. It allows a target site to be specified for loading the lists.

Information Architecture

Nowadays, the trend is to not use subsites as you can’t even create a modern SharePoint site as a subsite. But in the past, the sub-site approach was commonly adopted by organizations when planning the Information Architecture of SharePoint sites. It was common to see global information stored within custom lists of the root web level and surfaced on sub-sites.

A different approach was to use multiple site collections. Using one of the site collections as a central repository of information that would be consumed by the others.

The problem

If you have a project that follows one of the models described above, you were not able to use the PnP PropertyFieldListPicker control on your SharePoint Framework web parts to load data from a different site.

The PropertyFieldListPicker only had support to load the lists of the current site by default. It was not possible to specify a different target site.

1.8.0

The changes included in the 1.8.0 version introduce a new optional property (webAbsoluteUrl). It allows you to specify the web absolute URL of the target site to load the lists from.

This can be as simple as:

propertyFieldListPicker

In this example, we use the current web from the page context, which you really don’t need as that’s the default behavior, but you get the point.

One important thing to keep in mind is that you need to ensure that the users have permission to access the list if the list is on a separate site/site collection.

2 Replies to “Target site for PropertyFieldListPicker control”

Leave a Reply

Your email address will not be published. Required fields are marked *