This is quite a common error when developing custom field types on SharePoint. Few quick points to keep an eye for, and they are:
- Ensure that the field type matches the parent type – for example, if you inherit from SPFieldText then ensure that the ParentType attribute on the fldtypes_<fieldname>.xml file has the value of Text.
- Ensure that you do not clash with SharePoint Internal names – this can be easily avoided by having a standard naming standard for your SharePoint development. I tend to prefix my custom field names with HM, example would be HM<fieldname>.
- Ensure that the FieldTypeClass is specified correctly – on the fldtypes_<fieldname>.xml file, ensure that the FieldTypeClass attribute is specified correctly. Should be specified as “namespace.classname, assembly name, version, culture, publickeytoken”
Need to retrieve user information, such as email from a PickerEntity control? The code snippet below shows you how to, for this example get the user email.
Do note, I also have a post on how to do this from a People and Group field here.
Ever had to retrieve user information from a Person or Group field? In my case, I had to get the user email, and the code snippets below shows you how.
If the field has been set to only allow single selection such as
the use the following:
Where oItem is the SPListItem object, and [“Manager”] is the field display name.
However, if the field has been set to allow multi-selection such as
then use the following:
Where oItem is the SPListItem object and [“Team”] is the field display name. And sb being a StringBuilder object that I’ve used for this purpose.