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 have a requirement to update the schema files of a list template which modifies the options available to the fields.

But, when I am updating the schema file the options for the already defined lists is not updated.

So, how to update the options for all the lists defined from this list template.

Thanks in advance!

share|improve this question

2 Answers 2

up vote 2 down vote accepted

WHat do you mean by "options available to fields". Do you mean you want to add extra Choices to a Choice field used in the list? If so, create a feature with a feature receiver and access the SPList, the the available fields in the list, get the field you want to update, Cast it to a SPFieldChoice, add the new values to the Choices collection and call the field's Update method, then the SPList's Update method.

If the field in question is a field available as a site column in the entire site, get the RootWeb's Fields collection, find your field and perform the same actions to add choice values. This time, call the Field's Update mathod with true as parameter, so the changes will get pushed down to any list using the field. Then call the RootWeb's Update method.

share|improve this answer
    
Many Thanks Colin, this is exactly what i required 'edit choices to a Choice field used in the list'. –  goso Oct 20 '11 at 8:30
    
C-Marius and Colin, your answers were very helpful! –  goso Oct 20 '11 at 8:32

Once the list (or webs for that matter) is created there is no more link between new versions of the definition. You should envision configuring those via code.

share|improve this answer
    
Thanks C-Marius, But, I have to allow user a set of options for their field values. How do you recommend I can provide user those options on editing already existing list items? –  goso Oct 19 '11 at 18:35
    
Are you refering to options such as Default values, Calculated formula as such? Could you be more specific please, give me an example? –  C. Marius - MVP Oct 19 '11 at 20:46
    
C-Marius, I require to remove the already existing Choices to a Choice field used in the list and add new choices for the field? –  goso Oct 20 '11 at 8:28
    
I am going to try Colin's suggestion. Thanks –  goso Oct 20 '11 at 8:34
    
Colin's answer is absolutely valid! If you do deploy your fields (& lists) via a Features (probably along with content types), take into consideration also the Context (Scope) of your deployment. –  C. Marius - MVP Oct 20 '11 at 9:08

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.