How to access Zotero Items in a hierarchical manner?
ShreyJ1729 opened this issue · 1 comments
ShreyJ1729 commented
I'm building a private cloud for my zotero, and was wondering how to access the files in a hierarchical way?
E.x. looking at the following image, I'd like to have some sort of indication that the attachment "reddit post snapshot" is a child of the item "an incredible workflow".
To my knowledge Zotero.Items currently just gives a flattened list of items.
windingwind commented
- First get the parent item (an incredible...). Generally, we use
const item = Zotero.Items.get(id)
- Then use
const attachments = item.getAttachments()
.attachments
is an array of ids of the attachment items ([ID_OF_REDDIT_SNAPSHOT,]). - Get the snapshot item by id.
const snapShotItem = Zotero.Items.get(attachments)[0]
. If there are multiple attachments, you may want to filter by attachment type.