Pages

Tuesday, June 9, 2009

One of more field types are not installed properly in CAML Query

Hello Friends,
I got error "One of more field types are not installed properly" .
What does this mean?Let me first explain basic concept which is related to this error and you will find solution.
Concept:

Whenever creating any column for list, SharePoint creates three names for it.
  1. External name /Display Name to display in views, forms
  2. Internal name we use in CAMP Query, Assign Values
  3. Static Name : Name which is used by field type.
If you are creating field from code behind then you can assign internal name as per your choice, but when doing it through SharePoint interfface, it gives you option to enter display name, and it creates internal name by itself. When internal name is defined, if you have any of the non alphabet as part of name SharePoint converts them to special hex codes.
For e.g. trying to create field “Emp Name” gives internal name as “Emp_x0020_Name”
You can think like why this description is needed!!!But for the error like "One of more field types are not installed properly" in their applications.“You must understand this concept vey well. You must have clear picture of that.
So now for that error there is no problem with creating list and their fields.
The problem is simple:
CAML Query always uses Internal Name.
CAML Query uses Internal name not display name.If you have a field called "Program ID" (for example), in CAML you should refer to it as “Program _x0020_ID", because the internal name is encoded to avoid special characters.

Also, the internal name may be totally different from the display name - this will happen if you created a field and then renamed it.
Let’s Say we create a custom List name as “Employee” . Now Title field is already available.
Now I want to rename “Title” with “EmployeeID” But when I rename it ,it only and only changes display name but its internal name does not change. And Internal name is always created when we create field first time. We can not change internalname afterwards. So the internal name remains the same as the old name, but the display name changed. You can change the display name as many times as you want, but can never change the internal name once column is created.
So, how to know about the internal name for field?
Let me clear entire picture by elaborate an example. Every List has Field name as “Created By” field which is having internal name “Author” and Display Name as “Created By”.
If you want to know internal name of particular field how you can indentify .Go to ListàList Settingsà Click On Column (Created By) à so you have Edit Column Page. On that page you can see Column Name Textbox has its display name as “Created By”. Now Look at Addressbar It looks like this.
http://SharepointURL/_layouts/FldEditEx.aspx?List=%7BE6C3FC5E%2D04E6%2D4393%2DB637%2D031CE08C620B%7D&Field=Author
Internal Name of any field is identified by Field=InernalNanme. So Internal Name is for “Created By” is “Author”.
So Now If you wish some easier way to write CAML and do not want to find internal name by checking “Field” from address bar use Some CAML Query Builder.
I provide One table so you can convert Hex code to Character like Program _x0020_ID as so we have x0020=”” See last Row of this table “Program ID”

Character

Internal Hex Code

~

_x007e_

!

_x0021_

@

_x0040_

#

_x0023_

$

_x0024_

%

_x0025_

^

_x005e_

&

_x0026_

*

_x002a_

(

_x0028_

)

_x0029_

_

_

+

_x002b_

-

_x002d_

=

_x003d_

{

_x007b_

}

_x007d_

:

_x003a_


_x0022_

|

_x007c_

;

_x003b_


_x0027_

\

_x005c_

<

_x003c_

>

_x003e_

?

_x003f_

,

_x002c_

.

_x002e_

/

_x002f_

`

_x0060_
 
_x0020_


Disha Shah

2 comments:

  1. great, consise, relevant information, thank you.

    ReplyDelete
  2. Thanks a looooooooot for reply.I really appreciate it.

    ReplyDelete