【发布时间】:2011-01-04 04:36:57
【问题描述】:
我正在尝试访问共享点列表并出现错误:
""/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;
}
请帮忙。
问候, 珍妮
【问题讨论】:
标签: c# sharepoint