0

当我进入/_layouts/groups.aspx我的网站集时,我只看到前 100 个组。没有可见的分页控件。我该如何纠正这个问题,而不是只与前 100 个组一起工作?

4

3 回答 3

4

如果需要,您还可以通过标准 UI 修改此视图,而不是使用代码:

  1. 浏览到“http:// <网站集 url> /_catalogs/users/AllGroups.aspx”
  2. 站点操作-> 编辑页面
  3. 修改列表视图 web 部件
  4. 在选定视图下单击“编辑当前视图”链接。
  5. 您现在可以像在 SharePoint 中一样编辑视图设置。
于 2011-05-24T00:12:23.150 回答
1

该列表是一个共享点内部列表,无法通过 API 访问,必须通过使用对象模型来访问。

假设您熟悉 SharePoint API,

您需要以编程方式访问您的站点,然后访问用户和组列表,然后访问其上的默认视图,并将其分页属性设置为 true。

static void Main(string[] args)
{
  //Access the site
  using (SPSite _site = new SPSite("http://myurlwithport:800"))
  {
    //Substitute the appropriate web if it is not the root
    using (SPWeb _web = _site.RootWeb)
    {
      // This is always the name of the users list
      SPList userList = _web.Lists["User Information List"];

      //This is the view that is causing you trouble
      SPView allGroupsView = userList.Views["All Groups"];

      //Set this value to true if it is false.
      Console.WriteLine(allGroupsView.Paged);

      //Set this value to whatever you want if you don't want paging
      Console.WriteLine(allGroupsView.RowLimit);                   

      Console.ReadLine();
    }
  }
}

希望这对你们有用。

编辑

基于OP评论

如果需要,您可以更改一个 RowLimit 属性。

我已将其添加到提供的代码中。

于 2009-05-11T23:35:04.703 回答
1

我想对 Michael M 关于更新“AllGroups.aspx”的建议分享一些额外的说明。

最初,我使用常规网站集管理员帐户访问“http:///_catalogs/users/AllGroups.asp”页面,但访问被拒绝。

然后,我使用了另一个站点集合管理员帐户,该帐户也在 SP 服务器的 Windows 管理员组中,但仍然被拒绝访问。

最后,我使用了用于设置 Web 应用程序/应用程序池的 SharePoint 2010 Farm 管理员帐户,这最终使我能够访问该页面。

于 2011-11-03T21:43:15.927 回答