> Markdown versions of all pages of this connector library are available by appending `.md` to the page URL. For the full index of connectors, see [llms.txt](https://connectors.appmixer.com/llms.txt).

# Find Files or Folders

- Component: `appmixer.microsoft.sharepoint.FindFilesOrFolders`
- Kind: Action
- Version: 1.0.1
- Visibility: Public
- Connector: [appmixer.microsoft.sharepoint 3.1.0](https://connectors.appmixer.com/connector/appmixer.microsoft.sharepoint/3.1.0.md)
- Component page: <https://connectors.appmixer.com/connector/appmixer.microsoft.sharepoint/3.1.0/component/appmixer.microsoft.sharepoint.FindFilesOrFolders>

Find files or folders recursively in Microsoft SharePoint using query.

## Input ports

### Port `in`

| Field | Type | Description |
| --- | --- | --- |
| Query (`q`) | text | The query text used to search for items. Values may be matched across several fields including filename, metadata, and file content. |
| Site ID (`siteId`) | text | Provide a site ID. |
| Drive ID (`driveId`) | text | ID of the drive where the file is located. |
| Parent Path (`parentPath`) | text | Specify the path of the parent folder. Leave empty to use selected Drive as the parent. Example: `path/to/parent/folder`. |
| Output Type (`outputType`) | select | Choose whether you want to receive the result set as one complete list, or one item at a time or stream the items to a file. For large datasets, streaming the rows to a file is the most efficient method. |
| File Type (`fileTypesRestriction`) | multiselect | Restrict the results to specific item types. If no types are selected, ALL item types will be returned including folders. |

## Output ports

### Port `out`

Variables are loaded dynamically from `/component/appmixer/microsoft/sharepoint/ListFiles?outPort=out&ignoreAuth=true`.

### Port `notFound`

_No fields defined for this port._

## Full metadata (component.json)

```json
{
  "name": "appmixer.microsoft.sharepoint.FindFilesOrFolders",
  "label": "Find Files or Folders",
  "author": "Zbynek Pelunek <zbynek.pelunek@client.io>",
  "description": "Find files or folders recursively in Microsoft SharePoint using query.",
  "version": "1.0.1",
  "private": false,
  "auth": {
    "service": "appmixer:microsoft",
    "scope": [
      "Files.Read.All",
      "Sites.Read.All"
    ]
  },
  "inPorts": [
    {
      "name": "in",
      "schema": {
        "type": "object",
        "properties": {
          "driveId": {
            "type": "string"
          },
          "siteId": {
            "type": "string"
          },
          "parentPath": {
            "type": "string"
          },
          "outputType": {
            "type": "string"
          },
          "fileTypesRestriction": {
            "type": [
              "array",
              "string"
            ],
            "items": {
              "type": "string"
            }
          },
          "q": {
            "type": "string"
          }
        },
        "required": [
          "driveId"
        ]
      },
      "inspector": {
        "inputs": {
          "q": {
            "type": "text",
            "index": 1,
            "label": "Query",
            "tooltip": "The query text used to search for items. Values may be matched across several fields including filename, metadata, and file content."
          },
          "siteId": {
            "type": "text",
            "label": " Site ID",
            "index": 2,
            "tooltip": "Provide a site ID.",
            "source": {
              "url": "/component/appmixer/microsoft/sharepoint/ListSites?outPort=out",
              "data": {
                "transform": "./ListSites#sitesToSelectArray"
              }
            }
          },
          "driveId": {
            "type": "text",
            "index": 3,
            "label": "Drive ID",
            "tooltip": "ID of the drive where the file is located.",
            "source": {
              "url": "/component/appmixer/microsoft/sharepoint/ListDrives?outPort=out",
              "data": {
                "messages": {
                  "in/siteId": "inputs/in/siteId"
                },
                "transform": "./ListDrives#drivesToSelectArray"
              }
            }
          },
          "parentPath": {
            "type": "text",
            "index": 4,
            "label": "Parent Path",
            "tooltip": "Specify the path of the parent folder. Leave empty to use selected Drive as the parent. Example: <code>path/to/parent/folder</code>."
          },
          "outputType": {
            "type": "select",
            "label": "Output Type",
            "index": 6,
            "defaultValue": "object",
            "tooltip": "Choose whether you want to receive the result set as one complete list, or one item at a time or stream the items to a file. For large datasets, streaming the rows to a file is the most efficient method.",
            "options": [
              {
                "label": "First found",
                "value": "first"
              },
              {
                "label": "All at once",
                "value": "array"
              },
              {
                "label": "One at a time",
                "value": "object"
              },
              {
                "label": "Save To File",
                "value": "file"
              }
            ]
          },
          "fileTypesRestriction": {
            "type": "multiselect",
            "options": [
              {
                "content": "Images (any format, image/*)",
                "value": "image/"
              },
              {
                "content": "Videos (any format, video/*)",
                "value": "video/"
              },
              {
                "content": "Audio files (any format, audio/*)",
                "value": "audio/"
              },
              {
                "content": "Documents and text files (any format text/*)",
                "value": "text/"
              },
              {
                "content": "PDF files (application/pdf)",
                "value": "application/pdf"
              },
              {
                "content": "Word files (.docx)",
                "value": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
              },
              {
                "content": "Excel files (.xlsx)",
                "value": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
              }
            ],
            "defaultValue": [],
            "index": 11,
            "label": "File Type",
            "tooltip": "Restrict the results to specific item types. If no types are selected, ALL item types will be returned including folders."
          }
        }
      }
    }
  ],
  "outPorts": [
    {
      "name": "out",
      "source": {
        "url": "/component/appmixer/microsoft/sharepoint/ListFiles?outPort=out&ignoreAuth=true",
        "data": {
          "properties": {
            "generateOutputPortOptions": true
          },
          "messages": {
            "in/siteId": "inputs/in/siteId",
            "in/driveId": "dummy",
            "in/parentId": "inputs/in/parentId",
            "in/parentPath": "inputs/in/parentPath",
            "in/outputType": "inputs/in/outputType"
          }
        }
      }
    },
    {
      "name": "notFound"
    }
  ],
  "icon": "(data URI omitted)"
}
```
