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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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