pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
987 stars 665 forks source link

Set-PnPWebPartProperty #584

Open bclevering opened 7 years ago

bclevering commented 7 years ago

Which version of the PnP-PowerShell Cmdlets are you using?

What is the version of the Cmdlet module you are running?

2.9.1611.0

How did you install the PnP-PowerShell Cmdlets?

When executing Set-PnPWebPartProperty the new property isn't published.

What additional steps do i need to take to publish the new webpart property?

erwinvanhunen commented 7 years ago

Hi Bert,

Can you give me an example on how you use the cmdlet and what the expected outcome is? You mean you set a property through powershell and when you navigate to the page with the webpart the property is not set? If so, what property are you trying to set?

cheindel commented 7 years ago

@erwinvanhunen - Same problem here. I'm using SharePoint Online and December Release of PnP PowerShell

This is what I'm trying to do:

$wp = Get-PnPWebPart -ServerRelativePageUrl "/sites/TEST/Lists/Projects/NewForm.aspx"
Set-PnPFileCheckedOut -Url "/sites/TEST/Lists/Projects/NewForm.aspx"
Set-PnPWebPartProperty -ServerRelativePageUrl "/sites/TEST/Lists/Projects/NewForm.aspx" -Identity $wp.Id -Key "JSLink" -Value "~sitecollection/Style Library/jquery-3.0.0.min.js|~sitecollection/Style Library/TEST.js"
Set-PnPFileCheckedIn -Url "/sites/TEST/Lists/Projects/NewForm.aspx"

I think I get the correct ID for the webpart and if I try to not write "JSLink" as key but sth. that does not exist, I also get a proper error message like "The DUMMY property does not exist."

For "JSLink" it does not return such an error message, but when I reload the NewForm.aspx and search the source code, I cannot find my custom JS file.

bclevering commented 7 years ago

as @cheindel also commented it's (almost) every property i'm trying to set

TechForze commented 7 years ago

@bclevering @cheindel Hi, I tested this and it works on SharePoint 2013 with 2.13.1703.0. Please note that Get-PnPWebPart is getting a collection of WebParts if there are more webparts on your page.

mcpedreira commented 6 years ago

I have the same problem, when I set a webpart property it's correctly filled, but the value of the property isn´t applied. The property is applied, only when I manually click on the apply button of the webpart. Do you have a command to publish the changes? Thanks