Copied to clipboard

Flag this post as spam?

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


  • Calvin Frei 106 posts 314 karma points
    Oct 22, 2009 @ 16:52
    Calvin Frei
    1

    How to move the document types

    Hello everbody, i need your help!

    I have a lot of document types. Here is an example:

    - contact
    - frontpage
    - textpage
    - main:google,meta
       + Login
       + Statement
    - ...
    - ...

    (the + are childs from the main!)

    How I can move the document types contact, frontpage, ... to main:google,meta? All Document Types have Tags... unfortunately the same Tags such as main:google, meta and i don't want lose them!

    Thanks for your help :-).

  • Folkert 82 posts 212 karma points
    Oct 22, 2009 @ 16:57
    Folkert
    0

    You can just move a document, right mouse > move and select the new parent. Of if you've got many documents to move, use the api:

    Document oldParent = new Document(oldparentNode);
    Document newParent = new Document(newparentNode);
    foreach (Document doc in oldParent.Children)
    {
       doc.Move(newParent.Id);
       doc.Save();
       doc.Publish(new User(0));
       umbraco.library.UpdateDocumentCache(doc.Id);
    }
  • Calvin Frei 106 posts 314 karma points
    Oct 22, 2009 @ 17:09
    Calvin Frei
    0

    "move a document, right mouse > move and select the new parent" this function does not exist

  • Jan Skovgaard 11264 posts 23592 karma points MVP 8x admin c-trib
    Oct 22, 2009 @ 17:23
    Jan Skovgaard
    0

    Hi Calvin

    I guess you could use "Copy", which may not be ideal. But I think that is the best option.

    there are two things you should pay attention to when using copy.

    1: You must delete the document types manually when they have been copied

    2: All inherited sections must be deleted in the "Tabs" section manually, since there is a little bug when copying document types, that inherits from at master document type. Then the inherited properties are actually being placed on the copied document type.

    I am thinking that it's probably also possible to move things around directly in the database. But I have no experience in with that so I can't guide you on that. Maybe someone else can.

    Hope that it all makes sense and do remember to make a backup before you start moving things around.

    /Jan

  • Folkert 82 posts 212 karma points
    Oct 22, 2009 @ 17:26
    Folkert
    0

    In the content section, select a node in the tree, right click on the node and select 'move', select new parent.

  • Jan Skovgaard 11264 posts 23592 karma points MVP 8x admin c-trib
    Oct 22, 2009 @ 17:28
    Jan Skovgaard
    0

    Hi Folkert

    I think Calvin is trying to move the document types around in the settings section. Not in the content section :)

    /Jan

  • Masood Afzal 176 posts 522 karma points
    Oct 22, 2009 @ 17:48
    Masood Afzal
    2

    One option is to edit database table 'cmsContentType' and update masterContentType column to move to different document types. This is to change Master Document Type.

     

  • Calvin Frei 106 posts 314 karma points
    Oct 22, 2009 @ 17:51
    Calvin Frei
    0

    Yes i am trying to move the document types around in the settings section :-).

    Thanks Jan for your post, i try it tomorrow and going to write a feedback ;-).

    Calvin

  • Stefan Kip 1613 posts 4130 karma points c-trib
    Oct 29, 2009 @ 13:56
    Stefan Kip
    0

    I'd like to do the same, tried to update the masterContentType column, but if you're going to edit the content of that content-type, you'll get a NullReferenceException:

    [NullReferenceException: Object reference not set to an instance of an object.]
    umbraco.controls.ContentControl.addControlNew(Property p, TabPage tp, String Caption) +106
    umbraco.controls.ContentControl..ctor(Content c, publishModes CanPublish, String Id) +1057
    umbraco.cms.presentation.editContent.OnInit(EventArgs e) +404
    System.Web.UI.Control.InitRecursive(Control namingContainer) +142
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1476

  • Richard Soeteman 3970 posts 12472 karma points MVP
    Oct 29, 2009 @ 14:01
    Richard Soeteman
    0

    Hi,

    I'm pretty sure my last blogpost will fix that issue. Haven't tested it, but it's related to the problem you are having. It's also not a solution, just a workaround.

    Cheers,

    Richard

  • Bram Loquet 72 posts 102 karma points
    Feb 08, 2010 @ 10:14
    Bram Loquet
    0

    depending on the amount of Document Types, Exporting en Importing them again would be an option

  • Bram Loquet 72 posts 102 karma points
    Feb 08, 2010 @ 10:15
    Bram Loquet
    0

    sorry, looks like it's not possible to select the Master Document Type when you import a Document Type

  • Chriztian Steinmeier 2737 posts 8401 karma points MVP 5x admin c-trib
    Feb 08, 2010 @ 12:47
    Chriztian Steinmeier
    1

    @Bram: The exported files are plain XML - If I'm not mistaken, you can specify the Master template in there - so if you export a type and edit the file, putting a <Master> element inside the existing <Info> element, you may be able to import it... (?)

    /Chriztian

  • Andrew Gale 1 post 21 karma points
    Jan 31, 2014 @ 17:32
    Andrew Gale
    0

    You can move a document type by updating the DB manually, but it's very easy to screw things up this way !!  so only attempt if you know what you're doing!!

    And definitely backup the DB beforehand!!

    Here's the sql to move NewsItem (ID 1077) to NewsGroup (ID 1148), so that NewsItem is a child of NewsGroup:

    update umbracoNode set parentid = 1148, level = 2, path = '-1,1148,1077',sortorder=0 where id = 1077

    Change sortorder to a higher number if there are existing child types in the target parent.

  • Amir 75 posts 224 karma points
    Mar 25, 2014 @ 10:24
    Amir
    0

    This might be a bit late, but could be helpful for anyone else has the same problem.

    If you want to change parent for a document type, you need to export the document type and open it in a text editor(notepad) and add a simple tag inside the info Tag and save and import it again.

    You need to add this tag <Master>YOUR PARENT DOCTYPE NAME</Master>

    i.e

    <?xml version="1.0" encoding="utf-8"?>
    <DocumentType>
      <Info>
        <Name>...............</Name>
        <Alias>..............</Alias>
        <Icon>settingCss.gif</Icon>
        <Thumbnail>folder.png</Thumbnail>
        <Description></Description>
        <AllowAtRoot>False</AllowAtRoot>
        <Master>YOUR PARENT DOCTYPE NAME</Master>
        <AllowedTemplates>
          <Template>.............</Template>
        </AllowedTemplates>
        <DefaultTemplate>...............</DefaultTemplate>
      </Info>

    .......

  • yauhen 5 posts 64 karma points
    Feb 12, 2015 @ 10:47
    yauhen
    0

    Hello,

    1. Is it possible to reimport xml without deleting previous version from settings? Because I have a lot of content pages created and do not want to lose thir reference to document type.
    2. Do I need to change only master? Because in my case I see composite tag also referencing to parent.
    3. Database solution (update umbracoNode set parentid = 1148, level = 2, path = '-1,1148,1077',sortorder=0 where id = 1077)- doesn't work. Yes it moves child node under another root note. But leaves all inherited properties from old parent. Which is not desired effect as you will have mix from both versions of hierarchy.
Please Sign in or register to post replies

Write your reply to:

Draft