Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Programatically modifying the property of a SPList field

  Asked By: Christina Clark         Date: Aug 31, 2009      Category: Sharepoint      Views: 838
 

I would like to programatically modify the property of a field of
SPList item Requiered = false.

I am not sure what I am missing?

SPGlobalAdmin globaladmin = new
SPGlobalAdmin();
Context.Items
[SPGlobalAdmin.RequestFromAdminPort] = true;
Page.RegisterHiddenField
("_REQUESTDIGEST",globaladmin.AdminFormDigest);

globaladmin.AllowUnsafeUpdates = true;

//SPWeb site_rating =
SPControl.GetContextWeb (Context);
SPSite my_site_add_user = new SPSite
("http://members.immunetolerance.org/sites/Tolerance
Proposal/default.aspx") ;

SPWeb my_web = my_site_add_user.AllWebs[""];

my_web.AllowUnsafeUpdates = true;

SPList my_list_Vote = my_web.Lists["Vote and
Review"];

// get the list item and change the property
of the list item
my_list_Vote.Fields["Please rate this
Proposal"].Required = false;


my_list_Vote.Update();
my_web.Update();

has anybody achieved in modifying the properties of a list
programatically?

Tagged:              

 

2 Answers Found

 
Answer #1       Answered By: Natasha Bennett          Answered On: Aug 31, 2009       

I used the SPFiled class and it worked.........

 
Answer #2       Answered By: Angel Matthews          Answered On: Aug 31, 2009       

please if any one can tell me please help me.

I am trying to change  some of the Properties values like for
ex:SELinkData,SEStatus of the document. I thought changing the Hashtable will
direclly make change but it's not working properlly.

will the SPList class help me for the same? If it will please tell me in detail
how to do with it.

 
Didn't find what you were looking for? Find more on Programatically modifying the property of a SPList field Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].