# List files

Often there is a requirement to list files or get one specific file from OneDrive and then interact with that file(s), whether for viewing, updating, deleting, or even downloading. The file's details are pulled to the device using the local data provider, after which you can work with the file, showing it in a list.

<figure><img src="/files/ML6c94F25d2eOVhnkjtX" alt="List OneDrive files" width="188"><figcaption><p>List OneDrive files</p></figcaption></figure>

## Properties

The following properties are required in the YAML:

* `entity` - path in OneDrive
* `tokenType` - OAuth token credentials name

## Component

There are a number of elements that can be used to display the file(s), for example, `component.list`, `component.form` with a dropdown, or `jig.list`.

## Considerations

* Getting or listing files from OneDrive does not download the file it just displays the details of the file from the path (`entity`) specified
* All files in a OneDrive directory can be listed and some directories may have many files. Consider the amount of items you want returned when creating the query for the local data provider.
* A delay or time lag of several minutes could be experienced when files are syncing between the device and OneDrive

## Code Example

The code example below provides an example of a list of invoices in the `myfiles` directory of OneDrive.

{% code title="list-files.jigx" fullWidth="false" %}

```yaml
title: List Monthly Invoices
description: List all monthly invoices
type: jig.list
icon: contact

header:
  type: component.jig-header
  options:
    height: medium
    children:
      type: component.image
      options:
        source:
          uri: https://builder.jigx.com/assets/images/header.jpg

# Connection to OneDrive files in myfiles directory
onFocus:
  type: action.sync-entities
  options:
    provider: DATA_PROVIDER_ONEDRIVE
    entities:
      - entity: myfiles
        data:
          tokenType: jigx.graph.oauth
# Hold the OneDrive file details on local device
datasources:
  file-data-myfiles:
    type: datasource.sqlite
    options:
      provider: DATA_PROVIDER_LOCAL
      entities:
        - myfiles
      query: SELECT id, '$.name' as name FROM [myfiles] ORDER BY '$.name' DESC

data: =@ctx.datasources.file-data-myfiles
item:
  type: component.list-item
  options:
    leftElement:
      element: avatar
      text: OD
    title: =@ctx.current.item.name

actions:
  - children:
      - type: action.go-back
        options:
          title: previous
```

{% endcode %}

### See also

* [Microsoft OneDrive](https://docs.jigx.com/building-apps-with-jigx/data/data-providers/microsoft-onedrive)
* [Create a file](/examples/readme/data-providers/microsoft-onedrive/create-a-file.md)
* [Update/Save a file](/examples/readme/data-providers/microsoft-onedrive/update_save-a-file.md)
* [Delete a file](/examples/readme/data-providers/microsoft-onedrive/delete-a-file.md)
* [Download a file](/examples/readme/data-providers/microsoft-onedrive/download-a-file.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.jigx.com/examples/readme/data-providers/microsoft-onedrive/list-files.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
