Appearance
Function: getEmailsFromFolder()
ts
function getEmailsFromFolder(client: Client, folderId: string): Promise<any>;Defined in: src/ms-graph/outlook.ts:188
Get emails from a specific mail folder.
Parameters
| Parameter | Type | Description |
|---|---|---|
client | Client | The Microsoft Graph client. |
folderId | string | The ID of the folder. |
Returns
Promise<any>
A list of emails from the folder.
Example
ts
const client = await getMsGraphClient(creds);
const folders = await getMailFolders(client);
const inbox = folders.find((f: any) => f.displayName === 'Inbox');
const emails = await getEmailsFromFolder(client, inbox.id);
console.log('Latest email:', emails[0].subject);