Skip to content

Create a component to make any Microsoft Graph query #160

@nmetulev

Description

@nmetulev

Proposal: Create a component to make any Microsoft Graph query

Description

The toolkit should have a component that can make any query to the Microsoft Graph and allow a developer to render the results through a developer defined template. The component does not need to have a default view.

Rationale

There are scenarios where a developer needs to make Microsoft Graph calls that are not covered by the existing components. In this cases, a developer is required to make the call in code behind and render the html in their favorite way.

A developer might also want to make additional network calls inside of a template of an existing component. For example, this component can be used inside of the template of a person card to add additional information from the graph without having to make any graph calls in code behind.

Preferred Solution

<mgt-get resource="/me/messages" scopes="mail.read" version="beta" follow-next-link>
    <template>
        <div data-if="response.value">
            <ul>
                <li data-for="mail in response.value">
                    <div>{{mail.subject}}</div>
                </li>
            </ul>
        </div>
    <template>
    <template data-type="error">
        <!-- handle error -->
    </template>
    <template data-type="loading">
        <!-- handle loading -->
    </template>
</mgt-get>

Proposed Attributes

  • resource is the resource to get and the only required attribute
  • scopes is comma delimited scopes to use when getting the token
  • version to use when making the get request
  • follow-next-link to automatically follow the @odata.nextLink when making the request

Proposed Templates

  • default template will be used when the request is successful. The data context will contain:
{
    response: [Object] //object containing the response
}
  • error template will be used when there is an error making the request. The data context will contain:
{
    error: [Object] //object containing the error response
    code: [number] // http status code
}
  • loading template will be used when data is loading. No data context will be passed

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions