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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / When Sharepoint file (...
Power Automate
Answered

When Sharepoint file (Word doc) is changed, post the name of the person who edited on Teams.

(1) ShareShare
ReportReport
Posted on by 31

Hi everyone,

 

Can't seem to find a solution available. I need to monitor a single Word file in Teams (that is, saved in Sharepoint). The idea is to post automatically on a Teams channel when that file is edited by someone. The message should contain who edited and when was his/her last edit.

 

The best is to have this as an automated flow running every night, to make a summary of who edited the file in the last 24 hours. This information should be in the version history of that file. If at all possible, the details of the edits would be a great informaton (XX deletions, XX insertions, XX comments, etc.) but I know this is going too far with the fantasy.

 

The reason for this need is that we are working as a team on a single file, and we want to easily keep track when someone has done some work on it (besides the Word Track Changes of the file itself).

 

Any solution?

Categories:
  • abm abm Profile Picture
    33,004 Most Valuable Professional on at

    Hi @dorianps 

     

    You need to use the SharePoint http request flow step to get version history. Based on the version history you could retrieve the related details. 

     

    Please see my blog about how to restore a document to previous version.

     

    https://mydevexperience.wordpress.com/2019/06/08/build_msflow_restoredocversion/

     

    Here I am getting the version history of the document and restore to previous version. Might be useful.

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

     

    Thanks

     

  • Gristy Profile Picture
    2,429 on at

    Hey,

    You are probally best off using things like the activity webpart, or the information panel.

     

    you could potentially use Send HTTP action to SharePoint and get the versions using the rest api:

     

    _api/web/Lists/getbytitle('MyListName')/items(ITEMID)/versions

  • Verified answer
    v-bacao-msft Profile Picture
    Microsoft Employee on at

     

    Hi @dorianps ,

     

    Please try to refer the following image to configure your Flow.

    77.PNG

    78.PNG

    Expression reference

    CheckinComment:

    item()['OData__x005f_CheckinComment']

    ModerationComments

    item()['OData__x005f_ModerationComments']
    VersionId
    item()['VersionId']
    Compose
    replace(body('Create_HTML_table'),'<table>','<table border="1">')
    Hope it helps.
     
    Best Regards,
  • dorianps Profile Picture
    31 on at

    Thank you all for the responses.

     

    @v-bacao-msft Your solution seems straightforward and I understand most of it, but I am stuck at the first URI step (novice in Flow).

     

    What is the "File Item ID" and where do I find it? Is it just the filename itself or some ID I can get somewhere? Can you show an example what would you put for a specific file in your Sharepoint?

     

    After reading online, my guess is that URI can be something like:

    _api/web/Lists/getbytitle('Shared%20Documents/FOLDER_TEAMS_CHANNEL_NAME/FILENAME.docx')/item(?)/versions

     

    I appreciate your help and the quick solution you sent.

    Dorian

     

     

  • Verified answer
    v-bacao-msft Profile Picture
    Microsoft Employee on at

     

    Hi @dorianps ,

     

    Uri should be:

     

    _api/web/Lists/getbytitle('Documents')/items(5)/versions

     

    The ID needs to be obtained in the Library, Add column—Show/hide columns.

    Image reference:

    86.PNG

     

    Best Regards,

  • dorianps Profile Picture
    31 on at

    Great, I managed to get it running. A couple of notes:

    1. The CheckinComments and ModeratorComments refer to Sharepoint processes, while I thought they would count the amount of insertions/deletions in the file itself. No problem though, I know that information might not be available.

    2. Had to change the filter expression simply to "is greater than"

    addDays(utcNow(),-1)

    because the original solution was producing an empty table.

     

    This is how the table looks now.

    Capture.PNG

    There are a couple of enhancements I am trying to make at this point:

    1. Is there a way to filter by unique EditBy to keep only a single line about each EditBY individual? Or, even better, count the number of versions created by someone in the last 24 hours and put that in a separate column. The idea is that this table gives a quick summary of who edited the file, when was his/her last modification, and how many versions did he/she create.
    2. I need to format the dates into a readable format. I guess I can do that one by one, but if there is a quick way to format all dates, that would be great.
    3. I need to put the name and link of the file at the begnning of the message. Any quick tips how to do it with the existing information from Send HTTP?

     

    Very many thanks for your help  @v-bacao-msft .

     

     

  • Verified answer
    v-bacao-msft Profile Picture
    Microsoft Employee on at

     

    Hi @dorianps ,

     

    For your first question, you can clearly see the quick summary of the file version in the HTML table. You could add a property like VersionLabel to make more explanations.

    For the second question, you could use the formatDateTime() function to format the Date field to the expected format.

    For the third question, you can use the Get file properties action to get the file name and Link to file. You can reconfigure the HTML table and adjust the order of the fields.

    Image reference:

    92.PNG

     

    Best Regards,

  • Verified answer
    dorianps Profile Picture
    31 on at

    Barry ( @v-bacao-msft ) , thank you. This is how it looks so far.

     

    Capture.PNG

     

    What I need is not explanations for each version but a single line for edits made by Dorian. Specifically:

    1. A column with the name of the person (one name per row, only once Dorian).
    2. A column with the date of the first edit (the earliest "Created" by Dorian).
    3. A column with the last modification by Dorian (the lastest "Last_x005f_x0020_x005f_Modified").
    4. A column with the number of versions created by Dorian (4 in the above example)

    Then the next raw should show info from another person who edited the file.

     

    The above needs condensing the table with some conditions (latest, earliest, etc.). I know this is another round of computations, but I think would look pretty cool and concise.

     

    Many thanks again. Happy to share the final solution with the community if needed.

     

    Dorian

     

  • dorianps Profile Picture
    31 on at

    Actually I don't even need to the "Created" at all. All I need is Name, Last Modified, Number of Versions. 🙂

  • dorianps Profile Picture
    31 on at

    It took me some time with, perhaps, a contorted suboptimal approach, but managed to achieve what I need, which looks like this.

     

    Capture.PNG

     

    Might share the solution later.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 426

#2
11manish Profile Picture

11manish 349 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard