Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

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

  • v-qiuyu-msft's avatar
    v-qiuyu-msft
    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