New uses-feature manifest element in PowerApps Component Framework Controls

Jared Johnson, 27 September 2019

Earlier this month, a previously built PCF control that utilised WebAPI to retrieve records stopped working with the following error: “Feature 'WebAPI.retrieveMultipleRecords' is required to be specified in the <uses-feature> section in ControlManifest.xml before use.”

Checking the PowerApps component framework documentation page showed that new elements had been added to the manifest schema in August that are mentioned in the error message, the <uses-feature> and <feature-usage> elements.

These are used to declare the features the component uses in the manifest file, the features that require this are all the native Device features such as Device.pickFile, and the WebAPI and Utility APIs. Without being declared in the manifest the control will display an error when trying to use that feature.

The <uses-feature> elements also has a required child element, this is particularly important given that PCF controls can run in a browser, mobile device or now in Canvas Apps, which all only support a subset of these features.

If your app requires the WebAPI as my control did to work, setting the required element to true would give somebody trying to use it in a platform that does not support WebAPI, such as Canvas Apps, a warning when trying to use it. It would also prevent the control from trying to load at all if they use it anyway.

Alternatively, if for example you had a control that involved images, you could add the Device.captureImage and Device.pickFile features as not required. You could then have logic to check at runtime if the platform the control is running on can use these features and provide fallbacks. In this case on a mobile device the Device.captureImage feature would be enabled so that it could be used, while in a browser this could instead use Device.pickFile.