【问题标题】:PnP PowerShell - Can we get List content in List template xml?PnP PowerShell - 我们可以在列表模板 xml 中获取列表内容吗?
【发布时间】:2023-04-03 00:31:01
【问题描述】:

我是 PnP PowerShell 的新手。我想使用文档库的列表模板来提供列表。我可以使用以下命令获取它:

Export-PnPListToProvisioningTemplate -Out C:\DocumentLibraryTemplate.xml -List "Documents"

但是有什么方法我可以在 xml 中获取该库的内容。这样我就可以在另一个站点上提供相同的内容? 提前谢谢你。

【问题讨论】:

    标签: powershell sharepoint-online sharepoint-listtemplate list-template


    【解决方案1】:

    也许您可以使用以下命令:

    Install-Module -Name PnP.PowerShell
    Connect-PnPOnline -Url https://constoso.sharepoint.com/sites/star-wars -Interactive
    Get-PnPSiteTemplate -Out Lists.xml -ListsToExtract "Middle Earth Locales", "Fellowship Members" -Handlers Lists
    Add-PnPDataRowsToSiteTemplate -Path Lists.xml -List "Middle Earth Locales"
    
    Add-PnPDataRowsToSiteTemplate -Path Lists.xml -List "Fellowship Members"
    Connect-PnPOnline -Url https://constoso.sharepoint.com/sites/lotr -Interactive
    
    Invoke-PnPSiteTemplate -Path Lists.xml
    
    

    参考: https://techcommunity.microsoft.com/t5/microsoft-365-pnp-blog/copy-a-list-with-list-items-to-another-site/ba-p/2248892

    【讨论】:

    • 虽然此链接可能会回答问题,但最好在此处包含答案的基本部分并提供链接以供参考。如果链接页面发生更改,仅链接答案可能会失效。 - From Review
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-22
    • 1970-01-01
    相关资源
    最近更新 更多