Invalide parameter: ContentType. Expect a number. ‘SomeContentType’ is given instead.

So, you’ve created your custom advanced search box for your SharePoint 2007 site, but now you’re running into an error:

Invalide parameter: ContentType. Expect a number. ‘SomeContentType’ is given instead.

There is a good chance you forgot to include two imporant hidden fields in your control:

  • ASB_TextDT_Props
  • ASB_DateTimeDT_Props

I’m not entirely sure about the purpose of these fields, but I suspect that the entries in these fields define the data type of the property fields in the advanced search box. You can include them in your control like this:

protected override void OnPreRender(EventArgs e) 
{ 
  base.OnPreRender(e);     
 
  this.Page.ClientScript.RegisterHiddenField("ASB_TextDT_Props", "ContentType#;#Path#;#FileName#;#Description#;#Title#;#Author#;#DocSubject#;#DocKeywords#;#DocComments#;#Manager#;#Company#;#CreatedBy#;#ModifiedBy");
  this.Page.ClientScript.RegisterHiddenField("ASB_DateTimeDT_Props", "Write#;#Created#"); 
}

Also, be sure to include any custom managed properties you might have and wish to search on.

Be Sociable, Share!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">