Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm trying to create a custom field type inherited from the publishing RichImageField type. I did the following, 1- Created the XML declaration of the column as follows

<FieldTypes>
    <FieldType>
        <Field Name="TypeName">PublishingImageWithValidation</Field>
        <Field Name="ParentType">Image</Field>
        <Field Name="TypeDisplayName">Publishing Image With Validation</Field>
        <Field Name="TypeShortDescription">Publishing image with validation on width, height, and size</Field>
        <Field Name="UserCreatable">TRUE</Field>
        <Field Name="FieldTypeClass">
            CustomColumnsAndControls.CustomColumns.PublishingImageWithValidation,
            $SharePoint.Project.AssemblyFullName$
        </Field>
    </FieldType>
</FieldTypes>

2- Created the following class

namespace CustomColumnsAndControls.CustomColumns
{
    class PublishingImageWithValidation : RichImageField
    {
        public PublishingImageWithValidation() : base(){}
    }
}

After deploying the above, I'm able to see my new field type in the field types list as shown below

enter image description here

But when I try to create a new site column based on it, I get an exception, and here is the exception details from the SharePoint logs

System.MissingMethodException: Constructor on type 'CustomColumnsAndControls.CustomColumns.PublishingImageWithValidation' not found. at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at Microsoft.SharePoint.SPFieldCollection.CreateNewFieldInternal(String typeName, String displayName) at Microsoft.SharePoint.ApplicationPages.FieldNewPage.Save() at Microsoft.SharePoint.ApplicationPages.FieldNewPage.BtnOk_Click(Object sender, EventArgs e) at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgu... bd96166d-7e70-40bb-8d0a-64cbc2071ee8

It says "constructor not found"!. The default constructor is there in my class and it's referring the base. I didn't find any other constructors in the parent type to refer to.

What could be the problem?

share|improve this question
    
... Seems you where right Mohammed. My test was wrong, I had reflected over the wrong constructor... so the sample I had posted was wrong. I have removed it to avoid noise. Anyway, I will have a look at that blog and see if i can understand something more. Again, sorry for the error... wrong activator method opened in reflector –  SPArchaeologist Feb 21 '13 at 16:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.