转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/

代码如下(保存到本地ps1文件中,右键run with PowerShell即可):

Add-PSSnapin microsoft.sharepoint.powershell
function CreateSPLists()
{$sites = Get-SPSiteif($sites.count -eq 0){Write-Warning "There is no site available."CreateSPLists}else{Write-Host "Choose the site:" -ForegroundColor Yellowfor($i=0;$i -lt $sites.count;$i++){$tip = "["+$i+"]."+$sites[$i].urlWrite-Host $tip}$choice = Read-Host "Enter the number before"$tip = "You chose "+$choice+". "+"The site you chose is '"+$sites[[int]$choice].url+"'"Write-Host $tip -ForegroundColor GreenWrite-Host "Choose the web:" -ForegroundColor Yellow$webs = $sites[[int]$choice].AllWebsfor($i=0;$i -lt $webs.count;$i++){$tip = "["+$i+"]."+$webs[$i].urlWrite-Host $tip}$choice = Read-Host "Enter the number before"$tip = "You chose "+$choice+". "+"The web you chose is '"+$webs[[int]$choice].url+"'"Write-Host $tip -ForegroundColor Green$amount = Read-Host "How many lists do you want to create"$titleEp = Read-Host "Give an example of the list title, such as 'tylan'"$web = $webs[[int]$choice]for($i=1;$i -le $amount;$i++){$ran = Get-Random 10000$titleEp = $ran.toString()+$titleEp+$i.toString()$web.Lists.Add($titleEp,"",$web.ListTemplates["Custom List"])}Write-Host "List(s) has(have) been created successfully."$choice = Read-Host "Press 'c' to continue"if($choice -eq "c"){CreateSPLists}}
}
CreateSPLists

运行界面:

转载于:https://www.cnblogs.com/LanTianYou/p/4832793.html

SharePoint自动化系列——通过PowerShell创建SharePoint Lists相关推荐

  1. 使用PowerShell 创建SharePoint 网站

    使用PowerShell 创建SharePoint 网站 在SharePoint开发中,你应该学会使用PowerShell管理SharePoint站点.SharePoint Management Sh ...

  2. SharePoint自动化系列——通过Coded UI录制脚本自动化创建SharePoint Designer Reusable Workflow...

    Coded UI非常好,我开始还在想,怎么样能让一个通过SharePoint Designer创建的Workflow publish三百五十次?想不到一个好的方法,也不知道SharePoint Des ...

  3. SharePoint自动化系列——Add/Remove Record from items

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 目的:批量的将SharePoint items变成records或者将records变成普通的it ...

  4. SharePoint自动化系列——Error features自动deactivate

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ SharePoint Content Deployment prerequisite--Error ...

  5. SharePoint自动化系列——Solution auto-redeploy using Selenium(C#)

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 本来的想法是做一个可以自动卸载并且部署新solution到SharePoint farm的tool ...

  6. 【OWA】04集成SharePoint:SharePoint集成OWA详细步骤(SharePoint与OWA集成)

    前言 在前面咱们已经从owa服务器创建.把owa服务加入域控.在owa服务器中安装部署office web app server,接下载咱们一起来了解一下owa如何域SharePoint做集成(Sha ...

  7. SharePoint自动化部署,利用PowerShell 导入用户至AD——PART II

    这是对上一篇文章<SharePoint自动化部署,利用PowerShell 导出/导入AD中的用户>进行补充.开发时,为了测试和演示,我们往往需要经常性的把用户添加到AD中.数据量小的时候 ...

  8. PowerShell 在 SharePoint 2010 自动化部署中的应用(2)-编译打包

    上次说到通过PowerShell将项目代码从TFS服务器拿到本地,这次再说说编译和打包的经历 2 编译打包 我相信做过SharePoint2007的都有过打包时恶梦般的经历,Cabinet SDK,V ...

  9. Powershell配置SharePoint环境

    Powershell配置SharePoint环境 1. 设置outgoing email: 1) Powershell: $loadasm =[System.Reflection.Assembly]: ...

最新文章

  1. ISME:林科院袁志林等-冷杉优势真菌共生发育的基因家族趋同演化及平衡选择机制...
  2. python r语言 作图_R语言低级绘图函数-rect
  3. 《Adobe Flash Professional CC经典教程》——1.12 发布影片
  4. JQUERY的html()
  5. Linux (七) 网络
  6. notepad php格式,notepad怎么格式xml
  7. 什么是jsf_为什么应该避免JSF
  8. Git初学札记(四)————Git Push的常规操作与Pull冲突解决
  9. intellij idea elixir 插件
  10. MySQL报错113_连接 MySQL 报错'NoneType' object has no attribute '__getitem__'
  11. 微软应用商店_重新安装微软应用商店,并解决无法联网的问题
  12. U盘刻录方式安装CentOS 7
  13. Python-文件操作
  14. 社区英雄榜:谁是真正的技术英雄?
  15. 移动端高清、多屏幕适配方案
  16. cf不能全屏win7的解决方法_怎么解决win7电脑没声音 win7电脑没声音解决方法介绍【详解】...
  17. Android 手电筒的开启方法
  18. SQL Server Intergration Services(SSIS)
  19. 打造有企业特色的ERP
  20. Asp.net Core 自带DI依赖注入

热门文章

  1. laravel生成php代码,laravel代码生成器
  2. matlab求最大公倍数_小学数学最大公因数最小公倍数练习
  3. 怎么看台式计算机是几位的,怎么看电脑是32位还是64位?一目了然
  4. 字母三角形c语言ABBBCCCCC,C语言输出ABBBCCCCCDDDDDDDCCCCCBBBA
  5. H5 存储数据sessionStorage
  6. ionic自动生成启动页和图标
  7. java 数据库mysql_java是怎么连接mysql数据库的
  8. 最大子序列求和_最大连续子序列和
  9. java怎么实现打牌_JAVA入门第三季实战:简易扑克牌
  10. mysql 语法树_Inception 语法树打印(15)