cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AutoIT
Frequent Visitor

I Need Help Checking In All Files In A SharePoint Folder With Power Automate

Hey guys I am currently working on a flow that will go into a specified SharePoint folder, it will look at all the files in that document when manually triggered, then it will "check-in" all files that are checked out to any user and then ultimately it will take that folder and move it from one SharePoint folder into a separate SharePoint folder. I am able to get the move part to function properly however when I am attempting to get all the files in a particular SharePoint folder to "check-in" this is where I am struggling. I have attempted a few different apply to each rule but I don't think I am getting it right. Currently when I attempt to run the flow, I get an error stating that

 

the output from the previous rule is of type "String". the result must be a valid array. 

 

I do not know how to get my output as a valid array or how to convert my outputted string into a valid array. If anyone could assist with this, it would be greatly appreciated. I am going to paste my existing flow below. Thank You

 

AutoIT_0-1669848390072.png

 

 

9 REPLIES 9
annajhaveri
Community Champion
Community Champion

@AutoIT  so just to reconfirm are you looking to fetch files from folder which needs to be checked?

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.
AutoIT
Frequent Visitor

Ultimately, I need to list through all of the files in a specific folder on a SharePoint site, identify all of the files that are currently "Checked-out" to any user and then I would like to automate going through that list and doing the "Check-in" file process for each one of those checked-out files. I'm hoping this is making sense please let me know if I need to elaborate further and thank you for your help.

This is how I would go about checking in the files. Note that the person running the flow will have to be an Owner of the site otherwise they won't have permission to check in on behalf of other users.

 

Below is the library I've used for this example. Note that two of the files are checked out.

grantjenkins_0-1670540241199.png

 

Below is the full flow. I'll go into each of the actions.

grantjenkins_1-1670540268917.png

 

Get files (properties only) will return all files within a specific folder. I've set it to only look within my Working Files folder, and to include nested items just in case there are additional folders within my Working Files folder that contain files. I also have the following Filter Query, so it only returns files that are currently checked out.

 

CheckoutUser ne null

 

 grantjenkins_2-1670540462147.png

 

We can then use an Apply to each to iterate over each of the files returned from Get items (since the only files returned are checked out), and use Check in file to check them back in.

grantjenkins_3-1670540542945.png

 

You can then add your Move folder logic after the Apply to each.

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.
AutoIT
Frequent Visitor

I just wanted to start with a thank you for a response, I went ahead and followed your configuration that is listed above in the screenshots. The flow runs with no errors, however the files that are "checked-out" are still in the same "checked-out" status and the files still need to be manually "checked-in" or there is something that isnt quite working or catching all of them. I notice that it also isnt taking any time to run the apply to all loop at the end and is only taking 1s to  run the get files (properties only) task. I know it is fast but that just seems very fast if not to fast to be properly functioning, im wondering if the problem is with the nested folders however I have a file in the folder also that is refenced and not nested that still was not "checked-in". I will post pictures below.

AutoIT_0-1670567409687.png

AutoIT_1-1670567804122.png

AutoIT_3-1670568015197.png

 

 

The first image shows the flow running successfully, however the 3rd image still shows a file checked out from the folder the flow was ran on.

 

After you run the flow are you able to see how many iterations the Apply to each went through?

 

Also, just confirming you are an Owner of the SharePoint Site where you are checking in the files? In order to check in files that were checked out by other users, you need to be an Owner.



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

So, the apply each is the one that has 0s and looks like it did not go through any files. I'm suspecting that the filter to grab only checked out files is not filtering through the mapped folder and sub folders and identifying the "checked-out" files, there for it thinks it is successful, so I get green check marks and then when it goes to the apply to each rule, it thinks it ran successfully because there were no files for it to check in? I hope this theory is making sense at least I will provide a screenshot of what it looks like after it runs successfully on the "Apply to each" portion of the flow. I am Global Administrator on the Azure tenant.

AutoIT_0-1671124230847.png

 

@AutoIT are you able to add a Compose directly after your Get files and use value as input. Then run your flow and see if any results come up within the Compose.

 

Also, Global Admin still won't make you an Owner of a SharePoint site, so you would still need to make yourself an Owner of the site in order to be able to check in files that have been checked out by other users.

 

I'd suggest checking out a couple of files yourself, plus have some checked out by other users and see if both yours and the others are checked in.



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

Hey Grant,

 

          I confirmed I am an owner with full access to the SharePoint sites in which I am trying to check the files in. I also checked out a few files originally when creating the flow to attempt to test it and I have confirmed all are still checked out to my user as well as confirming other files that are checked out in that folder as well. I went ahead and attempted the "Compose" action directly after the "Get files" step using the value from the "get-files" command in the "Compose" body and I am getting no input data or output data in the "Compose" action. I also am having 0 seconds runtime for both the "Get files" step and the "Compose" step however the 2nd step makes sense if the first isn't functioning properly. I suspect that the filter to go through all the files and only select "Checked-out" files is either not functioning properly or it just needs to be done in a different way. I do see some output data at least for the "Get files" part of the flow however no input data or output data for the "Compose" part of the flow. 

AutoIT_0-1671574745342.png

 

Well, I wanted to update to this, I was able to get it to work eventually but I had to change a few settings. The first thing I had to change was the filter for the checked-out files. The proper filter to do so is "CheckoutUserId ne null" I was missing the "Id" at the end of the "CheckoutUser" filter, I was able to verify this by connecting to my SharePoint site via Powershell and viewing the file in the Powershell Terminal. I also changed the "Apply to each" output from "ID" to "value" and now it seems to be functioning properly and it checks in all files within that folder including nested.

AutoIT_3-1674584814989.png

AutoIT_5-1674589487474.png

(I removed all of the site address and library name settings)

Thank you very much for all of your help.

 

 

 

 

 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (4,357)