Illegal characters for SharePoint 2010 Content Type name

Posted by Kelly Jones on Geeks with Blogs See other posts from Geeks with Blogs or by Kelly Jones
Published on Thu, 23 Jun 2011 15:03:39 GMT Indexed on 2011/06/24 0:23 UTC
Read the original article Hit count: 709

Filed under:

Quick tip: you can’t include a backslash in the name of the SharePoint 2010 Content Type.  In fact, there are several illegal characters:  \  / : * ? " # % < > { } | ~ & , two consecutive periods (..), or special characters such as a tab.

What, you didn’t know that after entering one of these characters in the name?  Is it because you saw this screen:

image

Oh, that’s right….you need to turn off custom errors in the layouts folder…See this blog post for details and you’ll also need to turn off for the web application. Once you do that, you’ll see this:

image

I wonder why the SharePoint team just doesn’t let the user know that the content type name contains illegal characters before the user hits the create button.


Here’s a copy of the complete error (for the search engines):

Server Error in '/' Application.
--------------------------------------------------------------------------------

The content type name 'asdfadsf\asdfasf' cannot contain: \  / : * ? " # % < > { } | ~ & , two consecutive periods (..), or special characters such as a tab.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Microsoft.SharePoint.SPInvalidContentTypeNameException: The content type name 'asdfadsf\asdfasf' cannot contain: \  / : * ? " # % < > { } | ~ & , two consecutive periods (..), or special characters such as a tab.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace:


[SPInvalidContentTypeNameException: The content type name 'asdfadsf\asdfasf' cannot contain: \  / : * ? " # % < > { } | ~ & , two consecutive periods (..), or special characters such as a tab.]
   Microsoft.SharePoint.SPContentType.ValidateName(String name) +27419522
   Microsoft.SharePoint.SPContentType.ValidateNameWithResource(String strVal, String& strLocalized) +423
   Microsoft.SharePoint.SPContentType.set_Name(String value) +151
   Microsoft.SharePoint.SPContentType.Initialize(SPContentType parentContentType, SPContentTypeCollection collection, String name) +112
   Microsoft.SharePoint.SPContentType..ctor(SPContentType parentContentType, SPContentTypeCollection collection, String name) +132
   Microsoft.SharePoint.ApplicationPages.ContentTypeCreatePage.BtnOK_Click(Object sender, EventArgs e) +497
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927

© Geeks with Blogs or respective owner