How to create document type using API

Pritam Gupta asked on September 1, 2017 12:35


I have to create a document type using API, so i refer the Kentico built in API to create Document Page in CMS but using that i am only create a Page Menu Item. I have to create a page for different document type Please help me for that.

below is my code

TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);

            // Gets the current site's root "/" page, which will serve as the parent page
            TreeNode parentPage = tree.SelectNodes()

            if (parentPage != null)
                // Creates a new page of the "CMS.MenuItem" page type
                TreeNode newPage = TreeNode.New("Custom.Video",tree);

                // Sets the properties of the new page
                //newPage.DocumentName = "Articles";
                //newPage.DocumentCulture = "en-us";

                  newPage.SetValue("title", "Page Through API");

                // Inserts the new page as a child of the parent page

Recent Answers

Brenden Kehren answered on September 1, 2017 14:03

When you debug it are you getting an error?

Does the path /Videos/Archived exist?

Can the "Custom.Video" page type be placed below the "CMS.MenuItem? page type?

Does your custom page type have required fields? If so, did you fill them out?

Speaking of required fields, you need to fill out at least the properties you've commented out for the API to create the rest of the items needed for the page.

1 votesVote for this answer Mark as a Correct answer

Pritam Gupta answered on September 4, 2017 14:21

Hello Brenden,

yes there is required field in my page. now i set that field as well so its working fine.

Thank you very much for your help.

0 votesVote for this answer Mark as a Correct answer

jolina mcconoughey answered on September 8, 2017 11:35

Discussing required fields, you have to round out in any event the properties you've remarked out for the API to make whatever is left of the things required for the page. Dissertation Help

0 votesVote for this answer Mark as a Correct answer

bailey shaw answered on October 24, 2017 09:07

This was very helpful because I have been looking for creating a document using an API because I am a little weak in this topic. BuyOnlineEssay

0 votesVote for this answer Mark as a Correct answer

chelsie anayas answered on November 7, 2017 03:15

I would be happy if you could help us. I hope my site will be Google accepted and put it ahead so that I can grow and hope that it will come to me dumb ways to die fireboy and watergirl 4

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.