Copied to clipboard

Flag this post as spam?

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


  • Tom 713 posts 954 karma points
    Feb 22, 2011 @ 06:07
    Tom
    0

    node.delete() tries to access file system???

    Hi Guys,

    I've created a command line based csv importer I'm going to run as a service so the user can upload files that have a parent node id.. the app will then nuke all the child nodes of that parent and replace them with a new bunch of nodes created from the data used as part of the csv..

     

    void DeleteItemsForCategory()
            {
                try
                {
                    Document parentNode = new Document(CurrentCategoryId);//use id of parent node 
                    foreach (Document child in parentNode.Children)
                    {
                        child.delete();
                        umbraco.library.UpdateDocumentCache(child.Id);
                    }
                    umbraco.library.RefreshContent();
                }
                catch (Exception ex)
                {
                    ExceptionReporter.ReportException(ex, "Exception Occurred Trying To Delete Items From Category");
                    throw ex;
                }
            }

    child.delete() is blowing up trying to access c:\bin\ ??

    any assistance would be most appreciated

    Cheers, Tom

  • Richard Soeteman 4047 posts 12900 karma points MVP 2x
    Feb 22, 2011 @ 06:21
    Richard Soeteman
    0

    Hi Tom,

    Think that's a bug. Please report it on CodePlex. Since you are importing CSV files Did you check out CMSImport? Think either the free or paid version can save you a lot of time.

    Cheers,

    Richard

  • Tom 713 posts 954 karma points
    Feb 22, 2011 @ 06:46
    Tom
    0

    Hi Richard,

    got out ye olde reflector and found out that because i was using a command line app the application hosting path is null..

    I am using the free version of cms import but in this instacne the user wants to periodically upload a bunch of csv files and we run a scheduled task!

    for any manual intervention I use cmsimport! which i love by the way :)

  • Richard Soeteman 4047 posts 12900 karma points MVP 2x
    Feb 22, 2011 @ 08:54
    Richard Soeteman
    1

    Hi Tom,

    Ah yes you need httpcontext, so you need a create a webservice for this.

    Not to turn this post into an advertisement for CMSImport Pro, but it can schedule imports for you. A customer of mine is using the same technique as you descibe. The end user uploads a file into Umbraco and a scheduled task imports that file. Scheduled import is described in the manual http://www.cmsimport.com/documentation.aspx 

    Cheers,

    Richard

     

  • Tom 713 posts 954 karma points
    Feb 23, 2011 @ 01:11
    Tom
    0

    Thanks Richard! :)

Please Sign in or register to post replies

Write your reply to:

Draft