powershell icon indicating copy to clipboard operation
powershell copied to clipboard

[FEATURE] Set-PnPListItem without values/always Update()

Open fowl2 opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. Often when developing or troubleshooting issues I need to trigger an (remote) event receiver, workflow, flow or webhook without changing any field values.

Currently Set-PnPListItem will not call the appropriate *Update() method if no field values or content type are specified or null/empty. I'm not sure if this is intentional, but it's a nice slight optimization if eg. the Values Hashtable is empty - the number of .

Describe the solution you'd like Addition of a new parameter like -AlwaysUpdate, -Force, -AllowEmpty, etc.

Describe alternatives you've considered

  1. Always *Update() if no other parameters are specified. Might be a bit subtle that Set-PnPListItem and Set-PnPListItem -Values @{} are different.
  2. Always *Update() if UpdateType is specified.
  3. Any of the above, but add a parameter to do in the inverse - ie. -SkipUnchanged (name to be bikesheeded).
  4. A new cmdlet like Touch-PnPListItem. Discoverability might be an issue as Touch isn't on the approved verbs list
  5. Some combination of above.

Additional context I'd be happy to implement this feature.


Other notes:

  1. It's not clear what Set-PnPListItem -List $list -Identity $id -ContentType:$null means, but it doesn't currently cause an error - just basically the same thing as Get-PnPListItem -List $list -Id $id.
  2. According to the approved verbs list apparently Update is apparently not recommended for this cmdlet either - it should be Edit. Not sure I agree with that, but maybe I'm just used to it now.

fowl2 avatar Jun 21 '22 06:06 fowl2