Copied to clipboard

Flag this post as spam?

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


  • cmwalolo 26 posts 26 karma points
    Oct 23, 2009 @ 16:13
    cmwalolo
    0

    BlogForUmbraco4 post publishing

    I'm trying to create a BlogPost from code and I have trouble with the tags. Even the value published is well shown on the blog, the tag value is not visible from the BlogPost Editor and it's deleted if I publish the post again.

     

    Here some piece of code. Is some one familiar with that ? or there is something to do with the Tag Type ? Thanks for any help.

     

     

     

     

     

     

     

     

     

     

     

     

     

    private void publish(long

    id)

    {

    Digipoint.AntArticMatters.DataLayer.

     

    GuestBook gb = new Digipoint.AntArticMatters.DataLayer.GuestBook

    ();

    gb.LoadByPrimaryKey(id);

     

    DocumentType type = DocumentType.GetByAlias("BlogPost"

    );

    umbraco.BusinessLogic.

     

    User u = umbraco.BusinessLogic.User

    .GetUser(0);

     

    string text = "From : " + gb.Name + " (" + gb.Location + ")"

    ;

     

    Document d = new Document

    (1111);

     

    Document newdoc = Document

    .MakeNew(text, type, u, 1111);

    newdoc.Save();

    newdoc.getProperty(

     

    "bodyText"

    ).Value = gb.Message;

    newdoc.getProperty(

     

    "tags").Value = "guestbook"

    ;

    newdoc.CreateDateTime =

     

    DateTime

    .Now;

    newdoc.Save();

    newdoc.Publish(u);

    umbraco.

     

    library

    .PublishSingleNode(newdoc.Id);

  • Chris Larson 48 posts 63 karma points
    Oct 23, 2009 @ 23:40
    Chris Larson
    0

    I believe that the "tags" datatype has to be comma seperated, even if there is only one tag in the list. Try something like:

    newdoc.getProperty("tags").value="guestbook,"

     

  • Daniel Lindstrom 454 posts 271 karma points
    Oct 30, 2009 @ 12:52
    Daniel Lindstrom
    0

    Experiencing the same or a similar problem on a client site. Tags on blog posts seemingly randomly disappear. Seems to be related to editing a previously published post.

    We do not create or edit any blog post programatically.

    Any ideas or suggestions?

    Thanks!

  • davelane 29 posts 73 karma points
    Oct 30, 2009 @ 14:25
    davelane
    0

    I've noticed that if I type a tag or two and then wait a second, a "dropdown" type of deal appears and I can select what is (hopefully) the list of tags I've typed.

    However, it never works properly and the full list of what I've typed rarely appears.  Either way, it's a start and so i recommend in the meantime you click on that and hope for the best...  Also, IE seems to be the most reliable browser for this (sadly).

    Looking forward to a better solution :)
    Dave

  • davelane 29 posts 73 karma points
    Oct 30, 2009 @ 14:26
    davelane
    0

    Also, you have to type all of the comma-separated tags at once.  if you type a new tag and click the "tag" button, all of the tags are replaced with that one.

Please Sign in or register to post replies

Write your reply to:

Draft