Notice: O365Migrator includes and improves upon everything O365Uploader does, please use that instead. O365Uploader is discontinued and will remain here only as an example of using Powershell to upload data to Sharepoint Online.
Intro
This free tool will upload any folder or files in bulk that you specify from your on premises infrastructure, to the cloud. It is compatible with the following destinations:
- Office 365 Sharepoint
- Office 365 OneDrive
- Personal OneDrive
- Sharepoint 2013
What does it do?
- Prescan / Analysis of all your files and folders to see if they meet the requirements Sharepoint / OneDrive imposes including detailed logging and automated fixes for most common issues
- It checks for illegal characters or extensions in filenames and folders and autocorrects them, for example: (:,*,?,”,<,>,|,#,{,},%,~,&)
- It checks for total path lengt > 260 characters and skips them
- It uploads everything else to the library you specify
- It logs all this info to a detailed log file that can be analyzed in excel to easily figure out which files or foldersfailed.
- Unrestricted uploads (no limit to the number of files uploaded in bulk)
- Includes the original modified / creation date on the files
- It does not support resuming an upload, it will do an overwrite
I’m by no means a real software developer, so no warranty or guarantees are supplied. I’ve migrated tens of thousands of files and folders to Office 365 and really needed something quick and easy to make the process more efficient. This is the result of that effort, let me know how it works for you!
Requirements:
- Powershell 4 (download link)
- .NET 4.5 (download link)
- Sharepoint Server 2013 Client Components (download link)
- Office 365 Uploader Tool (O365Uploader_v0.7)
- run “Set-Executionpolicy Unrestricted” in an elevated powershell window
- Windows 7+ or Windows Server 2008+
User Guide
- Install all the prerequisites
- Unzip the compressed folder with the tool
- Right click O365Uploader_v0.7.ps1 and select ‘Run with Powershell’. If this doesn’t work, check if you set Execution Policy to Unrestricted!
- Enter the URL of your onedrive or sharepoint where you’d like to upload the folder to. Examples:
- OneDrive For Business: https://xxx-my.sharepoint.com/personal/login_xxx_yourdomain_com
- Sharepoint: https://xxx.sharepoint.com
- Enter the library name, for OneDrive this is usually ‘Documents’, but if your tenant is for example, Dutch, it may be ‘Documenten’ instead, like this:
- Select the folder to upload
- You’ll be prompted to verify the folder first, depending on the size this may take a while and will produce a file with all issues found. (see the blue powershell console window for details)
- Correct any non-autoresolvable issues and start the upload, you’ll be prompted for your credentials.
- When the upload is finished, the powershell window in the back will tell you if there were any errors and point you to a detailed log file where you can resolve those manually.
Changelog
16/09/2015
- Included Rob’s fix to add the original file creation date to the uploaded file and improved error handling for illegal folder names.
09/07/2015
- Removed 2GB filesize check, since O365 now supports larger files
- Added detailed error logging
- Added expected time left to display
09/02/2015
- Corrected a bug that caused uploads to autocorrected illegal foldernames to fail. Only the folder would be created. (thanks Joost!)
- Removed ‘Start-Transcript’ dependency, which was reported to fail on certain OS configurations (thanks Chris and Jens)
- Added checks for .swf and .aspx extensions
22/12/2014
- Added check for period in folder/file name
- Added check for various illegal suffixes in filenames
- Added verification prompt before upload to log all issues to a file beforehand so it can be fixed in advance
- Added warning for 5000+ items
- Added warning for hidden files (start with an _ )
Great Tool!
I am having an issue copying to sub folders of documents.
For example:
http://XXXXX.Sharepoint.com in the URL
If is place “documents” in the ‘Document library Name’, it will copy all the files to the root of documents on the sharepoint. However, I have a subfolder of Documents.
Example: Documents\IT Files
If I put “Documents\IT Files” in the ‘Document library Name’, I get a message the library does not exist.
Any guidance would be greatly appreciated.
Thanks
Hey thank you so much for your tool!
Is it possible to filter by date ?
I mean when folder are not used since 2 years by example.
Cheers!
Hey everybody! I’m trying to upload only 11 MB but it takes a long time saying:
Connecting and provisioning folders in target library
Connecting and provisioning folders in target library
Connecting and provisioning folders in target library
That’s OK? What am i doing wrong?
My site is http://intranetlab/sitios/746/sistemasoperativos/
And i’ve created a Library “Prueba”, and that’s what i put on Document Library Name.
Thanks!
Hi Jos,
Today I installed Sharepoint Server 2013 Client Components and Your script didn’t find them coz they were installed to a different path.
C:\Program Files (x86)\Common Files\microsoft shared\Web Server Extensions\16
Cheers,
Nice tool, just released another free one which has similar features 🙂 https://fiechter.eu/onedrivebackup/
had to change path from C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll
Thank you!
I spent almost an entire day looking for a script/code that can recursively upload files to One Drive. But they either didn’t work or couldn’t be modified for my purpose (which was to upload test data to a lot of accounts). Your code (with modifications for parameterization) finally did it. Thank you!
Hey man,
Great tool! But i ran into a problem with O365migrator 0.5 and 0.8. I followed the instructions to the letter, but i still get the following error message: Could not connect to user’s Onedrive URL, has it been provisioned? “the remote serer returned an error: Unauthorized”. I used the administrator to connect to O365.
Help is much appreciated.
I can’t upload to a Office 365 group document library. Keeps telling me the library can’t be found. Anyone ran into this also? Or has uploaded to Office 365 groups document libraties with succes?
Ive tried running this a few times.
the tool only copies the folder structure not the files
Am I doing something wrong?
Hello
I tested the tool, it seems to working fine. But one thing I noticed that document metadata are loosing like Created By, Modified By. For example one document is created by which is in “My Documents” of my machine. Once I upload this file to OFDB, it always shows my name.
Is this limitation or I am missing anything?
Jos,
I need to sync or auto-upload an on premise 2013 doc lib with an O365 doc lib. Whenever the client adds new files to the on prem they want them added to the O365 as well. Onedrive is not an option in this scenario., Would your script support this? It is essential a need to copy files from one SharePoint doc lib (on prem) to another (O365).
Hi,
what is the largest size file you test this with?
Danke
Hi,
Thanks for the tool. its works fine for me.
Is it possible to upload to specific sub folder inside document library
I’m getting these errors in the log. Any idea why? Thanks. ERROR| issue uploading: [C:\Users\avanauken.STEINER\Desktop\Temporary\For 365 Uploading\mhetsko\old\Felt with Love from KnitPicks_files\31982.jpg] to : /personal/mhetsko_steiner_edu/Documents/old/Felt with Love from KnitPicks_files/31982.jpg, errors: Exception calling “ExecuteQuery” with “0” argument(s): “Cannot invoke method or retrieve property from null object. Object returned by the following call stack is null. “ListItemAllFields GetFileByServerRelativeUrl “” Microsoft.PowerShell.Commands.Internal.Format.FormatStartData Microsoft.PowerShell.Commands.Internal.Format.GroupStartData Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData Microsoft.PowerShell.Commands.Internal.Format.GroupEndData Microsoft.PowerShell.Commands.Internal.Format.FormatEndData NOTICE| [C:\Users\avanauken.STEINER\Desktop\Temporary\For 365 Uploading\mhetsko\old\Felt with Love from KnitPicks_files\32064.jpg] uploading to: /personal/mhetsko_steiner_edu/Documents/old/Felt with Love from KnitPicks_files/32064.jpg ERROR| issue uploading: [C:\Users\avanauken.STEINER\Desktop\Temporary\For 365 Uploading\mhetsko\old\Felt with Love from KnitPicks_files\32064.jpg] to : /personal/mhetsko_steiner_edu/Documents/old/Felt with Love from KnitPicks_files/32064.jpg, errors: Exception calling “ExecuteQuery” with “0” argument(s):… Read more »
Want to start thanking you for this awesome solution!
I do have a problem running it on a 2008R2 server.
Got the “Please install the Sharepoint Extensions first”
However I have done that. Also did reboot and chacked that the two DLL files are in the ISAPI folder.
Any suggestions?
Is it possible to upload to specific folder inside of Documents?
Hey Jos, I’ve tried some other solution but they all need additional apps to work or need OneDrive to sync ! Your tool looks really nice because you can directly upload file (no sync needed). My need is to have a daily task on a server that can upload files to a OneDrive share. I’m just guessing if there’s a way to use it by cmd line ? Sorry i’m pretty low on scripting but I mean something like this : uploader_job_v0.7.ps1 -ODBUrl xxx -Username xxx -Password xxx -DestinationFolder xxx -SourceFolder xxx That way I’m pretty sure you’ll find a… Read more »
You can add the following lines after the SaveBinaryDirect command in upload_job_v0.6.ps1 to get the modified and creation dates to match the source.
[Microsoft.SharePoint.Client.File] $newfile = $Web.GetFileByServerRelativeUrl($fileUrl)
$web.context.Load($newfile)
$web.context.ExecuteQuery
$newfile.Checkout()
$item = $newfile.ListItemAllFields
$item[“Created”] = $LocalFile.CreationTime
$item[“Modified”] = $LocalFile.LastWriteTime
$item.Update()
$item.File.CheckIn(“”, [Microsoft.SharePoint.Client.CheckinType]::OverwriteCheckin)
$context.ExecuteQuery()
Hi Jos,
I have the same problem as the others have “The document library does not exist”
Server URL : I place the team site URL
Document Library name: I place the folder name in the team site
Select source folder: I insert the network share path
Could you please give me some hint how to correct this issue?
Thanks,
Long
Hello Jos,
Thanks for sharing this!
I’m following all your instructions, but always get the same error message after type the credentials:
“The document library does not exist”
Server URL: https://mycompany-my.sharepoint.com/personal/user_company_com_br/
Document Library: Documents
Source folder: E:\Clients
Any ideas?
Regards,
This tool is great!!!! Thank you for creating this.
This is an excellent tool for quick upload! Keep it up this and Onedrivemapper are top products and also free.
[…] O365Uploader […]
Hi Jos, it’s not really clear how this works with Onedrive personal. I’m entering https://onedrive.live.com for the Server URL and then I do get prompted to enter my credentials but no files are uploaded. Any ideas?
Love this Product !!! I uploaded in excess of 100,000 files to
OneDrive…. (OK I have sync issues but good as archive).
I just need a tool that will allow me to view these 100,000 files easily (like Explorer).
If you had a donate button , I would. It saved me a lot of time
Thanks
Kamal
Great tool! Thank you!
One suggestion for a future version: it would be great to be able to preserve the original modified and created dates of the files, if possible.
Hi, thank you for sharing this very useful script. My failed upload attempt.. My o365 login has admin rights, OS is W8.1, I’ve installed all of the prerequisites, then following: – run the O365Uploader_v0.5.ps1 script – In URL box pasted link from File explorer > right click on OneDrive for Business folder > copy link https://xxxxmy.sharepoint.com/personal/user_yyy_xxx_xx/Documents (I’ve also tried with browser link https://xxxxmy.sharepoint.com/personal/user_xxx_xxx_xx/_layouts/15/start.aspx#/Documents/Forms/All.aspx ) – Selected local source folder – Start upload – Enter o365 login parameters – 100% upload klaar Folders do not show in OneDrive for Business folder. Log file SharePointUploaderDetailedLogDocuments.txt returns following error: —–03/20/2015 17:45:00 Session Detailedlog—–|… Read more »
Trying to run this but after I put in my OneDrive for Business server URL, the default Documents library and my locally mapped K: drive, if I click to check the files or not, when I click to Start Upload I get question marks on each box above and nothing else happens. No prompt for credentials or verification of my files.
Ideas?
[…] Here is an interesting free tool to bulk upload files to sharepoint/O365. I found this in the comments section in the MS link above. O365Uploader | liebensraum […]
[…] O365Uploader […]
Not bad. Managed to finaly upload my data to onedrive business. The log is good and enables you to correct any issues found during uploading. One issue/bug I found. When correcting illegal characters in folder names, the script is not smart enough and consequent uploads of files to that renamed folder fail. .swf and .aspx cannot be upload but pass the checker upfront. But apart from that, great script and thank you very much for sharing it.
Trying to run on winfdows 8.1 and its coming up with the error “The given path’s format is not supported.”
I got this error:
“The given path format i not supported”
I use Windows 10 (PS ver. 5), could that be the problem?
Thanks 🙂
[…] O365Uploader […]
Awesome, saved me a lot of time man! Thanks 🙂
[…] https://www.lieben.nu/liebensraum/?page_id=51 […]