0

We have got to create a child Publication using CoreService 2013 using C#. Could you please help on this.

5

Hi Shruthi and welcome to Tridion StackExchange. Before giving you an answer I must ask, what have you tried so far? I'm asking because this question is a "do my homework instead of me" type, and people most of the time don't like/are reluctant to do other people's jobs, neither is this SE meant to work in such a way. You must put in some effort as well :).

So instead of giving the solution to you, I will give you a few pointers, which will help you get started with the easy to use CoreService. Using the API found HERE and the hints below, you can easily put together your own code:

  • To create whatever type of IdentifiableObject via CoreService use the Create method (a Publication is an IdentifiableObject)
  • To work (create, manipulate) with a Publication take a look at the PublicationData class
  • To set it as a child Publication, take a look at the Parents property of the PublicationData class

If you run into any issues with these hints, then please update your question with your sample code and an explanation what those issues are and I will gladly further assist you.

|improve this answer|||||
  • 2
    Even for people that are willing to do other people's job, it helps a lot to have an impression of what the person asking the question already knows (or tried). This makes it possible to give a focused answer rather than a "beginner's guide to Tridion". – Rick Pannekoek Jul 10 '18 at 8:08
3

Although I completely agree with previous answer by Atila, i still understand struggle new Tridion people go through at start. Mostly its related to not knowing where to start. If you want to create publication via Core Service, you can use something like this:

  public PublicationData CreateNewPublication()
    {
        try
        {
            PublicationData publicationData = (PublicationData)client.GetDefaultData(ItemType.Publication, null, new ReadOptions());
            publicationData.Title = "Test Publication";
            publicationData.PublicationUrl = "/en-us";
            publicationData.PublicationPath = @"\en-us";
            LinkToRepositoryData[] parentPublications = new LinkToRepositoryData[] { };
            publicationData.Parents = parentPublications; // here you should set parent publications
            publicationData.MultimediaPath = @"\images";
            publicationData.MultimediaUrl = "/images";

            publicationData = (PublicationData)client.Create(publicationData, readOptions);

            return publicationData;
        }
        catch (Exception ex)
        {
            throw new CSConnectorException("Problem with saving publication. Exception: " + ex.Message);
        }
    }

Please take this piece of code with precaution. Don't just blindly copy/paste it, try to understand it, learn from it, and implement it as you require.

As update, there is also nice, blog by @Dominic Cronin explaining how you can do this via powershell script.

|improve this answer|||||

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.