SharePoint 2010 Value不在预期范围内

时间:2013-07-26 07:37:03

标签: c# sharepoint sharepoint-2010

在开发服务器上一切正常但是在部署之后有一个ArgumentException: Value does not fall within the expected range.不幸的是,没有办法直接调试失败的Web部件,所以我只有一些日志信息(例如上面的异常消息和代码部分)如下所示)。 这是抛出异常的代码:

using (SPSite site = new SPSite("http://mysite"))
{
    using (SPWeb web = site.OpenWeb())
    {
        SPList list = web.Lists.TryGetList("MySPList");
        foreach (SPListItem item in list.Items)
        {
            if (item["Code"].ToString() == code)
            {
                if (item["Favorites"] != null)
                {
                    if (item["Favorites"].ToString().Contains(web.CurrentUser.ID + ";#" + web.CurrentUser.Name))
                    {
                        // first case simple code 
                    }
                    else
                    {
                        // second case simple code 
                    }
                }
                else
                {
                    // second case simple code 
                }
                break;
            }
        }
    }
}

1 个答案:

答案 0 :(得分:6)

问题出在列表视图查找阈值参数:

  • 登录管理中心
  • 应用程序管理部分中,点击管理Web应用程序
  • 选择所需的网络应用程序。
  • 在上面的功能区中点击常规设置,然后从下拉菜单中选择资源限制
  • 找到列表视图查询阈值并更改它的值(在我的情况下从8到10)。
相关问题