Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
dev:client_coding:javascript_api [2018/09/05 18:06] – [Managing citations and bibliographies] Add brackets for getNote() zuphilip | dev:client_coding:javascript_api [2018/09/08 17:16] – [API Methods] new subsubsection about creating a new collection zuphilip | ||
---|---|---|---|
Line 199: | Line 199: | ||
// or you can obtain an array of itemIDs instead: | // or you can obtain an array of itemIDs instead: | ||
var itemids = collection.getChildItems(true); | var itemids = collection.getChildItems(true); | ||
+ | </ | ||
+ | |||
+ | === Create a New Collection in a function === | ||
+ | |||
+ | <code javascript> | ||
+ | async function createCollection(name) { | ||
+ | let collection = new Zotero.Collection(); | ||
+ | collection.name = name; | ||
+ | var collectionID = await collection.saveTx(); | ||
+ | return collectionID; | ||
+ | } | ||
</ | </ | ||