# Microsoft Purview

> Find the email and Teams chats a public records request asks for, and export them to SharePoint once IT approves.

App · 2 actions. Web page: https://docs.lodol.com/docs/integrations/microsoft-purview

## Actions

### Export to SharePoint

Export what a Find staff email and chats step found, and put it in a SharePoint folder for the clerk: one Outlook data file (.pst) per person, Teams chats as readable transcripts, and a list of every item. Put it after IT's approval. An export can take hours: the run waits without holding anything up, and carries on when the files are ready.

**Inputs**

- Search (`search`, text, required): The search from a Find staff email and chats step.
- SharePoint site (`site`, text, required): The site to save the export in, by its web address, such as https://yourcity.sharepoint.com/sites/Records.
- Folder (`folder_path`, text): The folder in the site's documents to save into, such as Records requests/2026. Each export gets a folder of its own inside it. Leave empty for Records requests, then the request's name.

**Outputs**

- `case_name` (text): The Purview case's name.
- `export_name` (text): The export's name in Purview.
- `file_count` (number): How many files were saved.
- `files` (list): Each file saved.
- `folder_path` (text): That folder, in the site's documents.
- `folder_url` (text): A link to the folder the files are in.
- `size` (text): Their size together.

**Example output**

```json
{
  "case_name": "Records request 2026-104",
  "export_name": "Lodol export, Staff email, 2026-01-01 to 2026-03-31, 3 people (ref 1a2b3c4d)",
  "file_count": 2,
  "files": [
    {
      "name": "Items.1.001.zip",
      "size": "1.2 GB",
      "url": "https://yourcity.sharepoint.com/sites/Records/Items.1.001.zip"
    },
    {
      "name": "Reports.zip",
      "size": "2.4 MB",
      "url": "https://yourcity.sharepoint.com/sites/Records/Reports.zip"
    }
  ],
  "folder_path": "Records requests/Records request 2026-104/Staff email, 2026-01-01 to 2026-03-31, 3 people (ref 1a2b3c4d)",
  "folder_url": "https://yourcity.sharepoint.com/sites/Records/Shared%20Documents/Records%20requests/Records%20request%202026-104",
  "size": "1.2 GB"
}
```

### Find staff email and chats

Search the email and Teams chats of the staff a records request names, for the dates it asks about, and count what matches. Nothing is read or moved yet: the step says how many items, how big, and from how many people, so IT can approve the search before Export to SharePoint runs it. The search is kept in a Microsoft Purview case named after the request.

**Inputs**

- Records request (`request_name`, text, required): What the request is called, such as Records request 2026-104. The case in Microsoft Purview gets this name, so IT can find it.
- Staff (`people`, list, required): The email address of each person whose email and Teams chats to search.
- From (`start_date`, date, required): The first day to search, as the request gives it.
- To (`end_date`, date, required): The last day to search, included.
- Words to look for (`keywords`, text): Words or phrases, one per line. Finds messages that contain any of them. Leave empty to find everything in the dates.

**Outputs**

- `case_name` (text): The Purview case's name.
- `end_date` (text): The last day.
- `items` (number): How many items match.
- `keywords` (list): The words looked for.
- `partly_readable_items` (number): Items Purview couldn't fully read, such as encrypted attachments. The export includes them.
- `partly_readable_size` (text): Their size.
- `people` (list): The people searched.
- `people_with_matches` (number): How many of the people have a match.
- `search` (text): The search, for Export to SharePoint.
- `size` (text): Their size, such as 1.3 GB.
- `size_bytes` (number): Their size in bytes.
- `start_date` (text): The first day.
- `summary` (text): One sentence for IT's approval.

**Example output**

```json
{
  "case_name": "Records request 2026-104",
  "end_date": "2026-03-31",
  "items": 412,
  "keywords": [
    "parking garage"
  ],
  "partly_readable_items": 12,
  "partly_readable_size": "48.2 MB",
  "people": [
    "jsmith@yourcity.gov",
    "alee@yourcity.gov",
    "mgarcia@yourcity.gov"
  ],
  "people_with_matches": 3,
  "search": "b0073e4e-4184-41c6-9eb7-8c8cc3e2288b/c61a5860-d634-4d14-aea7-d82b6f4eb7af",
  "size": "1.3 GB",
  "size_bytes": 1395864371,
  "start_date": "2026-01-01",
  "summary": "412 items (1.3 GB) from 3 of 3 people, sent or received January 1, 2026 to March 31, 2026, containing \"parking garage\". Plus 12 items Purview couldn't fully read, which the export includes."
}
```
