使用Office 365中的成员组创建SPO列表 [英] Create SPO list with members group from office 365

查看:216
本文介绍了使用Office 365中的成员组创建SPO列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!请帮帮我.

如何创建由办公室365的成员组组成的SPO列表?

How can I create SPO list, which consist members group from office 365?

推荐答案

您好,

我们可以使用CSOM C#为SharePoint Online创建列表.

We can use CSOM C# to create lists for SharePoint Online.

string targetSiteURL = @"https://XXX.sharepoint.com/sites/dennis";

var login = "dennis@XXX.onmicrosoft.com";
var password = "XXX";
string listName = "TestList";

var securePassword = new SecureString();

foreach (char c in password)
{
	securePassword.AppendChar(c);
}
SharePointOnlineCredentials onlineCredentials = new SharePointOnlineCredentials(login, securePassword);

ClientContext ctx = new ClientContext(targetSiteURL);
ctx.Credentials = onlineCredentials;
var listCollection = ctx.Web.Lists;  
ctx.Load(listCollection, lsts => lsts.Include(list => list.Title).Where(list => list.Title == listName));
ctx.ExecuteQuery();
if (listCollection.Count == 0) {
	ListCreationInformation creationInfo = new ListCreationInformation();
	creationInfo.Title = listName;
	creationInfo.TemplateType = (int)ListTemplateType.GenericList;
	List list = ctx.Web.Lists.Add(creationInfo);
	list.Update();
	ctx.ExecuteQuery();
}

或者我们可以使用PnP PowerShell来实现它.

Or we can use PnP PowerShell to achieve it.

https://docs.microsoft .com/zh-CN/powershell/sharepoint/sharepoint-pnp/sharepoint-pnp-cmdlets?view = sharepoint-ps

https://github.com/SharePoint/PnP-PowerShell 最好的问候,

Dennis

Dennis


这篇关于使用Office 365中的成员组创建SPO列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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