Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何以编程方式获取所有SharePoint团队网站?_C#_.net_Sharepoint_Sharepoint 2013 - Fatal编程技术网

C# 如何以编程方式获取所有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

在我的SharePoint网站的“SharePoint管理中心”页面(管理->SharePoint)中,我有我所在组织的团队网站列表。如何以编程方式获取此列表


以下是获取列表名称的代码:

参考资料:

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