首页 > 代码库 > SharePoint 读取 Site Columns 的数据并绑定到DropdownList

SharePoint 读取 Site Columns 的数据并绑定到DropdownList

 1 public void GetSiteColumns(DropDownList ddl, String siteColumn) 2         { 3             var fields = new SPSite(ProjectContent.SiteUrlMapping).RootWeb.Fields; 4             var projectCodeXml = fields.TryGetFieldByStaticName(siteColumn).SchemaXml; 7             XmlDocument xmlDoc = new XmlDocument(); 8             xmlDoc.LoadXml(projectCodeXml); 9             XmlNode xn = xmlDoc.SelectSingleNode("Field/CHOICES");10             foreach (var xnl in xn)11             {12                 XmlElement xe = (XmlElement)xnl;13                 ddl.Items.Add(xe.InnerText);14             }15         }

 

SharePoint 读取 Site Columns 的数据并绑定到DropdownList