Power Automate - Copy Files but ignore if already exists (basically a sync files via Flow) - sharepoint

Attempting to copy any MISSING files over from one SharePoint Shared Documents Folder to another. I have a separate flow that looks for all NEW files every 30 minutes and copies them over. However, occasionally the flow will miss a document because the flow ran slow, or the like. Therefore, I would like to manually trigger a similar flow that will copy over any files that does not exist today.
I get to the SharePoint Copy File step. The only choices are to 'Copy file with new name', 'Fail this action", or 'Replace". It does also give a "Custom Action" as well...but that is where I am struggling.
I need it to basically, IGNORE / DO NOTHING if the file name already exists... How can I do that?

Related

How to prevent user from saving changes to the master excel file?

I have a fair understanding of basic to intermediate VBA coding - here's the predicament I am having at work - I am responsible for maintaining this master excel file that consists of 35 tabs and macros and event procedures etc. - this file is used by the other team (more than 10 people) as the primary tool for carrying out their daily tasks - as the author i always keep an original copy of this file as a backup for any contingent event, and I put a copy of the file in the team folder for the team to use.
However, it sometimes happens that some of the team members would open this file in the team folder and make changes (they are told not to) as normal practice and accidentally save the changes withtout realising it - now that potentially creates an issue for the next user (good user) who would make a copy of this file and save it to their own folder and continute to work on with it (good practice) but they did not realise there has been data left in the workbook from the previous user - this kind of incident could create a disatrous consequency if it's left unnoticed.
I am trying to think up a way or series of codes that can resovle the issue - i just do not know which way to begin with - I was thinking of using SheetChange or Open (eg upon detecting any change then save as a new file in a different location) event - with that i ran into another issu- how i do ensure the subject event will not intervene other events that already exist in the workbook in the subsequential workbook?
any suggestion on structuring the code to accommedate this situation?
many thanks in advance
#VBA #event #savechange
as described in above
I would keep the master copy well hidden from them.
Then, consider putting passwords on sheets they MUST not change.
Or, consider sub-master files for the detail that each team can change and then your master file can link to those sub-files to get the latest data.
I had a project to manage that had 6 team members. Gave them each their own file and linked to their data. Also passworded the functions so they could not change or delete them.
Save the file as an Excel Macro-Enabled Template (.xltm) file.
This way, on double-clicking the file (as you would to open any other file), it creates a new file and will not automatically overwrite the old file when saving.
Instead of taking copies of the file, your users simply have to 'open' the file then later save as whatever they need to.

Power Automate - Infinite Loop issue

This sounds so simple in my head, but Power Automate doesn't like it.
I have a library with a lookup column. I have a Flow created which takes the filename of the document and puts this name into a "Title" column. Then I can use a lookup column on the Title column to find all the files in the library.
I've used "When a file is created or modified". Yet this flow runs constantly. No files are being update or modified at 1am, yet it still runs over and over. I've had an automated email telling me to fix this before it is disabled.
All I want it to do is run the damn flow ONLY when a file is updated or uploaded, just as its own function title suggested.
It would seem I need to add trigger rules, but all the guides I found were talking about checking if a specific person has modified it.
This used to be so simple with workflows, it would only run if something was modified or uploaded.

Copy Sharepoint folder to local drive

I'm new to power automate and have been searching on Microsoft forums and googling a flow to copy all contents of a sharepoint root folder (Documents) to a local drive and cannot find an easy straight forward answer.
All i see is how to copy files to a local drive, which after trying and failing a lot, i finally found 1 flow that helped me do it in 2 steps:
1 - When a file is created;
2 - Create file
What i intend is to backup the root documents folder monthly with all other folder and files included to a local drive with power automate.
Appreciate any help.
Il post the prints on the flow i have right now:
Created Flow
Error after running flow
What happens is that one subfolder is selected and only the files on the subfolder are copied to the local drive, not the subfolder itself, and after that it stops the flow saying no dependent actions succeeded. I was expecting the following:
1 - Select files in folder and copy to chosen path;
2 - Select subfolders with files and create the same subfolders with files on the chosen path;
First you have to list all the files you need to copy to your Drive using the sharepoint Get Files action:
Next, add an Apply to each using the first dynamic content you have on the right side, normally it's a value like showed below, then add sharepoint action Get file content using path. Select the same root directory you used in the Get Files action and in the File Path property use the dynamic content Complete Path.
Next, all you have to do is create a new file using the Google Drive action Create File still inside the Apply to each. Use the file name and in File Contents use the dynamic content File contents:

Shortcut with environment variable

I'm at work, with a folder in which we create a daily excel sheet to manage our clients. For the sake of understanding let's imagine this files is in a folder called OCTOBER and they are named MD01, MD02, MD03... based on the day we are.
I was trying to setup a shortcut on my desktop that will call the correct file every time so I don't have to go trough the file structure to access it. Something like this:
"....\OCTOBER\MD%DAY%.xls"
But the moment I try to setup the path this way I get an error say this is not a valid path. Well, either I am missing something here or what? Can't this be done?
A typical method is to create a link to a master file in the folder (say master.xlsm) The master spreadsheet would automatically:
determine the date
determine the appropriate file to open
open the file (say MD10.xls)
close itself
Alternatively you could create a little vbscript or powershell script or .bat file to do the same thing.

sharepoint workflow to move files of a content type to new folder (after creating it if needed)

I have multiple SP document libraries for different meetings. I want to keep the libraries organized by meeting day. So each meeting would have it's own folder and all the files for that day would go in that folder.
To make it easy I wanted to make it so you can upload a file and then a SP workflow will create a folder for that meeting, if needed, and move the file.
So I created a "meeting file" content type that also gets meeting date and file type (minutes, presentation, misc, etc...)...
What I need to do next is check if a folder for that meeting date exists and create it if it does not. Then move the file over to that folder.
Any ideas how I could do this?
I could also try it without using content types but then the workflow starts automatically for every file added and then I cannot create a new folder with that workflow (because it would start a new instance of that workflow).
I was hoping to keep it reusable so I could just use one workflow for all the document libraries. I thought the workflow could find the path of the list it is being run on, and create the folders and do the other work within that list.
Any ideas are appreciated.
For creating folder via workflows:
Creating folders and sub-folders using SharePoint 2010 Designer Workflow
and for checking folder name:
Create a string workflow variable.
Now create a lookup for your folder and set the variable to the folder's title. Take a look here for some helpful information and usage guidelines when it comes to list folders.
The actions dependent of the existence of the folder have to be placed inside an if-statement
E.g. the if-statement should be like "if [variable] not equals [folder name]" if you want the actions only to be run when the folder does not exist
and here the whole tutorial that I found:
Create folders using a SPD workflow

Resources