cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

create synchronized specific folders within Sharepoint

Dear Fellow Users.

 

I am fairly new to using PowerAutomate. Until now I only used the basic actions for some simple tasks. But what I want to make now is unknown territory for me.

 

I need your help whit the following concept. (see photo.) The company I work for uses SharePoint as work environment and as a platform to provide files to external involved companies. The company I work for mainly works on a project basis. A Standardized SharePoint environment is therefore created for each project.

 

Most files may not be shared or are not interesting to the external companies. that is why I want to create a sub-folder for each folder (folder 1 0--> 1.1, 2--> 2.1, 3-->3.1 ect) that contains all files that may be shared. this sub-folder must be synchronized with folder with the same name in another library on the same SharePoint site “External sharing platform”.

 

For this I want to use a "recurrence trigger" every x hours. Here comes the hard part, the flow must  check the differences in both libraries in specific folders. If there are differences, a new file must be created or deleted on the “external sharing platform”

 

Is this even possible?

 

Capture.PNG

11 REPLIES 11
Highlighted
Super User II
Super User II

Re: create synchronized specific folders within Sharepoin

Hello @S_J_G 

The documents being shared in the External sharing platform, are they allowed to be edited by the people there or can they only read/view the documents?

 

You should not have your recurrent flow do any checking, just make a Get files action with a Filter Query field condition that will include only files having been modified within the last couple of hours. That will minimize the amount of files you need to synchronize every time.

 

If you can, add a property to your folders or create a folder content type, so you easily can identify if it is shareable or not. Then you can include that information in the Filter Query field and minimize the workload even further.

 

Let's hear back from you on the above and about how far you have gotten already 🙂

Kind regards, John

Highlighted
Helper II
Helper II

Re: create synchronized specific folders within Sharepoin

Hi @JohnAageAnderse 

 

The external users are only allowed to read the documents.

 

Great Idea! I think I'm going to add an extra column to SharePoint, (Shared File Yes / No).
add a extra property to the sub folder> when you add file to subfolder, automatically "Share File" Column = Yes
or something like that.  Create flow using the action "when a file is created or modified ". But this idea doesn't work when you delete a file, does it? this is not part of creating / modified.
(i cant use "when file is deleted" action, only admins can orsomething)


But, I wanted to make a recurrent flow instead of a automated flow. I read somewhere ; if you have Sharepoint folders added to your local desktop, automated flows wil not be triggered if you upload files locally. is this True?

 

 

Highlighted
Super User II
Super User II

Re: create synchronized specific folders within Sharepoin

Hello @S_J_G 

About libraries synchronized to your desktop - I observed through tests, that a file dragged/dropped into a library that is synchronized to your desktop (using OneDrive) will not trigger a file creation event. At the same time, if I copied a file into the same library, then it will trigger a file creation event.

 

About keeping your external sharing platform up to date, there are some suggestions:

  • make a list that will keep track of which documents in the source library have been created, modified, deleted.
  • make a flow that will update the above list with item ID, file name, state (updated), when a document is created or modified in the source library.
  • make a flow that will update the above list with item ID, file name, state (deleted), when a document is deleted in the source library.
  • use the above list in your recurrent flow to update the external sharing library, remove each processed item from the list.

The above relies on that you can add a column to the external sharing library that will hold the ID of the document in the source library, so that you can easily identify which document to update/delete.

Kind regards, John 

Highlighted
Helper II
Helper II

Re: create synchronized specific folders within Sharepoint

Hi @JohnAageAnderse

 

Progress update (below): I tried your suggestion. I tried to use the ID column field but it didnt work out for me. When i moved/copyed or created a sample file, the ID just automatically changed, so i could not compare them anymore. Also i can't monitor deleted files because i am not an admin.

 

I managed to make a flow that moves files via the file name. The filename will be unieke enough for my use case (i think).
the only challanges i face now are;

- how do i get the file in the right folder. Both external and internal folders have the same name.

- how do i remove files thet where deleted in the internal workspace. whitout "when file is deleted" action.

1122

 

 

 

 

 

 

Highlighted
Super User II
Super User II

Re: create synchronized specific folders within Sharepoint

Hello @S_J_G 

About the issue with not being able to use the When a file is deleted trigger:

  • You will then have to make your own solution to this - Recurrent flow that takes every shareable file from your External sharing platform library and check if the original file still exists in the Internal work environment library. If it does not, delete the file.
  • Or you can raise your issue with the Site collection admin - maybe he/she can provide a solution, like a service account.

 

About synchronizing files to the External sharing platform:

  • I would use the Copy file action instead of Create file from the file content. See my example below.
  • To ensure that the file ends up in the folder - I use a variable to build the target path in which to copy the file to.

Example flow (not real, just quickly put together as an example)

Flow.S_J_G.TargetPath and Copy file.jpg

Kind regards, John

 

Highlighted
Helper II
Helper II

Re: create synchronized specific folders within Sharepoint

@JohnAageAnderse 

 

Almost there i think; 

now i only get the following error, do you know why?

 

1234.PNG

Highlighted
Super User II
Super User II

Re: create synchronized specific folders within Sharepoint

Hello @S_J_G 

In that Append to string variable action, what is the expression that you use?

It states that you are using the REPLACE function and that the value you provided to it as the first parameter is not a string.

Kind regards, John

Highlighted
Helper II
Helper II

Re: create synchronized specific folders within Sharepoint

Hi @JohnAageAnderse 

replace(triggerOutputs()?['body/{path}'],'/x/x/x','')

Highlighted
Super User II
Super User II

Re: create synchronized specific folders within Sharepoint

Hello @S_J_G 

In the REPLACE function, the 1st parameter has to be the folder path (dynamic property) of the file from the internal workspace! That means that it cannot come from the triggerOutputs!

Looking at your flow, the action "Get files (properties only) - Internal workspace" is where the 1st parameter should come from! 🙂

Kind regards, John

Highlighted
Helper II
Helper II

Re: create synchronized specific folders within Sharepoint

Hello @JohnAageAnderse 

 

Thank you for your fast replays!

 

to be honest I'm just copying now, I understand what it should do. But I have a lot of trouble with how to properly use expressoins  . I still get the same error after using the dynamic property 'body'.

replace(outputs('(I)_Get_files_(properties_only)_-_Internal_workspace')?['/teams/Zuidplaspolderfase5/06 Werkdocumenten}'],'/teams/Zuidplaspolderfase5/Actuele stukken omgeving','')

So close, but so far away..., could you give some inside how to properly use the expression in this case?

Highlighted
Helper II
Helper II

Re: create synchronized specific folders within Sharepoint

hi @JohnAageAnderse 

 

I assume that I am so far off that it is no longer worth responding haha😅. but thanks anyways for your effort so far.

Helpful resources

Announcements
Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Top Solution Authors
Top Kudoed Authors
Users online (9,489)