获取当前页的列表中的栏
#region 获取当前页的列表中的栏 public List<SPField> GetPageList(string listname) { SPList spList = SPContext.Current.Web.Lists[listname]; Id = spList.ID; ListName = listname; List<SPField> typeList = new List<SPField>(); SPSecurity.RunWithElevatedPrivileges(delegate { using (SPSite site = new SPSite(SPContext.Current.Web.Site.ID)) { using (SPWeb web = site.OpenWeb(SPContext.Current.Web.ID)) { if (spList != null && spList.Fields.Count > 0) { for (int i = 0; i < spList.Fields.Count; i++) { SPFieldLookup fldLookup = spList.Fields[i] as SPFieldLookup; bool bCountRelated = fldLookup != null && fldLookup.CountRelated; bool bMcolLookup = fldLookup != null && fldLookup.IsDependentLookup && fldLookup.LookupList != "Docs"; SPFieldType t = spList.Fields[i].Type; if (t == SPFieldType.Computed || t == SPFieldType.File || t == SPFieldType.Recurrence || t == SPFieldType.CrossProjectLink || t == SPFieldType.AllDayEvent) { continue; } if (!spList.Fields[i].Reorderable && !bCountRelated && !(spList.Fields[i].ReadOnlyField && spList.Fields[i].Type == SPFieldType.User) && !(bMcolLookup && !spList.Fields[i].Hidden) && !spList.HasExternalDataSource) { continue; } if (spList.Fields[i].Title != "GrapeCityFlowManFormListItemGUID") { string type = spList.Fields[i].TypeAsString; typeList.Add(spList.Fields[i]); } } } } } }); return typeList; }