Copied to clipboard

Flag this post as spam?

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


  • Javier Sierra 9 posts 29 karma points
    May 05, 2011 @ 06:57
    Javier Sierra
    0

    C# Publish not working properly

    Hello Everyone,

     

    I've run into an issue that I can't seem to resolve. It is probably something obvious but it's been driving me crazy. I'm running umbraco v 4.5.2 (Assembly version: 1.0.3891.20719)

     

    I have the following code as a callback in a project: 

     

     

    if (Member.IsLoggedOn())
                {
                    string name = Member.GetCurrentMember().Text;
                    int id = Member.GetCurrentMember().Id;
                    Document assistance = Document.MakeNew(name, DocumentType.GetByAlias("asistente"), new User(0), folder.Id);
                    assistance.getProperty("arrival_date").Value = arrival_date.Text;
                    assistance.getProperty("arrival_time").Value = arrival_time.Text;
                    assistance.getProperty("arrival_airline").Value = arrival_airline.Text;
                    assistance.getProperty("arrival_flight").Value = arrival_flight.Text;
                    assistance.getProperty("travel_origen").Value = travel_origen.Text;
                    assistance.getProperty("departure_date").Value = departure_date.Text;
                    assistance.getProperty("departure_time").Value = departure_time.Text;
                    assistance.getProperty("departure_airline").Value = departure_airline.Text;
                    assistance.getProperty("arrival_date").Value = arrival_date.Text;
                    assistance.getProperty("departure_flight").Value = departure_flight.Text;
                    assistance.getProperty("travel_destination").Value = travel_destination.Text;
                    assistance.getProperty("hotel").Value = hotel.Text;
                    assistance.getProperty("special_meals").Value = special_meals.Text;
                    assistance.getProperty("activities").Value = activities.Text;
                    assistance.getProperty("id_member").Value = id;
                    assistance.getProperty("id_event").Value = NodeIdField.Value;
                    assistance.Publish(new User(0));
                }

    Up until this point everything workd perfect, and the node is created, however when I go to check the actual node in the backend I can see the node is published but when I click it to see the details the results show me that no URL was created for the node

     

    Publication Status
    Last published: 05/05/2011   
    Last edited
    05/05/2011 00:08
    Publish at
    No date chosen
    Remove at
    No date chosen
    -
    Link to document

     

    Is there something in my code that's preventing the actual publishing? There are no event or other actions attached to this particular node. Also this issue has happened to me in different instals. 

     

    These are the entries related to this particular node found in the umbraco log, there are not errors reported in this table.

    2249012485/5/2011 12:08:05 AMNew 
    2250012485/5/2011 12:08:05 AMPublish
    2252312485/5/2011 12:08:16 AMOpen 

    I really appreciate any help.

    Thanks in advance for your time and assistance. 

    Best Regards

     

    Javier Sierra

     

     

     

  • Eran Meir 401 posts 543 karma points
    May 05, 2011 @ 08:29
    Eran Meir
    0

    try republishing entire site, you have the option by right clicking the "content" node and there "republish entire site" and let us know if the problem returns

  • Javier Sierra 9 posts 29 karma points
    May 05, 2011 @ 13:54
    Javier Sierra
    0

    Hi Eran, 

    Thanks for you prompt response! Republishing the entire site does bring the URL into the node. Does this mean that I should republish the entire site every time I create a new node? Or is there a way to just update the cache for the one node? 

     

    Thanks for your help.

     

    Best Regards

  • Eran Meir 401 posts 543 karma points
    May 05, 2011 @ 14:00
    Eran Meir
    0

    does it still happen after you republish at the first time?

  • Javier Sierra 9 posts 29 karma points
    May 05, 2011 @ 14:03
    Javier Sierra
    0

    Yes, if a create a new node using this control the same issue occurs until I republish the entire site or click on the save and publish icon in the back office

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    May 05, 2011 @ 14:06
    Bo Damgaard Mortensen
    0

    Javier,

    Try this when publishing new documents:

    assistance.Save();
    assistance.Publish(new User(0));
    umbraco.library.UpdateDocumentCache(assistance.Id);

    See if that works for you.

  • Javier Sierra 9 posts 29 karma points
    May 05, 2011 @ 14:29
    Javier Sierra
    0

    Hello Bo, 

     

    I seem to be having some issues referencing umbraco.library from my project in VS 2010 (it doesn't seem to be recognized). I have umbraco.dll included as a reference as well as cms.dll, bussinesslogic.dll, controls.dll and interfaces.dll. Am I missing something? My project was created as a web application  

    Also I found this code on the forums,

                    assistance.Publish(new User(0));
                    XmlDocument xml = new XmlDocument();
                    assistance.XmlGenerate(xml);
    
    I think it is supposed to have the same effect, is this the case?
    Thanks again for your help

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    May 05, 2011 @ 14:46
    Bo Damgaard Mortensen
    0

    Hi Javier,

    I don't know for sure if the XmlGenerate method would do the same as UpdateDocumentCache() to be honest. But I find it very strange that you can't access the library class in the Umbraco namespace if you have referenced the correct dll's? You sould be good to with the umbraco.dll reference in your project!

    When I'm making a new ASP.NET website for creating my UserControls I just add a reference to umbraco.dll, cms.dll and businesslogic.dll from a fresh Umbraco download corresponding to the .NET/Umbraco version of the site I'm building.

    Maybe you should try to make a new ASP.NET website and reference it again? It sounds really strange to me.. :-)

  • Javier Sierra 9 posts 29 karma points
    May 05, 2011 @ 16:20
    Javier Sierra
    0

    Hi, 

    I finally got it to work. Following  Bo's advice seems to fix the issue. As to why the umbraco.library wasn't being recognized it seems I was using dll compiled for asp.net 4.0 and the project was set to run in 3.5. When I changes the dll to ones I knew that were working under 3.5 umbraco,library started showing up. 

     

    Thanks for everyone's help.

     

    Best Regards

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    May 05, 2011 @ 16:36
    Bo Damgaard Mortensen
    0

    Beautiful! :) Remember to mark the topic as answered for future references.

    All the best,

    Bo

Please Sign in or register to post replies

Write your reply to:

Draft