spacer
Skip to content

Graph Attachments

More information can be found in the official Graph documentation:

Attachments work with Calendar Events, Mail Message, and Conversation Thread Posts. The samples below are generic on purpose.

IAttachment, IAttachments

Invokable Banner Selective Imports Banner

Get Attachments

import { graphfi } from "@pnp/graph";
// Imports required for the object you're obtaining attachments for.
import "@pnp/graph/attachments";

const graph = graphfi(...);

const event_message_post = graph.xxx;
const a = await event_message_post.attachments();

Get Attachment By Id

import { graphfi } from "@pnp/graph";
// Imports required for the object you're obtaining attachments for.
import "@pnp/graph/attachments";

const graph = graphfi(...);

const event_message_post = graph.xxx;
const attachmentId = "";
const a = await event_message_post.attachments.getById(attachmentId)();