0

The 2013 TOM.NET API has a getter for reading the rootStructureGroup, but how can one set the default value for the rootStructureGroup after creating a new Publication?

  • And what problem have you met? Just create SG with specifying pub as parent for it. – Syav4eg Jun 23 '14 at 10:33
  • Ok, I understand it, I looked it up in the API docs... – Monday Jun 23 '14 at 10:45
2

Have you tried something like this?

    Publication currentPub = this.GetPublication();
    StructureGroup rootSG = (StructureGroup)engine.GetObject(currentPub.RootStructureGroup.Id);
    rootSG.Title = "my new title";
    rootSG.Save();

May need some slight tweaking to ensure the item is checked out / editable etc, but I don't see why this wouldn't work.

Quick Note: I'm using the TBB base project (http://sdltridionworld.com/community/extension_overview/templatingbase.aspx) in this example to get the publication object.

| improve this answer | |
  • Ok, thanks, I understand it; instead of creating a pub with an sg, one creates an sg with a pub – Monday Jun 23 '14 at 10:47
  • my code assumes you've already got a publication and root structure group, but i think the sample is enough to show you how to work around the api to create the item, rather than edit an existing. – johnwinter Jun 23 '14 at 10:57
  • The code is correct and working but Tridion returns with the message: Exception calling "Save" with "0" argument(s): "The transaction associated with the current connection has completbeen disposed. The transaction must be disposed before the connection can be used to execute SQL statements." This is the same message as before when I used the coreservice to create a new publication. It takes a few minutes before the error is thrown. I use a clean Windows Server 2012 R2 VM with SQL Server 2012 SP1 and a fresh install of Tridion 2013 SP1 (but with all modules EM, AM, UGC, TM,...). – Monday Jun 23 '14 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.