Skip to content

📎 Attachment Functions

This section covers PowerShell cmdlets for managing attachments in TriliumNext. Attachments allow you to associate files with your notes, whether as embedded images, downloadable files, or binary content.

Warning

All functions require authentication via Connect-TriliumAuth before use.


📋 Available Cmdlets

File Management

Content Retrieval


🚀 Quick Start

Upload an Image Attachment

# Upload an image and append it to a note
New-TriliumAttachment -OwnerId "abc123" -FilePath "C:\images\screenshot.png"

Create a File Note

# Create a new note containing a PDF file
New-TriliumNoteFile -ParentNoteId "abc123" -FilePath "C:\documents\manual.pdf"

Download Attachment Content

# Get attachment content and save to disk
$content = Get-TriliumAttachmentContent -AttachmentID "evnnmvHTCgIn"
[System.IO.File]::WriteAllBytes("C:\downloads\file.pdf", $content)

Update Attachment Properties

# Update the title and role of an attachment
Set-TriliumAttachment -AttachmentId "evnnmvHTCgIn" -Title "Updated Title" -Role "image"

List Note Attachments

# Get all attachments for a specific note
Get-TriliumNoteAttachment -NoteID "jfkls7klusi"

💡 Key Concepts

Attachment Types

  • Image attachments: Automatically embedded as images in notes
  • File attachments: Added as downloadable links
  • Binary content: Raw file data stored in notes

MIME Type Detection

Most cmdlets automatically detect MIME types from file extensions, but you can override this behavior:

New-TriliumAttachment -OwnerId "abc123" -FilePath "file.dat" -Mime "application/octet-stream"

Pipeline Support

Several cmdlets support pipeline input for batch operations:

"att1", "att2", "att3" | Remove-TriliumAttachment