cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tono_Analyst2
Helper I
Helper I

Pulling a link from the body of a Yammer post

Hi,

 

There is a Yammer post created each week with a web link in the body. What would be the best way to pull this link to parse it in a following step.

 

Thanks

4 REPLIES 4
Expiscornovus
Dual Super User
Dual Super User

Hi @Tono_Analyst2,

 

When it is an attachment to the yammer post you could a HTTP request to retrieve the file and recreate it as a file in SharePoint, so you easily reuse it in a News Post.

 

Below is an example of that approach.

 

1. The HTTP action uses the web_url of the first attachment and tries to retrieve the content.

 

triggerOutputs()?['body/attachments'][0]['web_url']

 

2. The Create File uses the body of the response of the HTTP action. I also use the expression below to reuse the same file name.

 

Interestingly enough I didn't see a property for that in the json so I had to use an expression to refactor it 😅

substring(triggerOutputs()?['body/attachments'][0]['web_url'], add(lastIndexOf(triggerOutputs()?['body/attachments'][0]['web_url'], '/'),1), sub(length(triggerOutputs()?['body/attachments'][0]['web_url']),add(lastIndexOf(triggerOutputs()?['body/attachments'][0]['web_url'], '/'),1)))

 

attachment_yammermessage.png

Hi again @Expiscornovus 🙂 

 

Unfortunately, I cannot use premium connectors with my licensing (sorry - I should have mentioned this).

 

Is there another solution that you know of by any chance? If it helps the structure of the post would look something like.

____________________________________________________________________________________________________

Yammmer Post Title abc

 

Link https://.....

 

Maybe more words at the end.... 

____________________________________________________________________________________________________

Tono_Analyst2
Helper I
Helper I

I have managed to publish a random image using the image link as follows. 

Tono_Analyst2_0-1642990459941.png

 

However, I am still stuck on how to extract the image url from the yammer post.

 

Expiscornovus
Dual Super User
Dual Super User

Hi @Tono_Analyst2,

 

In your setup you could probably use the parsed body and use a couple of split functions in an expression to retrieve the hyperlink.

 

Below is an example expression:

if(not(equals(indexOf(triggerOutputs()?['body/body/parsed'], 'https://'), -1)), concat('https://', split(split(triggerOutputs()?['body/body/parsed'], 'https://')[1], decodeUriComponent('%0A'))[0]), null)

 

Btw, as far as I am aware the Reposts endpoint is to create News Links and not News Posts. That is a different approach, and a News Link is a bit more limited with what you can set. However, if you are happy with that we can obviously stick with News Links instead 😁

 

newslink_sharepoint.png

 

The reason why I had to recreate the file for a News Post was I couldn't use an external file link in the Banner of a News Post. That was why I was downloading and creating it 😁

 

ownorganization.png

 

 

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,535)