Language

FilesAccessor Class

Definition

Accessor for the uploaded files on the current inbound activity, exposed as ctx.Files. Reads the files attached to the current inbound activity and exposes them as lazy IncomingFile handles.

"Files" is the uploaded-file view over the raw ctx.Activity.Attachments list. Uploaded files arrive as attachments where ContentType is file.download.info, carrying file metadata rather than the bytes themselves. The metadata names where the bytes live: a pre-authorized downloadUrl when the platform issues one, otherwise a contentUrl that locates the item so Graph can resolve it. This accessor maps each to an IncomingFile, and skips everything else in Attachments (adaptive cards, mentions, other non-file content) as well as malformed file entries, never throwing. For each file it returns, the original wire attachment (the metadata object, not the bytes) is retained on Raw. A malformed or non-file attachment is reachable only through the raw Activity.Attachments list.

This covers the file-upload path, not "any uploaded media". What matters is how the content arrived, not the file's MIME type, so file type is unrestricted (pdf, docx, png, etc.) as long as it was sent as an uploaded file. An image sent as a file appears here, but the same image pasted inline does not.

public sealed class FilesAccessor
type FilesAccessor = class
Public NotInheritable Class FilesAccessor
Inheritance
FilesAccessor

Methods

Name Description
FirstAsync(CancellationToken)

Convenience: the first attached file, or null when none. Sugar over ListAsync(CancellationToken)[0]; shares ListAsync(CancellationToken)'s resolution so it stays correct when later scopes hydrate through Graph.

ListAsync(CancellationToken)

The files attached to the current inbound activity. Async because later scopes hydrate through Graph; the personal path resolves synchronously from the activity but keeps the async signature so the shape never breaks.

Currently takes no filters and returns only uploaded files. The signature is reserved to grow options later so coverage can widen opt-in without a break; the default stays narrow.

Applies to