//native
/**
* Get Folder
* Get a mail folder by id or well-known name (`inbox`, `drafts`, `sentitems`, `deleteditems`, `archive`, `junkemail`), with its unread and total counts. Requires Mail.Read (covered by the default Mail.ReadWrite) (a shared mailbox needs Mail.Read.Shared, not a default).
*/
export async function main(
auth: RT.MsOutlook,
folder: string,
mailbox: string | undefined
) {
const base = `https://graph.microsoft.com/v1.0/${
mailbox != null && mailbox !== ""
? `users/${encodeURIComponent(mailbox)}`
: "me"
}`
const response = await fetch(
`${base}/mailFolders/${encodeURIComponent(folder)}`,
{
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/json",
},
}
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 2 hours ago
//native
/**
* Get Folder
* Get a mail folder by id or well-known name (`inbox`, `drafts`, `sentitems`, `deleteditems`, `archive`, `junkemail`), with its unread and total counts. Requires Mail.Read (covered by the default Mail.ReadWrite) (a shared mailbox needs Mail.Read.Shared, not a default).
*/
export async function main(
auth: RT.Outlook,
folder: string,
mailbox: string | undefined
) {
const base = `https://graph.microsoft.com/v1.0/${
mailbox != null && mailbox !== ""
? `users/${encodeURIComponent(mailbox)}`
: "me"
}`
const response = await fetch(
`${base}/mailFolders/${encodeURIComponent(folder)}`,
{
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/json",
},
}
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 11 hours ago
//native
/**
* Get Folder
* Get a mail folder by id or well-known name (`inbox`, `drafts`, `sentitems`, `deleteditems`, `archive`, `junkemail`), with its unread and total counts. Requires Mail.Read on the connection (Mail.Read.Shared for a shared mailbox).
*/
export async function main(
auth: RT.Outlook,
folder: string,
mailbox: string | undefined
) {
const base = `https://graph.microsoft.com/v1.0/${
mailbox != null && mailbox !== ""
? `users/${encodeURIComponent(mailbox)}`
: "me"
}`
const response = await fetch(
`${base}/mailFolders/${encodeURIComponent(folder)}`,
{
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/json",
},
}
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 11 hours ago