I need to show all content types in a drop-down or as hyperlinks along with description on custom .aspx page. When user selects any type, respective New Form should open to create a new document/list out of that content type.

Please help me to achieve this in SharePoint 2010 using Designer.

1 Answer 1


This will be very hard for Site ContentTypes, since there could be multiple Lists, which support it. - So no New Form. You could however try to achieve this for a single list, like this:

        <input id="TestBtn" name="Button1" type="button" value="Script test" onclick="getContentTypesOfSite()" /><br />
        <br/ >
        <table id="testTable" style="width:100%; border: 1px solid black;">
        <br />

<script type="text/javascript">
        var debug_mode = 1;

        var thisSiteUrl = L_Menu_BaseUrl;

        function getContentTypesOfSite(siteUrl) {
            if (SP) {
                var clientContext = new SP.ClientContext(siteUrl);
                var oList = clientContext.get_web().get_lists().getByTitle("Aktionsliste");
                this.collList = oList.get_contentTypes();

                clientContext.load(collList, 'Include(Name, Id, Description, Hidden, Group, NewFormUrl)');

                clientContext.executeQueryAsync(Function.createDelegate(this, this.onSiteQuerySucceeded), Function.createDelegate(this, this.onSiteQueryFailed));

        function onSiteQuerySucceeded() {

            var listInfo = '';

            var listEnumerator = collList.getEnumerator();

            while (listEnumerator.moveNext()) {
                var oContentType = listEnumerator.get_current();

                if ((!oContentType.get_hidden() === true) && (oContentType.get_group() != '_Hidden')) {
                    var link = '/Lists/Aktionsliste/NewForm.aspx';
                    var row;
                    if (oContentType.get_newFormUrl() == "") 
                        row = $('<tr><td>'+oContentType.get_name()+'</td><td>'+oContentType.get_description()+'</td><td><a href="'+link+'">New Form</a></td><td>'+oContentType.get_id()+'</td></tr>');
                        row = $('<tr><td>'+oContentType.get_name()+'</td><td>'+oContentType.get_description()+'</td><td><a href="'+oContentType.get_newFormUrl()+'">New Form</a></td><td>'+oContentType.get_id()+'</td></tr>');


        function onSiteQueryFailed(sender, args) {
            alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());


Please don't forget to insert/enable jQuery.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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