Closed ohthreesixtyfive closed 5 years ago
Thanks for bringing it up! I'll have a look into it and hopefully we'll be able to fix it quickly. Sorry for the trouble.
@ohthreesixtyfive following is a note-to-self based on my investigation for documentation purposes. Nothing you need to handle or respond to 🙂
I did some investigation and the reported behavior is caused by minimist deducting the type of args values unless they're explicitly set to strings. Unfortunately, for commands that allow unknown args, we can't know the names of all string args upfront and the types of args are specified in vorpal when instantiating the command rather than when executing it.
One reasonable way is to implement a workaround where the passed args are parsed again as the first step of the command execution and the list of args that should be handled as strings is dynamically constructed from the specified unknown args. That way we can create a new args object with the types of unknown args handled as expected.
Just as reference: we might expect similar behavior for commands 'spo listitem add' and update.
Basically, any command that allows unknown properties could have this issue. I've been thinking about fixing it in the SpoCommand or maybe even Command class so that it's automatically fixed without us having to worry about it in specific commands. Let's see if it will work out.
Thanks for bringing it up! I'll have a look into it and hopefully we'll be able to fix it quickly. Sorry for the trouble.
My pleasure! Major thanks to you and the other contributors for developing this as I've been able to use it on a major migration from an aging ECM to our SharePoint site.
Originally, I was using SharePointPnP PowerShell (Add-PnPFile), but was facing excessive memory usage issues when the amount of items being written was too large. Your very timely release of 'spo add item', which has not exhibited the same issue, has been greatly appreciated. :)
For the time being, I simply appended a space (' ') to the values that this was affecting - not too big of an issue (and something I can easily clean up later on).
I'm looking forward to building more solutions using this CLI.
Best regards,
Ramiro
Thank you for the kind words and great to hear we could help you. Please, never hesitate to reach out if you find anything out of the ordinary or if we can help with anything 😊
@ohthreesixtyfive #710 should be fixing the behavior you're seeing. If you can, could you please verify it before we merge it? Otherwise, the fix will come in the next beta and you'll be able to test it then. Once again, thanks for bringing it up.
@ohthreesixtyfive #710 should be fixing the behavior you're seeing. If you can, could you please verify it before we merge it? Otherwise, the fix will come in the next beta and you'll be able to test it then. Once again, thanks for bringing it up.
I'd be happy to test it. I'm a bit new to this so please forgive my ignorance, but how would I go about pulling the fix into my Office365 CLI version?
No problem, thanks for asking. The following steps should do it:
fix-numbers-unknownargs
branchnpm i
to restore dependenciesnpm run build
to build the projectnpm link
to register the local version of the CLI globallynpm unlink
to remove the global registration of the CLIHope this helps, and please, don't hesitate to reach out if you're stuck at any of the steps
Fix available in the latest beta
Description:
When adding a file and attempting to set a field (in this case a single-line of text), a value passed through with leading zeros will have those zeros removed.
Steps to reproduce:
Expected:
Actual:
Additional notes (Updated: 12/6/2018):
After further testing, this only appears to affect values that contain only numerical characters. If any characters other than a number are included in the value (regardless of positioning), the leading zeros are preserved.
Therefore, the following will create a new item with the 'Title' attribute of ' 000123' as expected.
Likewise, the following will create a new item with the 'Title' attribute of '000123 ABCD' as expected.