dangerous.beans
dangerous.beans

Reputation: 598

Firefox Add-on: Get the item id of an existing bookmark folder by foldername

I'm trying to make my add-on save bookmarks in it's own bookmark folder.

This function created the desired folder, but I want it to return the id of the existing folder instead of forever making millions of new ones if it can find it by name:

function special_bookmark_folder()
{
  menuFolder = bmsvc_service().bookmarksMenuFolder;

  // <Try and find the bookmark folder here!>

  return bmsvc_service().createFolder(menuFolder, ":: Bookmarkr ::", bmsvc_service().DEFAULT_INDEX);
  // else return id of existing folder if it's found here
}

Upvotes: 0

Views: 197

Answers (1)

paa
paa

Reputation: 5054

You have to use the Places query APIs, which isn't the most straightforward task. Thankfully there is an example with exactly what you want

Upvotes: 1

Related Questions