powershell - 使用 Add-PnPClientSideWebPart 添加天气 WebPart 未设置位置
问题描述
我正在尝试在 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
}
]
}
}'
推荐阅读
- javascript - 使用云函数更新对象数组
- python - 每行列出熊猫中的二维数组需要更有效的方式
- javascript - jQuery日期范围选择器在移动到下个月时设置最近的月份
- django - Django - django-select2 不适用于 inlineformset
- python - netcdf4-python 无法在 celery/django 中运行
- thingsboard - 生成通过 thingsboard 实例传播的内部警报
- sql-server - 在将触发器转换为 T-SQL 时需要帮助
- jquery - 如何重定向到另一个页面并在该页面上触发事件
- javascript - 将此 javascript 助手更改为 C++ 是否会提高 QML 应用程序的性能?
- ios - 比链式代表更好的处理 xib 按钮按下的方法?