https://github.com/cityssm/node-ms-graph-mail
Wrappers around the Microsoft Graph API to add response types to the Mail-related queries.
https://github.com/cityssm/node-ms-graph-mail
microsoft-exchange microsoft-graph microsoft-graph-api
Last synced: 12 days ago
JSON representation
Wrappers around the Microsoft Graph API to add response types to the Mail-related queries.
- Host: GitHub
- URL: https://github.com/cityssm/node-ms-graph-mail
- Owner: cityssm
- Created: 2026-04-20T17:49:16.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-04-29T17:20:54.000Z (about 2 months ago)
- Last Synced: 2026-04-29T19:17:53.653Z (about 2 months ago)
- Topics: microsoft-exchange, microsoft-graph, microsoft-graph-api
- Language: TypeScript
- Homepage:
- Size: 173 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Microsoft Graph Mail API
[](https://app.deepsource.com/gh/cityssm/node-ms-graph-mail/)
Wrappers around the Microsoft Graph API
to add response types to the Mail-related queries.
## Installation
```sh
npm install @cityssm/ms-graph-mail
```
## Usage
```javascript
import MsGraphMail, {
MsGraphMailMessageBuilder,
wellKnownFolderNames
} from '@cityssm/ms-graph-mail'
const api = new MsGraphMail({
tenantId: '00000000-0000-0000-0000-00000000000a',
clientId: '00000000-0000-0000-0000-00000000000b',
clientSecret: 'abcd...xyz',
targetUser: 'helpdesk@example.com'
})
const inboxMessages = await api.listMessages(wellKnownFolderNames.Inbox, {
top: 5,
select: ['id', 'subject', 'receivedDateTime', 'from', 'body'],
orderBy: ['receivedDateTime desc']
})
const messageToSend = new MsGraphMailMessageBuilder()
.withSubject('Ticket #000001')
.withBody('
Ticket Received
', 'html')
.appendToBody('Your ticket should be worked on shortly.
', 'html')
.addToRecipient('requestor@example.com')
.build()
await api.sendMessage(messageToSend)
```
## Functions
👍 It is recommended to use this package with Typescript to get usage hints.
### Folder Functions
```typescript
async function listMailFolders(
options?: MsGraphMailApiOptions
): Promise {}
async function getMailFolderByDisplayName(
displayName: string,
options?: Pick, 'select'>
): Promise {}
async function getArchiveFolder(
options?: Pick, 'select'>
): Promise {}
async function getInboxFolder(
options?: Pick, 'select'>
): Promise {}
async function getOutboxFolder(
options?: Pick, 'select'>
): Promise {}
async function getSentItemsFolder(
options?: Pick, 'select'>
): Promise {}
```
### Message Functions
```typescript
async function listMessages(
folderIdOrWellKnownFolderName: string,
options?: MsGraphMailApiOptions
): Promise {}
async function listMessageAttachments(
messageId: string,
options?: MsGraphMailApiOptions
): Promise {}
```
### Message Move Functions
```typescript
async function archiveMessage(messageId: string): Promise {}
async function moveMessage(
messageId: string,
destinationFolderIdOrWellKnownFolderName: string
): Promise {}
```
### Message Send Functions
```typescript
async function sendMessage(
message: MsGraphMailSendableMessage
): Promise {}
```
### Message Update Functions
```typescript
async function markMessageAsRead(messageId: string): Promise {}
```
## Related Projects
[**ShiftLog**](https://github.com/cityssm/shiftLog/)
A work management system with work order recording, shift activity logging,
and timesheet tracking.