Great video and the step-by-step explanation finally sheds some light on somethings I did not understand before. Next step is build a script that reads a .csv and removes only those files listed in that .csv. :-)
Hello Shane, excellent video, see if you can help me, I need to copy all the files from an office 365 e1 account of this user's onedrive (only files, emails I do otherwise) to another account to a specific folder as an example Backup contributor X, do you have any other videos or documentation that can guide me in this copy via power shell?
Hi Shane, thanks for your videos on using PnP to access Sharepoint Online. I have used them to put together a script to download files from Sharepoint to a local server, and the script itself works just fine. However, I have been struggling to get the script working from a scheduled task. The task is set to run as an account, for which the script runs perfectly when run manually from a powershell window. The account is also added to the "log on as a batch job" local security policy on the server. The account has sufficient access to Sharepoint - otherwise it would not do the desired file copies when run manually. When run from a scheduled task, I get the error message "Connect-PnPOnline: "Access is denied". By writing out the username property of the credential object, I see that the account name is returned when the script is run manually - but when run from a scheduled task, the username property is empty. So it's as if the script can't fetch the credentials in the credentials manager, when it is run from a scheduled task... Did you ever encounter this yourself, and do you happen to have a solution - or will it be impossible to make the PnP commands work in this scenario?
Tommy it will work. Credential Manager is per user. So if you put something in there as you and then run the scheduled task as a service account then it can’t find the credential. I have a video I talk a bit about this. I will find it and add it to another comment.
Hi again, Shane I owe you some feedback on this. It was a bit embarrassing, because nothing you wrote was unknown to me. However, in the heat of the battle, I had failed to notice, that I had configured the task to run as another service account than the one I had planned to use. So thanks for helping the blind ! :-)
How to Download SharePoint files to local system drive ? do you have video? Who will provide credentials for PnPOnlinePowerrshel? I need to download files from a SharePoint to my local disk. I have access to the SharePoint folder and files in my Org but my AD credentials are not working if write a PowerShel or VB Script to download a file. always getting Access Denied message. Could you please help me?
Thanks, Shane. Can you demo the process where the source list or library is on prem, and destination is SPO? In other words, I want to just grab an on prem list (and items) and move it to SPO.
Hey, Blake. That sounds like a great video. I will put it in the hopper. The other option is if you wanted it to move to the front of the line and for the content be based on exactly your needs I am happy to spin up the work through Bold Zebras. This is what I did for a few people, including Michael on this video. He and I worked together to write the script for his environment first. If that interests you shoot me an email.
Hello, how can I move a page that's located on the root of my sharepoint site and move it to a site library with Powershell for Sharepoint ? Do you have any idea ? Any script ? Command ? Thanks :)
Hey Shane, working on a massive data move from one SP Library Sub Folder to another, would this work for a subfolder into another Doc Library? Circa 22million files with daily uploads!
Hi Shane, is it possible to copy or move files using Powershell PnP from one site collection document library to another site collection document library? Thanks! I love your videos!😀
Hi Shane, thanks for the great work you're doing with these videos. I've been trying to use the samples from this tutorial to build a script, but in my case I need to move files to a folder in the target library and I'm struggling with that. If I add the folder to the target url (/library/folder/document.doc) I get an error that I can't use special characters in the file name. I'm assuming powershell thinks that "folder/document.doc" is in fact all file name and doesn't treat this as a folder. Could you shed any light on how I can move files to a folder?
Awesome. Thanks for the reply Shane, I've managed to copy the files to the correct folder. Now my next challenge, if I try changing the metadata using the CAML from your follow-up video to this one, I always get the item if of the rootfolder of the document, not the id of the document itself. I've been thinking I need to make the CAML recursive but so far without any luck. Could you help me out, or point me in the right direction? As always your wisdom is greatly appreciated.
I 'fixed' this issue by copying the file to the root folder first, then get the id, and then move it to the correct folder. The ID will remain the same in the move action. It's not very elegant, but it works.
Shane, Can you show how to connect to a list that is multiple levels deep. I attempted to use "/site/site/list" as syntax but I am getting Object reference not set to an instance of an object error.
@@ShanesCows thanks for the update Shane, I tried to see if I could engage the guys at Powerapps911 for paying for a script to copy a ton of data between Sharepoint online site but apparently you guys are not doing that anymore, so I'm trying to workout the details of the script and csv file for myself. it is slow going but I'll get there.
@@jameswood6423 Email me shane at PowerApps911 and I will see if I can get the script from the archive for you. Also, I have a friend who still does this type of work I can intro you to if you would like?
Great Video I look forward to putting this knowledge to good use. Question what prerequisites are needed for these commands to work I think I have a permissions issue. I have an administrator Powershell open and the Connect-PnpOnline -url ...gives me the error "The term 'Connect-PnPOnline' is not recognized as the name of a cmdlet, function, script file..."
i may have resolved my own issue... I got errors when I ran the commands to install-module -name SharepointPnPPowerShellOnline "NuGet provider required..blah blah" had to go and manually download the PnP Cmdlets Now I see you have a video on that! th-cam.com/video/qmni0TqknBE/w-d-xo.html anyway thanks.
Hi Shane, I am looking to move all files from a SharePoint location to a folder on the C drive. I am able to move one specified file but not all of them. I can see how you can move files from one SharePoint location to another but it is possible to do what I require? Be aware that this script will be put on a scheduled task and the files will have new names each day so the filenames cannot be specified. Move all files from a SharePoint location to a folder on the C drive? Apologies if I have missed this in your tutorials. Thanks, Alexandra
Hi Shane, I'm glad it can be done! Have you got any examples of the scripts required please? I am failing to get it to work at the moment. Thanks, Alexandra
Hi Shane,This was great! I learned some new things here! And thanks for all your help with the script. Looking forward to the next video,Michael McCabeNew York
Can we move the documents from one site collection to another site collection . Can't seem to do this and I am exhausted trying to find an answer from the general search.
I'm curious about this myself. It would be great if I could move files/folders from one site collection to another, as that's a task I need to do at my company.
Hi Shane, I am looking for way to move folders with lots of files from SPO to One Drive For business. is this possible. Any time when I use browser feature to move across it freeze in most of occasions, tried on all browser but same result, any suggestions, I have found some cool PS script to empty recycle bin, keeps giving errors from time to time but at least remove thousands of files in 5 min rather than hours via browser. Thanks
@@ShanesCows Hi Shane, Thank you for the reply, Actually i am a beginner actually i want to migrate sharepoint online site collection to another sharepoint online using powershell, that site collection will be created in this next sharepoint online right. is it possible.
Sorry you have problems Richard. Let me try to help quickly. When you run the line Connect-PNPOnline that tells PowerShell what Site Collection you are in. Then at 4:40 you do get-pnplistitem. Docs is the name of the SharePoint lists you want to get documents from. If you do a get-pnplist you will see all of the lists in your web and their names. If you need to use a sub site then add -web for your subsite name. Doest that help?
This is great, thanks Shane. Are there any other things to consider, like copying to a library SharePoint site in the same site collection or Different site collection? Nested folders? I've been working with a document library that is well over the 5000 item limit threshold, and have been working on breaking the data out into multiple libraries. Looking to automate document library creation based on a folder name in the document library, then copy the data over to that library, this is pointing me in the right direction. Also, Have you covered this scenario / possibly looking at it in the future? technet.microsoft.com/en-us/library/mt203923.aspx A general overview, it's the migration of local files to Azure Blob storage to SharePoint online document libraries. I'm honestly having a hard time finding any good guides on it. Hitting a few gotchyas related to special characters "-" in a library name is null.. trying to move each folder in my local share to a different library by grabbing the filename and trying to match that up to the document library URL. ps Personal preference - if you're showing a script i'd suggest showing it in ISE to see all of the commands - variables from start to finish, comments etc.
Just wanted to give you an update. I figured it out using mainly documentation from Stack Exchange and Stack Overflow while referencing MS's poor documentation. I had a file share of projects (200+ folders) that I was tasked to move to SharePoint. Using Powershell I created a document library for each folder in SPO and uploaded contents of each folder into its document library. Definitely saved a lot time over dragging and dropping with throttled upload speeds and slow loading browser windows. The most time consuming parts were creating the libraries, matching the folder to the library (using get-pnplist.defaultviewurl) and learning how these migration cmdlets worked (and testing if they worked..) sharepoint.stackexchange.com/questions/207323/o365-onedrive-upload-data-via-azure stackoverflow.com/questions/40996811/upload-on-premises-content-to-sharepoint-online-how-to-retrieve-the-logs-using
great video as always. Most of this is still relevant four years later. Thank you!
Thanks 😊
Thanks Shane. It's mid 2019 and this is still valuable information. Thanks.
Crazy isn’t it. 😀
Great video and the step-by-step explanation finally sheds some light on somethings I did not understand before.
Next step is build a script that reads a .csv and removes only those files listed in that .csv. :-)
Cool. I have a video that talks about working with CSVs and PowerShell if it helps. :)
Hello Shane, excellent video, see if you can help me, I need to copy all the files from an office 365 e1 account of this user's onedrive (only files, emails I do otherwise) to another account to a specific folder as an example Backup contributor X, do you have any other videos or documentation that can guide me in this copy via power shell?
i felt it when he said "but first our intro"
😎
Congrats for the tutorial Shane! Do you know if have some way to copy files from Sharepoint to local machine using PowerShell?
Yes, you could adapt this script to save to the local file system
Hi Shane. Trying to copy the attachments from sharepoint to local drive. Can you do a video on that?
Yikes, I have never done that before. Sorry
Hi Shane, thanks for your videos on using PnP to access Sharepoint Online. I have used them to put together a script to download files from Sharepoint to a local server, and the script itself works just fine. However, I have been struggling to get the script working from a scheduled task. The task is set to run as an account, for which the script runs perfectly when run manually from a powershell window. The account is also added to the "log on as a batch job" local security policy on the server. The account has sufficient access to Sharepoint - otherwise it would not do the desired file copies when run manually. When run from a scheduled task, I get the error message "Connect-PnPOnline: "Access is denied". By writing out the username property of the credential object, I see that the account name is returned when the script is run manually - but when run from a scheduled task, the username property is empty. So it's as if the script can't fetch the credentials in the credentials manager, when it is run from a scheduled task... Did you ever encounter this yourself, and do you happen to have a solution - or will it be impossible to make the PnP commands work in this scenario?
Tommy it will work. Credential Manager is per user. So if you put something in there as you and then run the scheduled task as a service account then it can’t find the credential. I have a video I talk a bit about this. I will find it and add it to another comment.
Automate your PowerShell scripts with Windows Task Scheduler th-cam.com/video/GOkAy2RqRQk/w-d-xo.html
Hi again, Shane
I owe you some feedback on this. It was a bit embarrassing, because nothing you wrote was unknown to me. However, in the heat of the battle, I had failed to notice, that I had configured the task to run as another service account than the one I had planned to use.
So thanks for helping the blind ! :-)
How to Download SharePoint files to local system drive ? do you have video? Who will provide credentials for PnPOnlinePowerrshel? I need to download files from a SharePoint to my local disk. I have access to the SharePoint folder and files in my Org but my AD credentials are not working if write a PowerShel or VB Script to download a file. always getting Access Denied message. Could you please help me?
Thanks, Shane. Can you demo the process where the source list or library is on prem, and destination is SPO? In other words, I want to just grab an on prem list (and items) and move it to SPO.
Hey, Blake. That sounds like a great video. I will put it in the hopper.
The other option is if you wanted it to move to the front of the line and for the content be based on exactly your needs I am happy to spin up the work through Bold Zebras. This is what I did for a few people, including Michael on this video. He and I worked together to write the script for his environment first. If that interests you shoot me an email.
Hello, how can I move a page that's located on the root of my sharepoint site and move it to a site library with Powershell for Sharepoint ? Do you have any idea ? Any script ? Command ? Thanks :)
hi shane so how could i move multiple folders across multiple sharepoint sites all at once. is that possible?
Hey Shane, working on a massive data move from one SP Library Sub Folder to another, would this work for a subfolder into another Doc Library? Circa 22million files with daily uploads!
Yes, it should. Might want to keep an eye on it with that many files but mechanically, all of the pieces are there.
Hi Shane, great video. Please, do you know how to get all duplicated files/documents in an online SharePoint site using pnp? Please help me
Sorry. Not aure
Hi Shane, is it possible to copy or move files using Powershell PnP from one site collection document library to another site collection document library? Thanks! I love your videos!😀
Hi Shane, thanks for the great work you're doing with these videos. I've been trying to use the samples from this tutorial to build a script, but in my case I need to move files to a folder in the target library and I'm struggling with that. If I add the folder to the target url (/library/folder/document.doc) I get an error that I can't use special characters in the file name. I'm assuming powershell thinks that "folder/document.doc" is in fact all file name and doesn't treat this as a folder. Could you shed any light on how I can move files to a folder?
Add the folder to the path not the file name.
Awesome. Thanks for the reply Shane, I've managed to copy the files to the correct folder. Now my next challenge, if I try changing the metadata using the CAML from your follow-up video to this one, I always get the item if of the rootfolder of the document, not the id of the document itself. I've been thinking I need to make the CAML recursive but so far without any luck. Could you help me out, or point me in the right direction? As always your wisdom is greatly appreciated.
I 'fixed' this issue by copying the file to the root folder first, then get the id, and then move it to the correct folder. The ID will remain the same in the move action. It's not very elegant, but it works.
Shane, Can you show how to connect to a list that is multiple levels deep. I attempted to use "/site/site/list" as syntax but I am getting Object reference not set to an instance of an object error.
There is a -web option you need to set.
Great video, it's possible only to copy files if source file is newer than destination file?
Yes. Just have to write the logic to check the dates.
Is there any chance you can repost a link to the Powershell from the video as the link is not currently working, many thanks James
Hey James. I quit paying the hoster of that content. 😑 Sorry, I need to find a new home for it all but it was costing me money.
@@ShanesCows thanks for the update Shane, I tried to see if I could engage the guys at Powerapps911 for paying for a script to copy a ton of data between Sharepoint online site but apparently you guys are not doing that anymore, so I'm trying to workout the details of the script and csv file for myself. it is slow going but I'll get there.
@@jameswood6423 Email me shane at PowerApps911 and I will see if I can get the script from the archive for you. Also, I have a friend who still does this type of work I can intro you to if you would like?
Great Video I look forward to putting this knowledge to good use. Question what prerequisites are needed for these commands to work I think I have a permissions issue. I have an administrator Powershell open and the Connect-PnpOnline -url ...gives me the error "The term 'Connect-PnPOnline' is not recognized as the name of a cmdlet, function, script file..."
i may have resolved my own issue... I got errors when I ran the commands to install-module -name SharepointPnPPowerShellOnline "NuGet provider required..blah blah" had to go and manually download the PnP Cmdlets
Now I see you have a video on that! th-cam.com/video/qmni0TqknBE/w-d-xo.html anyway thanks.
Glad you got it.
Awesome Video, can you do one where copying files from onedrive to sharepoint
Hi, I'm using mov-pnp but I want to: display an error message or prompt user to overwrite file. How can I get this done?
Not sure.
Hi Shane, I am looking to move all files from a SharePoint location to a folder on the C drive. I am able to move one specified file but not all of them. I can see how you can move files from one SharePoint location to another but it is possible to do what I require? Be aware that this script will be put on a scheduled task and the files will have new names each day so the filenames cannot be specified. Move all files from a SharePoint location to a folder on the C drive? Apologies if I have missed this in your tutorials. Thanks, Alexandra
Yes. Get the items from the list and then use get-pnpfile to download them.
Hi Shane, I'm glad it can be done! Have you got any examples of the scripts required please? I am failing to get it to work at the moment. Thanks, Alexandra
Hi Shane,This was great! I learned some new things here! And thanks for all your help with the script. Looking forward to the next video,Michael McCabeNew York
Thanks, Michael! It was great working for you. I think you will really enjoy the next video where I take the next step and start moving the metadata.
Can we move the documents from one site collection to another site collection . Can't seem to do this and I am exhausted trying to find an answer from the general search.
Yes, but it is complicated. Sorry, don’t have any sample code to send you.
I'm curious about this myself. It would be great if I could move files/folders from one site collection to another, as that's a task I need to do at my company.
@@mikesmith-knutsen4028 I'm looking for some info regarding this issue also. Have you found any examples for that?
@@frenske2002 I didn't - I ended up having to pay for Sharegate to migrate the site collections, which isn't cheap of course.
Hi Shane, I am looking for way to move folders with lots of files from SPO to One Drive For business. is this possible. Any time when I use browser feature to move across it freeze in most of occasions, tried on all browser but same result, any suggestions, I have found some cool PS script to empty recycle bin, keeps giving errors from time to time but at least remove thousands of files in 5 min rather than hours via browser.
Thanks
This video should do exactly what you want? I deleted your other comment for you and will email you.
Can anyone advise how i can restore all from the restore bin in 1 shot? Someone deleted all files.
Sorry I am not help. 😑
HI Shane I want to move Documents from SPO Doc library to local drive using PNP powershell but Move/Copy is asking for target URL , can you suggest ?
Get-PNPFile is what you want to use.
Thanks Shane PS:> Get-PnPFile -Url /sites/project/_catalogs/themes/15/company.spcolor -Path c:\temp -FileName company.spcolor this worked for me
I want to migrate sharepoint to sharepoint using powershell how to do, can you make a video about the topic
Most of the pieces are here already. Use the list PowerShell to copy lists.
@@ShanesCows Hi Shane, Thank you for the reply, Actually i am a beginner actually i want to migrate sharepoint online site collection to another sharepoint online using powershell, that site collection will be created in this next sharepoint online right. is it possible.
Thanks Shane! you are the best!
'Docs'? Confused from the start, how / where do you specify the Sharepoint Site collection/site/Library or List?
Sorry you have problems Richard. Let me try to help quickly.
When you run the line Connect-PNPOnline that tells PowerShell what Site Collection you are in.
Then at 4:40 you do get-pnplistitem. Docs is the name of the SharePoint lists you want to get documents from. If you do a get-pnplist you will see all of the lists in your web and their names. If you need to use a sub site then add -web for your subsite name.
Doest that help?
Many thanks. Got it. Tried it, same site, used $targetLib = "catlib/" (without front /) as same site. Works great. Cheers, R
Awesome. Thanks for the follow up. :)
This is great, thanks Shane.
Are there any other things to consider, like copying to a library SharePoint site in the same site collection or Different site collection? Nested folders?
I've been working with a document library that is well over the 5000 item limit threshold, and have been working on breaking the data out into multiple libraries.
Looking to automate document library creation based on a folder name in the document library, then copy the data over to that library, this is pointing me in the right direction.
Also,
Have you covered this scenario / possibly looking at it in the future?
technet.microsoft.com/en-us/library/mt203923.aspx
A general overview, it's the migration of local files to Azure Blob storage to SharePoint online document libraries.
I'm honestly having a hard time finding any good guides on it. Hitting a few gotchyas related to special characters "-" in a library name is null.. trying to move each folder in my local share to a different library by grabbing the filename and trying to match that up to the document library URL.
ps
Personal preference - if you're showing a script i'd suggest showing it in ISE to see all of the commands - variables from start to finish, comments etc.
Thanks Zack. That is a lot feedback. I don't have any immediate answers but I will see what I can come up with.
Just wanted to give you an update. I figured it out using mainly documentation from Stack Exchange and Stack Overflow while referencing MS's poor documentation.
I had a file share of projects (200+ folders) that I was tasked to move to SharePoint. Using Powershell I created a document library for each folder in SPO and uploaded contents of each folder into its document library. Definitely saved a lot time over dragging and dropping with throttled upload speeds and slow loading browser windows.
The most time consuming parts were creating the libraries, matching the folder to the library (using get-pnplist.defaultviewurl) and learning how these migration cmdlets worked (and testing if they worked..)
sharepoint.stackexchange.com/questions/207323/o365-onedrive-upload-data-via-azure
stackoverflow.com/questions/40996811/upload-on-premises-content-to-sharepoint-online-how-to-retrieve-the-logs-using
That is awesome Zack! Thank you for the follow-up answers. Sorry, I was delayed. TH-cam flagged you as spam but I fixed it. Thanks again. -Shane
When powershell asks for input like: List:
How do I put two words together? LIke: "Yellow Documents"?
Nvm...