powershell
powershell copied to clipboard
[FEATURE] Set-PnPListItem without values/always Update()
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
- Always *
Update()
if no other parameters are specified. Might be a bit subtle thatSet-PnPListItem
andSet-PnPListItem -Values @{}
are different. - Always *
Update()
ifUpdateType
is specified. - Any of the above, but add a parameter to do in the inverse - ie.
-SkipUnchanged
(name to be bikesheeded). - A new cmdlet like
Touch-PnPListItem
. Discoverability might be an issue asTouch
isn't on the approved verbs list - Some combination of above.
Additional context I'd be happy to implement this feature.
Other notes:
- 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 asGet-PnPListItem -List $list -Id $id
. - According to the approved verbs list apparently
Update
is apparently not recommended for this cmdlet either - it should beEdit
. Not sure I agree with that, but maybe I'm just used to it now.