How to get the attachment path when a item is select?
item.getFilePath() works only when a item is selected. I am planning to write a function to delete the attachment when the item is removed when the zotfile is applied. Or is there a solution to remove the linked files when the items are removed? This is an old discussion that has not been active in a long time. Before commenting here, you should strongly consider starting a new discussion instead. If you think the content of this discussion is still relevant, you can link to it from your new discussion.
Upgrade Storage
getFilePath()only returns cached paths. Useawait item.getFilePathAsync()in general.It also works only when a attachment item is selected. I would like to seek a function work for a regular item.
It prompts me 'Error: getFilePathAsync() can only be called on attachment items' when a regular item is selected.
I used these codes:
var selectedItems = ZoteroPane.getSelectedItems();
var item = selectedItems[0];
return await item.getFilePathAsync()
And I would like to obtain the path of the fulltext such as 'E:\Jianguo\references\Bhat et al_2021_Emerging processing technologies for improved digestibility of muscle proteins.pdf' just as when an attachment item is selcted when using the codes:
var selectedItems = ZoteroPane.getSelectedItems();
var item = selectedItems[0];
return await item.getFilePathAsync()