First of all, Thank goes to Ken for the investigation.
Few words on the web about internal, static and display names of columns. There aren’t any simple Microsoft statement on the subject
Create Site Column through GUI:
-- DisplayName must be unique. SharePoint will adjust StaticName & InternalName to keep them unique.
Create Site Column through Feature and XML:
-- xml-Name (InternalName) must be unique. SharePoint will allow duplicate DisplayName & StaticName.
*** Duplicate Internal names will not create a field (If you already have a site field with the same Internal Name). “No error will be raised”.
Create List Column through GUI:
-- DisplayName must be unique. SharePoint will adjust StaticName & InternalName to keep them unique.
Adding site columns to list columns via GUI:
-- DisplayName and StaticName don't have to be unique. SharePoint will make InternalName unique.
Source: http://www.sharepointlessonslearned.com/blogs/blog1.php/2010/03/04/field-name-uniqueness-rules-vary-between-gui-and-api
In addition to that:
** Content types that refer to the missing field will have orphaned local field, and the list will continue to function.
** Fields created from code (Fields.AddFieldAsXml) - These will raise an error if internal name exists.
** Fields created from code (Fields.Add) - Sharepoint makes unique name.
Friday, 16 July 2010
Wednesday, 3 February 2010
Adding event receivers to custom list templates
Problem: wanted to create a list template and with some event receivers.
Normally I use the SharePoint Solution Generator to dump the list templates. So I have created a list using GUI and added some event receivers and used the SSG to generate the template. (I got my 4 aspx files and the schema.xml)
When you check the schema, you can see that the Event receivers are correctly added under the <Receivers> tag. So I have used a feature to deploy the list template and created a list using deployed template. List was created successfully with all the fields and views, but unfortunately my Event receivers were missing. I doubled checked and tried again, got the same results.
While googleing, found an article which you can use a separate Elements file to bind the Event receivers to particular list type.
I have use the same method and its working with the list template. In addition to that it adds the event receivers to list which are already created through my custom template.
Normally I use the SharePoint Solution Generator to dump the list templates. So I have created a list using GUI and added some event receivers and used the SSG to generate the template. (I got my 4 aspx files and the schema.xml)
When you check the schema, you can see that the Event receivers are correctly added under the <Receivers> tag. So I have used a feature to deploy the list template and created a list using deployed template. List was created successfully with all the fields and views, but unfortunately my Event receivers were missing. I doubled checked and tried again, got the same results.
While googleing, found an article which you can use a separate Elements file to bind the Event receivers to particular list type.
I have use the same method and its working with the list template. In addition to that it adds the event receivers to list which are already created through my custom template.
Subscribe to:
Posts (Atom)