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         }

 

posted @ 2016-08-29 17:03  致林  阅读(224)  评论(0编辑  收藏  举报