

SPF019914: Ensure that Web Part properties specified in the manifest are used in code |
Web Part properties specified in the manifest should be used in code
CheckId | SPF019914 |
---|---|
TypeName | DefineWebPartPropertiesSpecifiedInTheManifestInCode |
Severity | CriticalError |
Type | Web Part Manifest |
Whenever defining a Web Part property in the Web Part manifest the same property should be defined in Web Part's code so that it's configurable through the property pane.
WeatherWebPart.manifest.json
{
"$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json",
"id": "8908df13-a965-4445-9c48-ecec77c44be4",
"alias": "WeatherWebPart",
"componentType": "WebPart",
"version": "0.0.1",
"manifestVersion": 2,
"preconfiguredEntries": [{
"groupId": "8908df13-a965-4445-9c48-ecec77c44be4",
"group": { "default": "Default" },
"title": { "default": "Weather" },
"description": { "default": "Shows weather for the given place" },
"officeFabricIconFontName": "Sunny",
"properties": {
"location": ""
}
}]
}
"$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json",
"id": "8908df13-a965-4445-9c48-ecec77c44be4",
"alias": "WeatherWebPart",
"componentType": "WebPart",
"version": "0.0.1",
"manifestVersion": 2,
"preconfiguredEntries": [{
"groupId": "8908df13-a965-4445-9c48-ecec77c44be4",
"group": { "default": "Default" },
"title": { "default": "Weather" },
"description": { "default": "Shows weather for the given place" },
"officeFabricIconFontName": "Sunny",
"properties": {
"location": ""
}
}]
}
WeatherWebPart.ts
import { Version } from '@microsoft/sp-core-library';
import {
BaseClientSideWebPart,
IPropertyPaneConfiguration,
PropertyPaneTextField
} from '@microsoft/sp-webpart-base';
import { escape } from '@microsoft/sp-lodash-subset';
import styles from './Weather.module.scss';
import * as strings from 'weatherStrings';
import { IWeatherWebPartProps } from './IWeatherWebPartProps';
export default class WeatherWebPart extends BaseClientSideWebPart<IWeatherWebPartProps> {
public render(): void {
// omitted for brevity
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription
},
groups: [
{
groupName: strings.DataGroupName,
groupFields: [
PropertyPaneTextField('location', {
label: strings.LocationFieldName
})
]
}
]
}
]
};
}
}
import {
BaseClientSideWebPart,
IPropertyPaneConfiguration,
PropertyPaneTextField
} from '@microsoft/sp-webpart-base';
import { escape } from '@microsoft/sp-lodash-subset';
import styles from './Weather.module.scss';
import * as strings from 'weatherStrings';
import { IWeatherWebPartProps } from './IWeatherWebPartProps';
export default class WeatherWebPart extends BaseClientSideWebPart<IWeatherWebPartProps> {
public render(): void {
// omitted for brevity
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription
},
groups: [
{
groupName: strings.DataGroupName,
groupFields: [
PropertyPaneTextField('location', {
label: strings.LocationFieldName
})
]
}
]
}
]
};
}
}
Disclaimer: The views and opinions expressed in this documentation and in SPCAF do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. SPCAF and RENCORE are registered trademarks of Rencore. All other trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners.