C# 如何以编程方式获取所有SharePoint团队网站?
在我的SharePoint网站的“SharePoint管理中心”页面(管理->SharePoint)中,我有我所在组织的团队网站列表。如何以编程方式获取此列表C# 如何以编程方式获取所有SharePoint团队网站?,c#,.net,sharepoint,sharepoint-2013,C#,.net,Sharepoint,Sharepoint 2013,在我的SharePoint网站的“SharePoint管理中心”页面(管理->SharePoint)中,我有我所在组织的团队网站列表。如何以编程方式获取此列表 以下是获取列表名称的代码: 参考资料: using Microsoft.SharePoint; using SharePointclientObj = Microsoft.SharePoint.Client; 代码: string clientContext=”http://yourteamsiteslocation"; List ta
以下是获取列表名称的代码: 参考资料:
using Microsoft.SharePoint;
using SharePointclientObj = Microsoft.SharePoint.Client;
代码:
string clientContext=”http://yourteamsiteslocation";
List tableNames=新列表();
//获取上下文
使用(SharePointclientObj.ClientContext ctx=new SharePointclientObj.ClientContext(ClientContext))
{
//获取站点
SharePointclientObj.Web站点=ctx.Web;
ctx.荷载(现场);
//获取列表
ctx.Load(现场列表);
//质疑
ctx.ExecuteQuery();
//填写清单
foreach(site.Lists中的SharePointclientObj.List)
{
//Console.WriteLine(列表.标题);
表名。添加(列表。标题);
//listBox1.Items.Add(list.Title);
}
}
您指的是一个网站集列表,可用于管理SharePoint Online(SPO)
PowerShell示例:
#Connect to SPO
Connect-SPOService -Url https://contoso-admin.sharepoint.com -credential usernam@contoso.onmicrosoft.com
#Retrieve all site collections
Get-SPOSite
#Connect to SPO
Connect-SPOService -Url https://contoso-admin.sharepoint.com -credential usernam@contoso.onmicrosoft.com
#Retrieve all site collections
Get-SPOSite