SharePoint CSOM,检索网站集.限量300? [英] SharePoint CSOM, retrieving site collections. Limited to 300?

查看:49
本文介绍了SharePoint CSOM,检索网站集.限量300?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 SharePoint Online 域检索网站集列表.

I am trying to retrieve the site collections list from a SharePoint Online domain.

我正在使用 C# 和客户端对象模型.

I am using C# and client object model.

以下代码仅返回 300 个网站集.

The following code returns only 300 site collections.

var tenant = new Tenant(ctx);
spp = tenant.GetSiteProperties(0, true);
ctx.Load(spp);
ctx.ExecuteQuery();

知道如何使用 CSOM 检索所有网站集吗?

Any idea on how to retrieve ALL site collections with CSOM ?

谢谢

推荐答案

我猜 NextStartIndex 在被问到时不存在,现在你可以这样做:

I guess NextStartIndex didn't exist at the time this was asked, nowadays you can do:

SPOSitePropertiesEnumerable sites;
List<string> allSites = new List<string>();
int startIndex = 0;

do
{
    sites = tenant.GetSiteProperties(startIndex, false);
    ctx.Load(sites);
    ctx.ExecuteQuery();

    allSites.AddRange(sites.Select(s => s.Url));

    startIndex = sites.NextStartIndex;

} while (sites.NextStartIndex > 0);

这篇关于SharePoint CSOM,检索网站集.限量300?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆