Get item trending

Scenario

Get insights that include a list of documents trending around the user using a GET REST function and display the list in a list jig.

Resource links:

Required OAuth scope (least to most privilege):

Sites.Read.All Sites.ReadWrite.All

Insights - trending
Insights - trending

Examples and code snippets

General

index.jigx
name: ms-graph-demonstrator
title: MS Graph Demonstrator
description: A sample solution that uses the Microsoft Graph API. You can deploy and use this solution without any additional configuration.
category: business
tabs:
  Home:
    jigId: view-user-jigx
    icon: person
  Trends:
    jigId: items-trending
    icon: newspaper

Functions

MS Graph list trending function in GitHub.

get-calendar-list.jigx
provider: DATA_PROVIDER_REST
method: GET
url: https://graph.microsoft.com/v1.0/me/insights/trending
outputTransform: $.value
useLocalCall: true
parameters:
  accessToken:
    location: header
    required: true
    type: string
    value: microsoft.OAuth #Use manage.jigx.com to define credentials for your solution
  $top:
    type: string
    location: query
    required: false
    value: 100
continuation:
  when: =$.nextLink
  url: =$.nextLink
  parameters:
    accessToken:
      location: header
      required: true
      type: string
      value: microsoft.OAuth

Jigs

MS Graph list trending jigs in GitHub

title: Items Trending
type: jig.default

header:
  type: component.jig-header
  options:
    height: small
    children:
      type: component.image
      options:
        source:
          uri: https://www.windowslatest.com/wp-content/uploads/2018/12/Office-apps-new-icons.jpg

onRefresh:
  type: action.action-list
  options:
    actions:
      - type: action.sync-entities
        options:
          provider: DATA_PROVIDER_REST
          entities:
            - entity: items-trending
              function: get-items-trending
              parameters:
                accessToken: microsoft.OAuth

datasources:
  mydata:
    type: datasource.sqlite
    options:
      provider: DATA_PROVIDER_LOCAL

      entities:
        - entity: items-trending

      query: SELECT id, '$.weight',
        json_extract(Data, '$.resourceReference.webUrl') as webUrl,
        json_extract(Data, '$.resourceVisualization.containerDisplayName') as containerDisplayName,
        json_extract(Data, '$.resourceVisualization.previewText') as previewText,
        json_extract(Data, '$.resourceVisualization.title') as title,
        json_extract(Data, '$.resourceVisualization.type') as type
        FROM [items-trending]
        order by '$.weight' desc

children:
  - type: component.list
    options:
      data: [email protected]
      maximumItemsToRender: =$count(@ctx.datasources.mydata)
      item:
        type: component.list-item
        options:
          title: [email protected]
          subtitle: |
            ="Relevance: " & $round((@ctx.current.item.weight * 100),2) & "%"
          description: [email protected]
          divider: solid
          leftElement:
            element: icon
            icon: gauge-dashboard
          label:
            title: [email protected]
          onPress:
            type: action.go-to
            options:
              linkTo: [email protected]='pdf'? 'view-trending-object-pdf':'view-trending-object'
              parameters:
                uri: [email protected]

widgets:
  trends:
    type: widget.group
    options:
      children:
        - type: widget.image
          options:
            isContentOverlaid: true
            bottom:
              type: component.titles
              options:
                align: center
                subtitle: =$count(@ctx.datasources.mydata) & " items trending around you."
            source:
              uri: https://www.windowslatest.com/wp-content/uploads/2018/12/Office-apps-new-icons.jpg
        - type: widget.list
          options:
            data: [email protected]
            item:
              type: component.list-item
              options:
                title: [email protected]
                subtitle: [email protected] & " document"
                description: [email protected]
                divider: solid
                onPress:
                  type: action.go-to
                  options:
                    linkTo: [email protected]='pdf'? 'view-trending-object-pdf':'view-trending-object'
                    parameters:
                      uri: [email protected]

Last updated

Was this helpful?