Skip to content

Latest commit

 

History

History
92 lines (66 loc) · 4.02 KB

powershell-syntex-publishing.md

File metadata and controls

92 lines (66 loc) · 4.02 KB
title ms.author author ms.reviewer ms.date manager audience ms.topic ms.service ms.collection search.appverid ms.localizationpriority description
Publish custom models with PowerShell
jaeccles
jameseccles
ssquires
07/06/2023
ssquires
admin
reference
microsoft-syntex
enabler-strategic
m365initiative-syntex
MET150
medium
Learn how to publish Microsoft Syntex custom models by using PowerShell.

Publish custom models with PowerShell

Applies to:   ✓ All custom models   |   ✓ All prebuilt models

Important

The Microsoft Syntex PowerShell cmdlets and all other PnP components are open-source tools backed by an active community providing support for them. There is no SLA for open-source tool support from official Microsoft support channels.

Syntex models typically are deployed to document libraries across your tenant. This can be done by using the content center site, but this can also be done using PnP PowerShell as explained in this article.

Listing the available models in a content center

To get an overview of the models added to the current Syntex content center site, use the Get-PnPSyntexModel cmdlet:

Connect-PnPOnline -Url "https://contoso.sharepoint.com/sites/yourContentCenter"
Get-PnPSyntexModel

Apply a model to a library

To apply a model to a library, use the Publish-PnPSyntexModel cmdlet:

Connect-PnPOnline -Url "https://contoso.sharepoint.com/sites/yourContentCenter"
Publish-PnPSyntexModel -Model "Contract Notice" -ListWebUrl "https://contoso.sharepoint.com/sites/finance" -List "Documents"

Understanding where a model is used

Once you've deployed a model to many libraries, you might want to review the list of libraries using your model. This can be done using the Get-PnPSyntexModelPublication cmdlet:

Connect-PnPOnline -Url "https://contoso.sharepoint.com/sites/yourContentCenter"
Get-PnPSyntexModelPublication -Identity "Contract Notice"

Removing a model from a library

Removing a model from a library follows the same pattern as applying and can be done using the Unpublish-PnPSyntexModel cmdlet either interactively or as batch of multiple actions.

Connect-PnPOnline -Url "https://contoso.sharepoint.com/sites/yourSite"
Unpublish-PnPSyntexModel -Model "Invoice model" -ListWebUrl "https://contoso.sharepoint.com/sites/finance" -List "Documents"

Apply models in bulk

If you want to publish multiple models to multiple libraries, create an input CSV file listing the models and the target locations:

ModelName,TargetSiteUrl,TargetWebServerRelativeUrl,TargetLibraryServerRelativeUrl
Contract Notice,https://contoso.sharepoint.com/sites/Site1,/sites/Site1,/sites/site1/shared%20documents
Contract Notice,https://contoso.sharepoint.com/sites/Site1,/sites/Site1,/sites/site1/other
Trade Confirmation,https://contoso.sharepoint.com/sites/Site2,/sites/Site2,/sites/site2/shared%20documents

This CSV file can then be used as an input into a script that will publish the listed models to the appropriate libraries. In the following example, batching is used to increase the efficiency of the requests.

$contentCenterURL = "https://contoso.sharepoint.com/sites/yourSite"
$targetsCSV = "./Publish-SyntexModelBulk.csv"

Connect-PnPOnline -url $contentCenterURL

$targetLibraries = Import-Csv -Path $targetsCSV

$batch = New-PnPBatch

foreach ($target in $targetLibraries) {
    Publish-PnPSyntexModel -Model $target.ModelName -TargetSiteUrl $target.TargetSiteUrl -TargetWebServerRelativeUrl $target.TargetWebServerRelativeUrl -TargetLibraryServerRelativeUrl $target.TargetLibraryServerRelativeUrl -Batch $batch
}

Invoke-PnPBatch -Batch $batch