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

Designing a flow to identify all documents across multiple folders that have not been modified in the previous 12 months

Hi,

I am having a great difficulty in designing a flow that checks all documents across multiple folders; for any documents that have not been modified in the previous 12 months and to send an email to the document owner. I know how to schedule the flow and I can use the email function, but unsure of how to identify files that have not been modified in the previous 12 months.

 

Any assistance would be greatly appreciated.

 

Cheers

Roger

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Bof,

 

I checked the outputs from filter one and they were all folders ie Folders=true. I therefore increased the Top Count and the flow works as intended!

Thank you so much for your time and patience with assisting me, it is very much appreciated. I will mark as solved and hope you have a great day.

Cheers 

View solution in original post

14 REPLIES 14
v-bofeng-msft
Community Support
Community Support

Hi @BEM :

Could you tell me where the files are stored?

The point is to use the Filter array action

Case1: The file is in the root directory of OneDrive

v-bofeng-msft_0-1606204597315.jpeg

 

Case2: The file is in a library in SharePoint Site

1.JPG

 

Best Regards,

Bof

Hi @v-bofeng-msft 

Thankyou for responding. I have included the flow below. I need to test for another day but I don't think the date calculation is working correctly as it returns some documents that have ben modified in the previous 12 months. Am also wondering if there is a way for the modified date to be included in the email body? 

Document review sharepoint listDocument review sharepoint list

v-bofeng-msft
Community Support
Community Support

Hi @BEM :

Firstly,"addDays(utcNow(),-365)" must be added in Express mode. The way of direct input in your flow is wrong.

Seconldy,When sending emails, you should refer to the Output of the Filter array action instead of the Output of the Get files action.

Please try this flow:

1.JPG

Schema:

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "@@odata.etag": {
                "type": "string"
            },
            "ItemInternalId": {
                "type": "string"
            },
            "ID": {
                "type": "integer"
            },
            "Title": {
                "type": "string"
            },
            "Modified": {
                "type": "string"
            },
            "Editor": {
                "type": "object",
                "properties": {
                    "@@odata.type": {
                        "type": "string"
                    },
                    "Claims": {
                        "type": "string"
                    },
                    "DisplayName": {
                        "type": "string"
                    },
                    "Email": {
                        "type": "string"
                    },
                    "Picture": {
                        "type": "string"
                    },
                    "Department": {
                        "type": "string"
                    },
                    "JobTitle": {
                        "type": "string"
                    }
                }
            },
            "Editor#Claims": {
                "type": "string"
            },
            "Created": {
                "type": "string"
            },
            "Author": {
                "type": "object",
                "properties": {
                    "@@odata.type": {
                        "type": "string"
                    },
                    "Claims": {
                        "type": "string"
                    },
                    "DisplayName": {
                        "type": "string"
                    },
                    "Email": {
                        "type": "string"
                    },
                    "Picture": {
                        "type": "string"
                    },
                    "Department": {
                        "type": "string"
                    },
                    "JobTitle": {}
                }
            },
            "Author#Claims": {
                "type": "string"
            },
            "OData__DisplayName": {
                "type": "string"
            },
            "{Identifier}": {
                "type": "string"
            },
            "{IsFolder}": {
                "type": "boolean"
            },
            "{Thumbnail}": {
                "type": "object",
                "properties": {
                    "Large": {},
                    "Medium": {},
                    "Small": {}
                }
            },
            "{Link}": {
                "type": "string"
            },
            "{Name}": {
                "type": "string"
            },
            "{FilenameWithExtension}": {
                "type": "string"
            },
            "{Path}": {
                "type": "string"
            },
            "{FullPath}": {
                "type": "string"
            },
            "{IsCheckedOut}": {
                "type": "boolean"
            },
            "{VersionNumber}": {
                "type": "string"
            },
            "MediaServiceAutoTags": {
                "type": "string"
            }
        },
        "required": [
            "@@odata.etag",
            "ItemInternalId",
            "ID",
            "Modified",
            "Editor",
            "Editor#Claims",
            "Created",
            "Author",
            "Author#Claims",
            "OData__DisplayName",
            "{Identifier}",
            "{IsFolder}",
            "{Thumbnail}",
            "{Link}",
            "{Name}",
            "{FilenameWithExtension}",
            "{Path}",
            "{FullPath}",
            "{IsCheckedOut}",
            "{VersionNumber}"
        ]
    }
}

Best Regards,

Bof

Hi Bof,

 

Once again, thanks for your help. I made the changes you suggested and the flow works. Is it possible for the flow to ignore  folders but not the contents of the folders when running? At the moment, the flow will identify that a folder is due for a review, based on it's date of creation. In other words, I need the flow to check that documents are due for review and not the folder.

Hope that makes sense?

 

Cheers

v-bofeng-msft
Community Support
Community Support

Hi @BEM :

Just add one more Filter Array action.

1.JPG

Best Regards,

Bof

Thanks Bof,

 

Unfortunately, it still seems as if it is including folders in the result. I have attached my flow in case I have done something wrong.

Capture.PNG

v-bofeng-msft
Community Support
Community Support

Hi @BEM :

The key is that you need refer to the result of Filter array2 in the loop body instead of referring to the result of Filter array1.

1.JPG

  • You need to add one more JSON action to parse the result of Filter array2
  • Then use the result of this JSON for the next step

Best Regards,

Bof

Hi Bof,

 

I have attempted to add a further JSON and parse the result of filter array 2 but clearly my lack of understanding is not helping. This is my flow at the moment but it is incorrect. Any chance you can show me as a flow picture what I need to do? Again, thanks for your patience.Flow 1.PNGflow 2.PNG

v-bofeng-msft
Community Support
Community Support

Hi @BEM :

I did a test and it seems that there is no need to add one more JSON action.From your screenshots, I think the problem is that you used two "apply to each" actions.Please try this flow:

1.JPG

Best Regards,

Bof

Thanks Bof,

I have amended the flow but still no good. I have included 2 screenshots of the flow and a screenshot of the output if that helps?

Flow 1.PNGflow 2.PNGoutput.PNG

v-bofeng-msft
Community Support
Community Support

Hi @BEM :

There is no output from your Filter2. I suggest you check if there are any files that are not folders in the result of Filter array1.For example:

1.JPG

Best Regards,

Bof

Hi Bof,

 

I checked the outputs from filter one and they were all folders ie Folders=true. I therefore increased the Top Count and the flow works as intended!

Thank you so much for your time and patience with assisting me, it is very much appreciated. I will mark as solved and hope you have a great day.

Cheers 

View solution in original post

v-bofeng-msft
Community Support
Community Support

Hi @BEM :

I am glad to hear that you have solved this problem. If my answer is helps, could you consider marking it as a solution?

Best Regards,

Bof

BEM
Frequent Visitor

Not a problem at all Bof, have marked as a solution.

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,346)