Bug: 'spo file add' removing leading zeros
See original GitHub issueDescription:
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:
spo file add --webUrl https://contoso.sharepoint.com/sites/project-x --folder 'Shared Documents' --path 'C:\MS365.jpg' --Title "000123"
Expected:
New file added to destination with a Title attribute of '000123'
Actual:
New file added to destination with a Title attribute of '123'
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.
spo file add --webUrl https://contoso.sharepoint.com/sites/project-x --folder 'Shared Documents' --path 'C:\MS365.jpg' --Title " 000123"
Likewise, the following will create a new item with the ‘Title’ attribute of ‘000123 ABCD’ as expected.
spo file add --webUrl https://contoso.sharepoint.com/sites/project-x --folder 'Shared Documents' --path 'C:\MS365.jpg' --Title "000123 ABCD"
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
cvs export of sharepoint list removes leading zero's
The problem is that when the list is exported, the leading zeros get automatically removed from one of the numeric columns. Does anyone...
Read more >Leading Zeros removed when setting single line of text ...
I have a responsive form in SharePoint 2019. There is a calculated value for Cost Center that contains a leading zero (Name: CostCenterCalc ......
Read more >Leading zeros/prefix zeros removed from csv file when open it in
Hi, We are getting a CSV file from the server that need to open in excel to verify the data. But it removes...
Read more >How to trim tail zero under Power Automate flow | by LAI TOCA
How to trim tail zero under Power Automate flow · Create the manual trigger flow. · Input the key of timestamp string format...
Read more >Help with leading zero's - Altova User Support Forum
I need my xml to output leading zeros. I created a doc the shows what i am attempting to do. Please see doc...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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 😊