I cannot get getVariableCollectionById to work for a team library collection.
I have tried to get the variable collection, for a team library, using the collectionId as follows:
// get available library collections
var collections = await figma.teamLibrary.getAvailableLibraryVariableCollectionsAsync();
console.log(collections);
// get first library collection
var collection = collections[0];
console.log(collection);
// get collection id
var collectionId = collection.key;
console.log(collectionId);
// get same collection using collectionId
var collectionById = figma.variables.getVariableCollectionById(collectionId);
console.log(collectionById);
Why does the console output show that getting the collection using the collection id returns null? Note that the collection was returned successfully, the collectionId obtained successfully via the collection key, but null is returned when trying to use that collectionId to get the variable collection by id with Figma.variables.getVariableCollectionById(collectionId).
So, how to do the following?
Get team library variable collection using Figma.variables.getVariableCollectionById or other means
Get modes of that team library variable collection