DOWNLOAD: Complete script can be downloaded from here
We frequently use Image renditions, in our publishing sites. In this post let see how to create one using the client side object model. We will be using SetRenditions API which takes RenditionCollection and client context. The below script shows how to invoke the API.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
$rendition = New-Object Microsoft.SharePoint.Client.Publishing.ImageRendition | |
$rendition.Name = $Title | |
$rendition.Width = $Width | |
$rendition.Height = $Height | |
$renditionCol.Add($rendition) | |
[Microsoft.SharePoint.Client.Publishing.SiteImageRenditions]::SetRenditions($ctx,$renditionCol) | |
$ctx.ExecuteQuery() | |
} |
How to use the cmdlet
.\Add-Rendition.ps1 -Url https://somesite.sharepoint.com/sites/rajesh -Title MyNewRendition -Width 240 -Height 280
DOWNLOAD: Complete script can be downloaded from here
Comments
Post a Comment