web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / count no of files in a...
Power Automate
Answered

count no of files in a particular SharePoint folder and update in dynamics

(0) ShareShare
ReportReport
Posted on by 84

Hi All,

 

I am creating flow with below fucntionality.

1. Whenever record is created in MS CRM create some folder structure in SharePoint. 

2. Count no of files in each folder and update that number in MS CRM.

 

Example: On Create of Account create "Contact" and "Related Document" folders in SharePoint and count files in each folder and update in "Contact count" and "Realted Document Count" fields in Dynamics respectivly.

 

I completed point 1 succesuuflly but I am not able to count no of files in each folder in SharePoint.

 

How can we add filter query on  "Get item" to retrieve and count no of files in that particular  folder

Below is the screen Capture: 1.png2.png

Categories:
I have the same question (0)
  • Verified answer
    Willemijn Profile Picture
    214 on at

    Hi, 

     

    If you only want to count the files in the specific folder you can maybe use the action 'Send an HTTP request to SharePoint':
    image.png

     

    As Uri: /_api/web/getfolderbyserverrelativeurl('/sites/testflow/LibraryTitle/foldername')/ItemCount

    As a result you get the items in this specific folder. 

     

    Hope this helps! Otherwise let me know 🙂

    Willemijn

  • adriaanvw Profile Picture
    15 on at

    Hi @Willemijn 

     

    Thanks for the solution, which works well. Any idea how to assign the ItemCount to an integer variable? I'm trying to work with the output of the GET request, which looks like this:

    {
     "d": {
     "ItemCount": 5
     }
    }

     

    Struggling to extract the number and use it as a variable though. Any suggestions? Thanks

  • Willemijn Profile Picture
    214 on at

    Hi! 

     

    You could use the Parse Json action for that, use the body of your request as value, and use sample load to generate the schema.

    After that action you can use 'Itemcount' as a dynamic value. 

     

  • adriaanvw Profile Picture
    15 on at

    Thanks @Willemijn ,

     

    That did the trick, and now I know what Parse JSON does 👍

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard