Copied to clipboard

Flag this post as spam?

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


  • Tom 161 posts 322 karma points
    Jan 16, 2015 @ 12:59
    Tom
    0

    How to use API to Populate a Content Type with lots of Data

    Hi:

    I'm new to Umbraco and I wish to polulate an Umbraco Document Type with lots of data programmatically.

    I have created a News Article content type which has the following fields.
    Title, Description,Date, Contact, Email Address, Comments (RTE).

    Is there a way (Ie.  VS 2013 Console application I think) to programmaticllay populate my new Content Type Table using the Umbraco API?  I have test data I wish to populate but need to know what api's to use.

     

    Thanks

     

    Tom

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 16, 2015 @ 13:01
    Jan Skovgaard
    1

    Hi Tom and welcome to our :)

    I'm not a .NET developer myself, but I think that you can benefit from having a look at the content service API here

    http://our.umbraco.org/documentation/Reference/Management-v6/Services/

    /Jan

  • Tom 161 posts 322 karma points
    Jan 16, 2015 @ 13:31
    Tom
    0

    Thanks.

     

    I'm still a newbee.  Do you knwo what dll to reference?

  • Tobias Klika 101 posts 570 karma points c-trib
    Jan 16, 2015 @ 13:32
    Tobias Klika
    1

    Hi!

    As Jan said, you can use the ContentService API for this purpose.
    If you are using the SurfaceController, there's a property Services which contains the ContentService.

    For your news example:
    Create an IContent instance with contentService.CreateContent(...) and assign the values with SetValue().

    When you are done you can save the new content with contentService.SaveAndPublishWithStatus(yourInstance, ...).

    PS. You will need at least references to Umbraco.Web and Umbraco.Core

  • Richard Soeteman 4045 posts 12898 karma points MVP 2x
    Jan 16, 2015 @ 13:36
    Richard Soeteman
    1

    Hi,

    You don't need to code to get all data in, you can also use CMSImport. Simply map from datasource to the document properties and press import. Free for 500 records more info can be found at http://soetemansoftware.nl/cmsimport

    Hope that can help also.

    Best,

    Richard

  • Tom 161 posts 322 karma points
    Jan 16, 2015 @ 13:38
    Tom
    0

    Thanks everyone.  You're all so very helpful.

Please Sign in or register to post replies

Write your reply to:

Draft