Copied to clipboard

Flag this post as spam?

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


  • jacob phillips 130 posts 372 karma points
    Feb 07, 2013 @ 03:21
    jacob phillips
    0

    Automate Document Creation

    Umbraco Version: 4.0.4.2; SQL Server: 2005; WINS: 2003; .NET Framework 3.5

    I just created a custom datatype using the user control wrapper as in the video.

    My custom data type is used to create a specific type of document for each day of the month, in a given month.

    The document for each day, needs to be published at least by 12:00 a.m. of the current day (before is ok).

    The custom data type I created basically asks the user to pick a month from a drop down list. That choice is then used to create a months worth of umbraco documents (web-pages, nodes, whatever they are called, etc. using Document.MakeNew()) for the current year. Kind of janky. These created documents use a template containing user-control macros that do database calls and display data that is particular to each day of the month.

    The purpose of creating the custom data type is to alleviate the task of having to create a document (web page) by hand each day.

    While it takes a while to publish all the documents, it does eventually complete. I don't like it though. I'm worried that because of the long amount of time (5 minutes or so) to create the months worth of documents, that something could fail.

    So, what I would LIKE to do, is create a scheduled task that creates a specific type of document at midnight every day. This way, only one document is being created and the likely hood of failure is less. What would be the best way to do this? Could I just write a console app that references umbraco.dll, , businesslogic.dll and cms.dll, drop the .exe in a secure directory and run it every night as a scheduled task?  Will that work? Or is there some better (or simpler) way.  So far I've only used the umbraco classes to execute code that run in the Umbraco back office.

     

  • Jeroen Breuer 4861 posts 12139 karma points MVP 3x admin c-trib
    Feb 07, 2013 @ 12:55
  • jacob phillips 130 posts 372 karma points
    Feb 08, 2013 @ 00:29
    jacob phillips
    0

    Does the date folders package have a scheduler that allows automatic document creation I'm not seeing? I need to have documents created automatically without direct user interaction (that's my wish anyways.) If there is already a package that does this, great. From the link in my post, I see how to create documents programtically, but it is a user that logs into the Umbraco back office and causes this to happen. I want it to happen automatically, at say, midnight every day. Maybe I'm think too hard on this and I can just create a Visual Studio project add the cms.dll, umbraco.dll (and others?) build a console application and execute that via a scheduled task....but I don't think that will work.

  • Asif Malik 203 posts 339 karma points
    Feb 08, 2013 @ 13:52
    Asif Malik
    0

    Hi Jacob, you should be able to do this via a console app, but you should use the umbraco built in webservices to create/update your umbraco nodes. take a look at this post hoepfully it will help http://our.umbraco.org/forum/developers/api-questions/7561-How-to-write-webservice-for-umbraco ;

  • jacob phillips 130 posts 372 karma points
    Feb 08, 2013 @ 19:11
    jacob phillips
    0

    Thank you for pointing me in the right direction.

  • jacob phillips 130 posts 372 karma points
    Feb 11, 2013 @ 22:59
    jacob phillips
    0

    I ended up using the Umbraco feature known as "Base" in conjunction with C#'s HttpWebRequest and HttpWebResponse classes.

    I wonder, how much of a concern is security here? Does the possibility exist that a search engine spider could crawl your site and find the base URL's?

    Is it enough to just put an entry in your robots.txt file to block crawling of the first part of the URL (e.g. /base/) and randomize the method names used in the restExtensions.config?

     

  • Asif Malik 203 posts 339 karma points
    Feb 12, 2013 @ 10:12
    Asif Malik
    0

    Hi Jacob, i have used the rest extensions, but only to retrieve data as i am also unsure of the secruity concerns surrounding it. Would be good to know the full facts.

Please Sign in or register to post replies

Write your reply to:

Draft