Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 685197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:53:53+00:00 2026-05-14T01:53:53+00:00

In MOSS2007 I need to find and remove for example the default content type

  • 0

In MOSS2007 I need to find and remove for example the default content type from a list (in order to be replaced by a custom one). The list can be on multiple sites, the sites can be in multiple languages and the name for this content type can be diffrent (ex: “Wiki Page” in EN, “Wikipagina” in NL etc.) My ideea was to find the content type using the Id or the prefix of Id (for ex: wiki page start always with 0x010108). Is there any better ideea ? Can we get in code the name of contentypes depending of the language ?

private static SPContentType GetWikiPageContentTypeFromList(SPList list)
    {
        string wikiPageStartId = "0x010108";
        foreach (SPContentType contentType in list.ContentTypes)
        {
            string ctId = contentType.Id.ToString();
            if (ctId.StartsWith(wikiPageStartId))
            {
                return contentType;
            }
        }
        return null;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:53:53+00:00Added an answer on May 14, 2026 at 1:53 am

    You can use SPBuiltInContentTypeId class to get built in content type id’s. So why use names if you can use id’s which is much more better?

    Localized strings

    Ofcourse, you may also use names, but then you should use SPUtility.GetLocalizedString. Examine C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\Resources\core.resx to see what resource names have which values.

    string strWikiDocumentTitle = SPUtility.GetLocalizedString("$Resources:WikiDocument", "core", SPContext.Current.Web.Language);
    

    Content type id’s and hierarchy

    Speaking about id’s, content types have their own hierarchy and you’re right that content types like wiki and all content types derived from wiki will start with 0x010108.

    Anyway, you’re on the right path.

    //Returns best match, that is the content type that is Wiki document. If wiki document content type not in list, will return it's parent content type id.
    SPContentTypeId bestMatch = list.ContentTypes.BestMatch(SPBuiltInContentTypeId.WikiDocument);
    if (bestMatch.IsChildOf(SPBuiltInContentTypeId.WikiDocument))
    {
       return list.ContentTypes[bestMatch];
    }
    

    A catch about list content type’s

    By the way, content type that is returned will not have exactly ID 0x010108, but rather 0x010108xxxxxxxxxxxxxxxxx…. (it will be CHILD if wiki content type), because as you add content type to list it actually creates new content type that is derived from it’s parent.

    So you can safely delete that content type if you wish. And if you want to modify that content type, then use returned content type’s PARENT (SPContentType.Parent property) to modify and apply changes to all content types inherited…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a need to move ~10,000 files from one document library to another
I have a site developed in MOSS2007. where can I see the list of
For example, I tried following example from documentation : =TEXT(WEEKDAY([Column1]), dddd) But it won't
Can I provision reporting services reports to MOSS 2007 or do I need to
I have a need to integrate a third-party Java applet into a custom web
I have the need to programmatically define a business data content source in Sharepoint
Anyone knows how to do this? I need to get all the Departments from
I have MOSS 2007. I can't find any _layouts directory. Do I have to
On a content type in a SharePoint (MOSS 2007) site I want to show
I have received a content export of a MOSS 2007 site which I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.