在我的SharePoint网站中," SharePoint管理中心"页面(管理员 - >分享点)我有我的组织的团队名单。我如何以编程方式获取此列表?
答案 0 :(得分:1)
您所指的是网站集列表,您可以使用SharePoint Online Administration来管理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
答案 1 :(得分:-1)
以下代码可以为您提供列表的名称:
参考文献:
using Microsoft.SharePoint;
using SharePointclientObj = Microsoft.SharePoint.Client;
代码:
string clientContext = "http://yourteamsiteslocation";
List<string> tableNames = new List<string>();
//Get a context
using (SharePointclientObj.ClientContext ctx = new SharePointclientObj.ClientContext(clientContext))
{
//Get the site
SharePointclientObj.Web site = ctx.Web;
ctx.Load(site);
//Get Lists
ctx.Load(site.Lists);
//Query
ctx.ExecuteQuery();
//Fill List
foreach (SharePointclientObj.List list in site.Lists)
{
//Console.WriteLine(list.Title);
tableNames.Add(list.Title);
//listBox1.Items.Add(list.Title);
}
}