Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Yammer Messages

Hi Team,is there a way to get all the yammer messages without using tyGraph content pack?. currently i am using yammer rest api to extract data but the api returns only 20 messges. can you please shed the light on this requirement as i trying from past 2 weeks by looping through pages using M editor but managed to extract no more than 20 unique messages.

2 REPLIES 2
v-qiuyu-msft
Community Support
Community Support

Hi @Anonymous,

 

You need to do some research about yammer rest api. Then you can follow v-shex-msft's suggestion: https://community.powerbi.com/t5/Desktop/How-to-perform-loop-in-M-Query-and-collate-result-of-the-same/td-p/464474. 

 

Also you can reference @ImkeF's suggestion here: 

 

let
Pagination = List.Skip(List.Generate( () => [Table =  #table({}, {{}}) ,Page = 1, Counter=0], // Start Value
   		each  Table.RowCount([Table])>0 or [Counter]=0, // Condition under which the next execution will happen
   		each [ WebCall = Json.Document(Web.Contents("https://api.capsulecrm.com/api/v2/parties?perPage=100&page="&Text.From([Page])&"",[Headers=[Authorization="Bearer WAWjGWU6Kbl4o9TeGMRw5i52+kvSiz9xfQe+vNTxlcjw61R7RZYa4HxvdT8TSlDG"]])), // retrieve results per call
     			Page = [Page]+1,
     			Counter = [Counter]+1,// internal counter
     			Table = Table.FromRecords(WebCall[parties]) // steps of your further query
                      ] 
   		,each [Table]
) ,1),
    #"Converted to Table" = Table.FromList(Pagination, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandTableColumn(#"Converted to Table", "Column1", {"id", "firstName", "lastName", "createdAt"}, {"id", "firstName", "lastName", "createdAt"}),
    #"Removed Duplicates" = Table.Distinct(#"Expanded Column1", {"id"}),
    #"Filtered Rows" = Table.SelectRows(#"Removed Duplicates", each [id] <> null)
in
    #"Filtered Rows"

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks qiuyu!. Yammer api is bit more complicated and the paginated query will fetch the duplicated records from pages. However there is a powershell script to get all messages from API using older_than parameter. it would be extremely beneficial if the same logic can be implemented using M in Power BI. Any suggestions or idea would be appreciated.

 

Yammer Developers API : Get Messages

https://developer.yammer.com/docs/messagesjson

 

PowerShell Script to get all Yammer Messages: 

http://www.nubo.eu/en/blog/2016/12/Get-All-Yammer-Messages-Through-Rest-API-With-PowerShell/

 

Thanks,

Arjun

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.