cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

Usage of the ETag

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





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Support Team
Community Support Team

Re: Usage of the ETag

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

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Super User
Super User

Re: Usage of the ETag

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





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





View solution in original post

7 REPLIES 7
Super User
Super User

Re: Usage of the ETag

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


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Super User
Super User

Re: Usage of the ETag

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





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





Community Support Team
Community Support Team

Re: Usage of the ETag

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

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Super User
Super User

Re: Usage of the ETag

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





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





Super User
Super User

Re: Usage of the ETag

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





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





Super User
Super User

Re: Usage of the ETag

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





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





Super User
Super User

Re: Usage of the ETag

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





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





View solution in original post

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 79 members 3,642 guests
Please welcome our newest community members: