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 Automate
Answered

Usage of the ETag

(0) ShareShare
ReportReport
Posted on by 1,430

Hey all,

 

 

In my Flow at one point I want to send a link that opens a generated word document in Microsoft Teams in View mode.

I found a way to open it but everytime the document opens I get an error.

 

 

So I need a link like this, with the ETag in Bold:

https://teams.microsoft.com/_#/docx/viewer/teams/https:~2F~2F<tenant>.sharepoint.com~2Fsites~2F<TeamName>~2FDocuments~2F<FolderName>~2F<FileName>.docx?threadId=19:<Channelid>@thread.skype&baseUrl=https:~2F~2F<tenant>.sharepoint.com~2Fsites~2F<SiteName>&fileId=285CAB80-E9E9-441E-822C-3A486EDFA7F4&ctx=files&viewerAction=view

So I retrieve the ETag from the previous step that contains the creation of a document.

But when my flow runs the ETag is returned this way in the link:

"{A6994BF5-8008-46C0-8BA4-970435CD2AD3},1"

So now my question is how can I get rid of the quotes and brackets so I only have the ETag numbers between the brackets.

If this can be solved my Flow would be finished finally.

 

Thanks in advance.

 

Kind regards

 

 

Tom

Categories:
I have the same question (0)
  • faustocapellanj Profile Picture
    1,662 on at

    Hi @Tom_Slosse,

     

    I haven't worked with files in Teams and I'm curious as to how you get the ETag from the file. Do you mind posting a screenshot of your Flow configuration? I'd like to see how this is retrieved.

     

    Thanks,

    Fausto Capellan, Jr

  • Tom_Slosse Profile Picture
    1,430 on at

    Hey @faustocapellanj

     

     

    You get these properties if you use the action Create file (SharePoint). Then you can use the ETag and other properties in the steps below.

     

    Create_File_Flow.PNG

     

    So I create a Word document in the SharePoint library of the Team

     

    Then I want to email this link to some people, so they directly have the Word document in front of them in Teams.

    So the link is something like this:

    https://teams.microsoft.com/_#/docx/viewer/teams/https:~2F~<tenantName>.sharepoint.com~2Fsites~2F['DisplayName']~2FGedeelde%20%20documenten~2['Id']~2F<DocumentName>['DisplayName'].docx?threadid=19:['Id']%40thread.skype&baseUrl=https:~2F~<tenantName>.sharepoint.com~2Fsites=2F<ListName>&fileId=['ETag']&ctx=files&viewerAction=view

    The bold sections are dynamic content.

    The first DisplayName is from the Created file.

    The first Id is the Channel Id from Teams.

    The second DisplayName is the Channel name.

    The second Id is again the Channel Id from Teams.

    And then the ETag from the Created file.

     

    Thats how I files are represented in view mode in Teams.

     

    Kind regards

     

     

    Tom

  • Verified answer
    v-xida-msft Profile Picture
    on at

    Hi @Tom_Slosse,

     

    Could you please share a screenshot of your flow’s configuration?

    How do you get the link on your side?

     

    I suppose that you use concat() function to include ETag number into the link within your flow, is it true?

    If you want to get the ETag numbers between the brackets, please take a try with the following workaround:

    • Add a “When a file is created (metadata only)” trigger of OneDrive for Business connector.
    • Add a Compose action, Inputs set to following formula:

     

    add(indexOf(triggerBody()?['ETag'],'{'),1)

     

    • Add a Compose 2 action, Inputs set to following formula:

     

    indexOf(triggerBody()?['ETag'],'}')

     

    • Add a Compose 3 action, Inputs set to following formula:

     

    sub(outputs('Compose_2'),outputs('Compose'))

     

    • Add a Compose 4 action, Inputs set to following formula:

     

    substring(triggerBody()?['ETag'],outputs('Compose'),outputs('Compose_3'))

     

    Image reference:14.JPG

     The flow works successfully as below:15.JPG

     

    The you could use Concat() expression to include the ETag number into the link:17.JPG

    Inputs field set to following formula:

     

    concat('https://teams.microsoft.com/_#/docx/viewer/teams/https:~2F~2F<tenant>.sharepoint.com~2Fsites~2F<TeamName>~2FDocuments~2F<FolderName>~2F<FileName>.docx?threadId=19:<Channelid>@thread.skype&baseUrl=https:~2F~2F<tenant>.sharepoint.com~2Fsites~2F<SiteName>&fileId=',outputs('Compose_4'),'&ctx=files&viewerAction=view')

     16.JPG

     

     

    Best regards,

    Kris

  • Tom_Slosse Profile Picture
    1,430 on at

    Hey @v-xida-msft

     

     

    Thanks for the interesting answer!

     

    My Flow goes as following:

    Flow_CBS.PNG

     

    So first I create a Channel in a Team, then post a message in it.

    Then I create a file in that created channel. And then I send a mail with the links to the Channel, the SharePoint item and the link to the Word document in view mode in the Channel (well thats what I'm trying anyway).

     

    So the link looks like this in the body of the email. Also the Id after 19: should be replaced with the Id of the Channel, so I'm aware of that.

    doc_team_link.PNG

    Hopefully that gives you some more insights.

     

    Kind regards

     

     

    Tom

  • Tom_Slosse Profile Picture
    1,430 on at

    Hey @v-xida-msft,

     

     

     

    So I tried to receive the metadata with Get file metadata action.

    But everytime it fails because apparently the resource has been removed, had its name changed, or is temporarily unavailable.

    Which is weird because I just created the file in the previous step.

     

    Do you know any solution about this?

     

    Kind regards

     

     

    Tom

  • Tom_Slosse Profile Picture
    1,430 on at

    Hey all,

     

     

    So my experience with the problem I ran into is that the action Get file metadata doesn't work after its configured after an action.

    So whats the point of this action if it only works after a trigger. Sometimes you need to get the metadata deeper in your Flow to perform other actions with it.

     

    Kind regards 

     

     

    Tom

  • Verified answer
    Tom_Slosse Profile Picture
    1,430 on at

    Hey all,

     

     

    Thanks to the post of @v-xida-msft I've managed to solve my problem.

    The structure xida provided is perfect. The only thing I had to change is the triggerbody and fill it in with dynamic content from the previous step. Also couldnt use the step to get the metadata so that one isnt needed at all, in my case. 

     

    WorkingFlowWithETag.PNGTriggerBodyReplacement.PNG

    Kind regards

     

     

    Tom

  • Verified answer
    mvtools Profile Picture
    9 on at

    We recently faced this issue. This for this post to guide us but we found very simple solution to get ID from Etag. Hope that save someone time: 

    Expression: first(split(replace(variables('ETag'),'"',''),','))

  • AM-MIN Profile Picture
    11 on at

    Hi, 

     

    If I use "when a new response is submitted" instead of "when a file is created (Metadata only)"

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 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard