使用 Add-PnPClientSideWebPart 添加天气 WebPart 未设置位置
Add weather WebPart using Add-PnPClientSideWebPart is not setting location
我正在尝试在 SharePoint Online 的新式页面上添加天气 WebPart。
这是我正在执行的 PowerShell:
$jsonProperties = '
{
"serverProcessedContent": {
"searchablePlainTexts": {
"webPartTitle": "Weather"
}
},
"properties": {
"temperatureUnit": "C",
"locations": [
{
"countryName": "Australia",
"name": "Manjimup, Australia",
"latitude": -34.24055862426758,
"longitude": 116.14610290527344,
"showCustomizedDisplayName": false
},
{
"countryName": "Australia",
"name": "Bega, Australia",
"latitude": -36.673919677734378,
"longitude": 149.84178161621095,
"showCustomizedDisplayName": false
}
]
}
}'
Add-PnPClientSideWebPart -Page https://mysharepointsite.sharepoint.com/Sites/MyPage -DefaultWebPartType Weather -WebPartProperties $jsonProperties
正在添加 WebPart,但没有天气位置,如下所示。
要添加到 WebPart 的位置我缺少什么?
我错过了 属性 "dataVersion": "1.2"
。完整的 JSON 看起来像这样:
$jsonProperties = '
{
"dataVersion": "1.2",
"serverProcessedContent": {
"searchablePlainTexts": {
"webPartTitle": "Weather"
}
},
"properties": {
"temperatureUnit": "C",
"locations": [
{
"countryName": "Australia",
"name": "Manjimup, Australia",
"latitude": -34.24055862426758,
"longitude": 116.14610290527344,
"showCustomizedDisplayName": false
},
{
"countryName": "Australia",
"name": "Bega, Australia",
"latitude": -36.673919677734378,
"longitude": 149.84178161621095,
"showCustomizedDisplayName": false
}
]
}
}'
我正在尝试在 SharePoint Online 的新式页面上添加天气 WebPart。
这是我正在执行的 PowerShell:
$jsonProperties = '
{
"serverProcessedContent": {
"searchablePlainTexts": {
"webPartTitle": "Weather"
}
},
"properties": {
"temperatureUnit": "C",
"locations": [
{
"countryName": "Australia",
"name": "Manjimup, Australia",
"latitude": -34.24055862426758,
"longitude": 116.14610290527344,
"showCustomizedDisplayName": false
},
{
"countryName": "Australia",
"name": "Bega, Australia",
"latitude": -36.673919677734378,
"longitude": 149.84178161621095,
"showCustomizedDisplayName": false
}
]
}
}'
Add-PnPClientSideWebPart -Page https://mysharepointsite.sharepoint.com/Sites/MyPage -DefaultWebPartType Weather -WebPartProperties $jsonProperties
正在添加 WebPart,但没有天气位置,如下所示。
要添加到 WebPart 的位置我缺少什么?
我错过了 属性 "dataVersion": "1.2"
。完整的 JSON 看起来像这样:
$jsonProperties = '
{
"dataVersion": "1.2",
"serverProcessedContent": {
"searchablePlainTexts": {
"webPartTitle": "Weather"
}
},
"properties": {
"temperatureUnit": "C",
"locations": [
{
"countryName": "Australia",
"name": "Manjimup, Australia",
"latitude": -34.24055862426758,
"longitude": 116.14610290527344,
"showCustomizedDisplayName": false
},
{
"countryName": "Australia",
"name": "Bega, Australia",
"latitude": -36.673919677734378,
"longitude": 149.84178161621095,
"showCustomizedDisplayName": false
}
]
}
}'