How to get the value of one specified item
2012-06-16 10:52
519 查看
Method1: public override void ItemAdding(SPItemEventProperties properties) { base.ItemAdding(properties); //Get the current web where event occurred SPWeb webSite = properties.Web; //Get the list in current web by displayed name SPList documents = webSite.Lists["Documents"]; //the GetItems() method to return multiple list items SPListItemCollection itemCollection = documents.GetItems(); //use a loop and conditional structures to select the item you want SPListItem item = null; foreach (SPListItem it in itemCollection) { if (it.Name == "Lab.docx") //Note that the file name has suffix { item = it; } } //After you have a reference to the list item that you want, your code can read the value of any field by using an identity of the SPListItem object string title=(string)item["Title"]; }
相关文章推荐
- flex/in the datagrid,how to get the new value of cell in the datagrid after edit
- How to get the source code of the chromium of the specified revision
- How to get the value of a form element : check box and radio button
- How to get the source code of the chromium of the specified revision
- How to get the tables of one schema?
- How to limit an array of similar hashes to those that have more than one of the same key:value pair
- how to get rid of the UITabBarItem padding
- how to get the space size of some tables in one database?
- how to get the space size of some tables in one database?
- How to get value of the person or group type via CAML Query js
- How to add icon for the item of ListCtrl using C++ (Mail Attachment ListCtrl) - 如何用C++为ListCtrl的Item添加图标(邮件附件ListCtrl)
- How to get the field descriptions of a table
- [jQuery] 如何根据名字来选取checkbox数组 -- How to get the array of checkbox via name
- [读书笔记]How to Get the Most of Studying
- HOW TO CHANGE THE DEFAULT KEY-VALUE SEPARATOR OF A MAPREDUCE JOB
- How to get the content of the 'identity' section in web.config
- How to recover NameNode HA, when one accidentally formated one of the two NameNodes
- Oracle table fragmentation how to calculate or get the actual used blocks of the table
- How to get the length of array of strings in C? - Yahoo! Answers
- How to Get the Frequency Table of a Categorical Variable as a Data Frame in R