Pages

Friday, September 16, 2011

One or More fields not installed Properly Sharepoint

I decided to pen down this error for the reason that I tend to forget what i learned over a period working on sharepoint. Recently it so happened that one of my colleague faced this error developing on sharepoint and he is relatively new to sharepoint. There are millions of blogs and article taking about "one or more fields not installed propertly" error in sharepoint. In his case he was using sharepoint List.asmx web services to update the list. After looking through his code he was using display name and that was causing this error. This would have worked perfectly in object model to update the list item, but in webservices call the xml created is used as CAML and hence it was looking for internal name.


So I decided to list some of the reasons why "One or more fields not installed properly" would happen in sharepoint.

Sharepoint column is not added to the list

Display name of the column is used in the CAML (Object Model)

Display Name is used in Sharepoint Web Services XML (This XML will be converted to CAML, so similar to 2nd Point)

If the Column Type is different than the one referenced in code.

I am adding a code snippet. This is used to create new or update existing item in SharePoint using web services.

"<Method ID='1' Cmd='New'>" +
                                         "<Field Name='ID'>New</Field>" +
                                         "<Field Name='"Property_x0020_Name "'>1</Field>" +
                                        
                                          "<Field Name='"Property_x0020_Status"'>active</Field>" +


                                          "<Field Name='" Site_x0020_Type "'>Entity</Field>" +


                                          + "<Field Name='Title'>" + foundEntityWeb.Title + "</Field>" +
  "</Method>";


"<Method ID='1' Cmd='Update'>" +
                                         "<Field Name='ID'><ID of the item to update></Field>" +
                                         "<Field Name='"Property_x0020_Name "'>1</Field>" +
                                        
                                          "<Field Name='"Property_x0020_Status"'>active</Field>" +


                                          "<Field Name='" Site_x0020_Type "'>Entity</Field>" +


                                          + "<Field Name='Title'>" + foundEntityWeb.Title + "</Field>" +
  "</Method>";


you can refer to MSDN article for creating XML for sharepoint List.asmx.

No comments:

Post a Comment