Copied to clipboard

Flag this post as spam?

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


  • Jason Espin 368 posts 1335 karma points
    Apr 28, 2014 @ 14:16
    Jason Espin
    0

    Deleting content based upon document type : Content Service

    Hi all,

    I've written a web service call that dynamically creates pages based upon the response from a web service every 60 seconds. The service I am using is a simple weather forecast service that gives a 7 day forecast of the weather in a specific region. All of the new content nodes are created using the following:

    var weather = cs.CreateContent("Weather Forecast " + forecast.Date, rootID, "weather");  // Where rootID is the homepage of the site
    

    As I'm ultimately going to adapt this web service call to only display one set of results (the most recent set) I wish to try and delete the content based upon the document type. Is this possible? From what I have seen here: http://our.umbraco.org/documentation/reference/Management-v6/Services/ContentService it is not but there must be a workaround so that I can bulk delete the old content created from the web service call and replace it with the most recent content.

    I thought doing something like this would be possible:

    cs.GetChildren(rootID).Where(x => x.DocumentTypeAlias == "weather" );
    

    But according to my Visual Studio this appears to be invalid.

    Any help would be greatly appreciated.

    /Jason

  • Jason Espin 368 posts 1335 karma points
    Apr 28, 2014 @ 14:50
    Jason Espin
    100

    cs.GetChildren(rootID).Where(x => x.ContentType.Alias == "weather" );

    This was what I needed.

Please Sign in or register to post replies

Write your reply to:

Draft