Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Folkert 82 posts 212 karma points
    Oct 15, 2009 @ 10:22
    Folkert
    1

    Create tags with API

    Is it possible to insert tags via the API? I'm able to insert  the tags in the property, but how do I insert the tags in de table cmsTags? I can't find any function to accomplish this.

    The Doctype uses the Umbraco tags control, with autocomplete. Viewing the Umbraco.config, I can see the values inserted perfectly, but the checkboxlist field in the autocomplete is empty because there are records inserted into the cmsTags table.

  • Folkert 82 posts 212 karma points
    Oct 15, 2009 @ 10:34
    Folkert
    0

    I've managed to insert tags with:

    umbraco.editorControls.tags.library.AddTag(n.Name, "default");

    Does this function check for existing records?

  • Folkert 82 posts 212 karma points
    Oct 15, 2009 @ 10:36
    Folkert
    0

    Appearently not, I've to check with the GetAllTags method if the tag exists. Any other suggestions?

  • Harry Kakoulidis 17 posts 40 karma points
    Mar 05, 2011 @ 15:13
    Harry Kakoulidis
    0

    I am using Umbraco 4.7 and I am trying to insert tags using

    int id = umbraco.cms.businesslogic.Tags.AddTag("xxx","default")

    As stated you must check if the tag exists first. However I have the following problem when adding more than one tags: The first time AddTag executes, it correctly add the tag and I get an id to associate with the document. But in the loop, the second time it runs, the id returned is 0, and I know the tag does not exist. I am using 4.7. Any hint to this?

  • Harry Kakoulidis 17 posts 40 karma points
    Mar 05, 2011 @ 15:17
    Harry Kakoulidis
    0

    Also just test GetTagId - the same happens. The second time it runs it returns 0, even if the tag exists in the database.

Please Sign in or register to post replies

Write your reply to:

Draft