Copied to clipboard

Flag this post as spam?

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


  • Marcio Goularte 374 posts 1346 karma points
    Aug 13, 2017 @ 15:04
    Marcio Goularte
    0

    Create tag programmatically

    I'm trying to add tag to a group programmatically without using the SetTags method in Content. Analyzing the TagService does not exist in the API methods for this, only Get methods.

    https://our.umbraco.org/apidocs/csharp/api/Umbraco.Core.Services.TagService.html

    However by the old API this was possible.

    umbraco.cms.businesslogic.Tags.Tag.AddTag("Tag Name", "default");
    

    My intention is to add tags to repository without linking to a content.

    Is there any way other than legacy code?

    I question because soon this code will be removed in the next versions of Umbraco.

    tks

  • Marcio Goularte 374 posts 1346 karma points
    Aug 15, 2017 @ 12:03
    Marcio Goularte
    0

    Anyone?

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Aug 15, 2017 @ 12:10
    Dan Diplo
    100

    I don't know of any API. All I can think is you could directly use SQL (eg. PetaPoco) to write to the cmsTags table. Though obviously it isn't ideal. But if you wrote it as your own class you could at least swap out the implementation if it's ever added to Umbraco in future.

  • Marcio Goularte 374 posts 1346 karma points
    Aug 16, 2017 @ 18:23
    Marcio Goularte
    0

    tks Diplo!

Please Sign in or register to post replies

Write your reply to:

Draft