Copy files from one SharePoint library to other with content types and metadata using Power Automate

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello today is the day i want to show you how you can copy files from one sharepoint library to the other i really don't know what is so special about it but i got so many requests from my youtube viewers and also on linkedin and from my students on udemy they all want to see how we can copy all files from one sharepoint library to another library including metadata and content types it is not a complicated process it's mostly setup of sharepoint library than working with the power automate but regardless let's do it let's have a quick review on the problem definition the setup that i have done i have two libraries called lib1 and lib2 lib1 has a few content types and a few files in it with some metadata lib2 does not have anything it's just a plain vanilla document library with only one content type which is the built-in document and i'm going to do the entire setup right in front of you as we do the video both these libraries are on the same sharepoint site so all the content types that are available to lib1 are available to lib2 if this is not the case just make sure that the same libraries are available to both of them across site collections using the sharepoint content ipob if you want to know about the content ipob let me know and i will create a video about it so far i haven't got any requests about it we want to develop a flow that actually copies all the files in lib1 with their content type and metadata to lib2 now let's get to sharepoint and see what we got inside the sharepoint modern team site i've already created two libraries lib1 has a few content types including picture document article page and audio and all these content types are built in sharepoint content types you can actually create your own content types and add it to the library it doesn't change the process just keep in mind if you're adding your own content type add it to the content type so if you want to copy the files with the content type and metadata across site collections you have the content types available in both libraries at the moment lib1 and lib2 are under one sharepoint site the content types that we have are picture document article page and audio so let's go to lib2 and do the setup as i told you before lib2 is just a vanilla document library so it doesn't have anything special the first thing that we need to do like library one we need to enable the content types for the sharepoint document library in order to do that i go to my setting i click on library setting and under advanced settings i allow management of content types scroll down i click on ok and now content types are enabled for this site as you can see now i can add from existing site content types so let me click on this and add what i need to add here in library one i have picture so i go to library 2 and i add picture in library 1 i have document which is already there i have article page so i come back here and i add article page and i also have audio so if i go back here i can pick audio and add it to this document library and i click ok is there anything else no so when i come back here now i have document picture article page and audio all these content types are available so basically now if i copy one file from lib1 to lib2 if that file takes its content type and metadata with itself those content types are available in lib2 so our setup is complete let's go to flow and create a flow that does the job for us just like before i go to flow.microsoft.com and i click on create i don't want to make it anything special i create an instant flow and i say copy sharepoint files demo manually trigger flow i just want to push a button and it should do the job how it starts is not the topic for this lecture the first thing that we need to do we need to get all the files that they are in lib1 so i just add the new step and under sharepoint i search for get files i just need to use the properties only so if i use get file i can go for the site address i will pick up the flow course that was my site if you don't see it in the list or this is the file this is the website that you connect for the first time you can simply click on custom and just enter the url i can do it here again for you so i just get a site url and i can come here and just paste it here rather than picking up from the list then i go to the library that i want to get the content from it's lib one limit entries to folder no i don't want to limit it and include nested items if you want to include subfolders at the moment there is just one folder but if you just do the nested items it does exactly the same thing it doesn't really matter show advanced options if you don't have anything special i don't want to query anything with all data or something like that i don't want to apply any limitations so basically i want to send everything that i have in lib1 to lib2 and this one should only give me the list of files that are there when we get the list of all the files we need to navigate through all the files and copy the files from source to destination one by one to do that i need to use and apply to each loop if i click on this now i can pick the values that the get files returns and work with them so if i click on here if i go to the list of get files i scroll down and i should find the value which contains the list of items this list of items includes lots of properties that we just need the identifier now under the supply to each i can copy file so i can click on add an action i search for sharepoint controls if i click on sharepoint i can say copy file and if i click on copy file i can get the current site address i pick the source the file that i want to copy i got to get the identifier from the properties and this identifier you can find it here in the list oh gosh this is a long list identifier i click on the identifier so i get the identifier of the files from the source in the destination i need to select the site which is the same site collection the destination folder this time it is library 2. and if another file is already there this time i want to overwrite it or replace it and that's all about it let's see if we can run it and get the results so let me test this and i say save and test i click on run flow done and this process usually takes a while to complete so don't expect a quick result and if it takes sometimes a minute or two depending on how many files you have in library one or in your source library and wait for this to complete it goes one by one the only question is that okay we copy the files how about metadata and here is when the magic happens let's go fast forward and see the results and now the flow completed successfully i go to library 2 and see the files are here a few seconds ago do i have the metadata the first thing that i want to do i want to go to the view that i have here and i say edit current view because i want to add the content type here just to make sure that the content types are copied okay now the content type picture picture document article page and audio they are in lib2 and if i go back to the library one that's exactly the same thing perfect now if i go back to the library too i want to see the other properties for example in library 1 which is in the source if i click on this arcan.jpg and if i click on info it's a picture but it has properties like arkandoo jp jpeg arkando part it's a date picture taken and all this metadata let's go back to the library too and see if all those properties are copied so if i click on this and i go to the info i will see the same picture properties are title our candle part the date is the same thing comments and all those things that are coming from lib1 so if i scroll down here that's the same thing and it applies for everything so basically what we have here as the copy file inside sharepoint it copies not only the file but also all the properties and content types and the problem is solved in one shot as long as you have do the right setup in place before you run this action and we finally did it thank you for watching i hope you enjoyed this video as always don't forget to like and subscribe have a wonderful day you
Info
Channel: Alireza Aliabadi
Views: 18,301
Rating: undefined out of 5
Keywords: SharePoint, Document library, Power Automate, Copy files
Id: QJHiKVFcNqM
Channel Id: undefined
Length: 12min 10sec (730 seconds)
Published: Wed Jun 03 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.