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\ ??
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.
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
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..
child.delete() is blowing up trying to access c:\bin\ ??
any assistance would be most appreciated
Cheers, Tom
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
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 :)
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
Thanks Richard! :)
is working on a reply...