【问题标题】:Getting Error : "/SiteDirectory/_layouts/testlists.aspx" contains reserved name. Please try another one出现错误:“/SiteDirectory/_layouts/testlists.aspx”包含保留名称。请尝试另一个
【发布时间】: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


    【解决方案1】:

    站点名称不是“/SiteDirectory/_layouts/testlists.aspx”! SiteName 应该是.. SiteDirectory 在这种情况下,我想。自己试试——列举所有的网络,看看他们的名字。这些是 AllWebs[] 字典的索引!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多