admin
Cấp bậc: Bán chuyên nghiệp
Tham gia: 8/8/2011 Bài viết: 287 Đến từ: Hà Nội
Đánh giá: [29]
Cảm ơn: 18 lần Được Cảm ơn: 17 lần
|
Hàm sau sẽ trả về tập các trường trong 1 danh sách của sharepoint
string GetAllFieldInList(string strListName)
{
string strFields="";
SPWeb web = SPContext.Current.Web;
SPList list = web.Lists[strListName];
SPListItemCollection itemCollection;
StringCollection fieldsNameCollection;
itemCollection = list.Items;
fieldsNameCollection = itemCollection.QueryFieldNames;
for (int i = 0; i < fieldsNameCollection.Count; i++)
{
if (fieldsNameCollection[i].StartsWith("ows_"))
fieldsNameCollection[i] = fieldsNameCollection[i].Remove(0, 4);
strFields+=fieldsNameCollection[i]+"\n";
}
return strFields;
} --------------------------------- Công ty TNHH Thương mại và Giải pháp công nghệ THÀNH NAM
Website: www.giadinhit.net
|