我正在尝试访问sharepoint列表和错误:
“”/ SiteDirectory / _layouts / viewlists.aspx“包含保留名称。请尝试另一个。”
代码视图:
private void button1_Click(object sender,EventArgs e)
{
//String parameters to enable site and list access
const string siteUrl = "http://Myserver/";
//const string siteName = "SiteDirectory/testlists/";
const string siteName = "/SiteDirectory/_layouts/testlists.aspx";
const string sourceFileName = "Shared%20Documents/TestUpload.doc";
OfficialFileResult result;
string fileResult;
//Freeze UI
Cursor = Cursors.WaitCursor;
button1.Enabled = false;
//Return a site collection using the SPSite constructor providing the site URL
SPSite siteCollection = new SPSite(siteUrl);
//Return the target web site based on site name
SPWeb site = siteCollection.AllWebs[siteName];
// **Getting Error at this Line**
//Access file from within site based on path
SPFile file = site.GetFile(sourceFileName);
result = file.SendToOfficialFile(out fileResult);
//UI clean-up
label1.Text = "Records Hold Status: " + result;
Cursor = Cursors.Default;
button1.Enabled = true;
}
请帮忙。
此致 Jene
答案 0 :(得分:0)
SiteName不是“/SiteDirectory/_layouts/testlists.aspx”!在这种情况下,SiteName应该是.. SiteDirectory,我想。自己尝试 - 通过所有网络进行枚举,并查看他们的名字。这些是AllWebs []字典的索引!