Copied to clipboard

Flag this post as spam?

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


  • Christo 23 posts 44 karma points
    Dec 06, 2010 @ 10:16
    Christo
    0

    API published Docs have no URL

    Hi there,

    I currently experience following problem:

    I generate via API new Documents ( via Document.MakeNew()) and publish it after that:

    doc.Publish(User.GetUser(0));

    umbraco.content.Instance.ClearDocumentCache(doc.Id);

    library.RefreshContent();

     

    The doc will then be displayed properly in the umbraco treenode under contents BUT it has no URL so it cannot be requested. What am I doing wrong? Any ideas?

     

    I appreciate any help

    Thanks

    Christo

     

    PS:I'm using Umbraco 4.5.2

    PPS:also tried 

    doc.XmlGenerate(new XmlDocument()); after publishing - no improvement

     

     

  • Rich Green 2246 posts 4008 karma points
    Dec 06, 2010 @ 10:19
    Rich Green
    0

    Hi,

    After this line

    doc.Publish(User.GetUser(0));

    add this 

    umbraco.library.UpdateDocumentCache(doc.Id);

    You do not need these lines

    //umbraco.content.Instance.ClearDocumentCache(doc.Id);
    
    //library.RefreshContent();
    
    //doc.XmlGenerate(new XmlDocument());

    Rich

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Dec 06, 2010 @ 10:23
    Hendy Racher
    1

    Hi Christo,

    Does the parent document have a valid url ? and instead of clearing the document cache and refreshing, does library.UpdateDocumentCache(doc.Id); have any effect ?

    Cheers,

    Hendy

  • Christo 23 posts 44 karma points
    Dec 06, 2010 @ 10:43
    Christo
    0

    @Hendry, the parent has a valid URL, yes

    @Rich:well, yes- I tried the plain code too. without success

  • Christo 23 posts 44 karma points
    Dec 06, 2010 @ 11:59
    Christo
    0

    Hi Rich, Handy,

    your suggestion did it:

     

    umbraco.library.UpdateDocumentCache(doc.Id);

     

    Thanks a lot!

Please Sign in or register to post replies

Write your reply to:

Draft