Replies: 1 comment
-
So, I re-wrote my script from scratch. worse - sometimes (not easilty reproduceable), the connect-pnponline gives fails to connect and gives the same error (user cannot be found, with the invalid value I passed to the add-pnplistitem). this is with LATEST version (installed today). and I cannot find a way to clear the "cache" or whatever it is that stores the data that gets sent to the server instead of the data that I pass to the function. help! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all - I am experiencing an annoying bug and cannot figure out how to resolve it (except maybe reboot my dev box - which I will try soon).
I have a powershell script that runs over a sharepoint list and copies information into another.
At a certain time, one of the list items had a user value x for a user who does not exist in the system anymore - which threw an error.
I have adjusted the code to detect users who do not exist, and pass an empty string instead. I also tried my own email address as the instead.
However, whenever the "add-pnplistitem" is called, the code still fails with the same error - the specified user 'x' cannot be found.
I tried changing the code to pass only the title as the -Values parameter and it didnt make a difference.
it is as if the add-pnplistitem is ignoring what I am passing to the Values and is still stuck on the last error that it encountered.
I tried switching consoles (from vscode to full powershell) and it behaves the same - still stuck.
I can see that if I change the script (add write-hosts) it takes affect, so the caching is only at that line.
I did an add-pnplistitem command on the same list from the same console (But not from the script) and it worked great. It is just inside the script that it happens
If I put another "add-pnplistitem" in the same function, it creates it, and I then change the existing add-pnplistitem to be a set-pnplistitem (with the ID from the new add), the set-pnplistitem fails with the same error - but only the first call to update, and regardless what I am updating. Despite reporting an error, the list item then gets updated in subsequent calls.
My workaround is to just ignore the first error. Annoying but at least it works. Can anyone comment on what is happening?
Beta Was this translation helpful? Give feedback.
All reactions