📎 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
New-TriliumAttachment- Upload a file as an attachment to a note and append a reference link or imageNew-TriliumNoteFile- Create a new note with binary file contentSet-TriliumAttachment- Update properties of an existing attachment (role, mime, title, position)Remove-TriliumAttachment- Delete a specific attachment by its ID
Content Retrieval
Get-TriliumAttachmentContent- Retrieve the binary content of an attachmentGet-TriliumAttachmentInfo- Get metadata and information about an attachmentGet-TriliumNoteAttachment- Get all attachments for a specific note by note ID
🚀 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