//Open SharePoint site
using (SPSite site = new SPSite(@"http://..."))
{
using (SPWeb web = site.OpenWeb())
{
//Get handle for forms library
SPList formsLib = web.Lists["FormsLib"];
if (formsLib != null)
{
foreach (SPListItem item in formsLib.Items)
{
XmlDocument xml = new XmlDocument();
//Open XML file and load it into XML document
using (Stream s = item.File.OpenBinaryStream())
{
xml.Load(s);
}
//Do your stuff with xml here...}}}}
我尝试添加Sharepoint 2010和2013 SDK,但仍未获得所需程序集的参考。你有什么建议吗?
奥拉夫
答案 0 :(得分:0)
我用这种方式使用Microsoft.SharePoint.Client解决了这个问题:
string siteUrl = @"http://.../sites/.../";
ClientContext clientContext = new ClientContext(siteUrl);
SP.List oList = clientContext.Web.Lists.GetByTitle("List Title");
(此处SP是Microsoft.SharePoint.Client的简短别名)
然后通过oList.GetItems()进行caml查询。