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

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

Add-PSSnapin microsoft.sharepoint.powershell
function CreateSPLists()
{
$sites = Get-SPSite
if($sites.count -eq )
{
Write-Warning "There is no site available."
CreateSPLists
}
else
{
Write-Host "Choose the site:" -ForegroundColor Yellow
for($i=;$i -lt $sites.count;$i++)
{
$tip = "["+$i+"]."+$sites[$i].url
Write-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 Green
Write-Host "Choose the web:" -ForegroundColor Yellow
$webs = $sites[[int]$choice].AllWebs
for($i=;$i -lt $webs.count;$i++)
{
$tip = "["+$i+"]."+$webs[$i].url
Write-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=;$i -le $amount;$i++)
{
$ran = Get-Random
$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

运行界面:

SharePoint自动化系列——通过PowerShell创建SharePoint Lists的更多相关文章

  1. SharePoint自动化系列——通过PowerShell创建SharePoint Site Collection

    通过PowerShell创建SharePoint Site Collection,代码如下: Add-PSSnapin microsoft.sharepoint.powershell function ...

  2. SharePoint自动化系列——通过PowerShell创建SharePoint List Items

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 代码如下(保存到本地ps1文件中,右键run with PowerShell即可): Add-PS ...

  3. SharePoint自动化系列——通过PowerShell创建SharePoint Web

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 代码如下(保存到本地ps1文件中,右键run with PowerShell即可): Add-PS ...

  4. SharePoint自动化系列——通过PowerShell在SharePoint中批量做数据

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ PowerShell是基于.NET的一门脚本语言,对于SharePoint一些日常操作支持的很好. ...

  5. SharePoint自动化系列——Upload files to SharePoint library using PowerShell.

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 日常的SharePoint站点测试中,我们经常要做各种各样的数据,今天又写了几个脚本,发现自己写的 ...

  6. 使用PowerShell 创建SharePoint 站点

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

  7. SharePoint自动化系列——Site/Web/List级别的导航菜单

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 需求:在不同的测试用例中,对脚本中不确定的因素需要和用户交互来确定,比如选择哪个site,选择哪个 ...

  8. SharePoint自动化系列——创建MMS terms

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ PowerShell脚本实现MMS group.termSet.terms的自动化创建: Add- ...

  9. SharePoint自动化系列——Manage "Site Subscriptions" using PowerShell

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 你可以将普通的sites加入到你的site subscriptions中,前提是你需要有一个 Te ...

随机推荐

  1. 元程序 /如何取test.py中name的值

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #Python学习手册 633 #模块是对象:元程序 #因为模块通过内置属性显示了他们的大多数特性,因此很容易 ...

  2. LEGO机器人发展史

    1998,cybermaster 1999,RCX 1999,micro scout 2000,scout 2002,spybotics NXT NXT2 EV3

  3. openssl的证书格式转换

    证书转换 PKCS 全称是 Public-Key Cryptography Standards ,是由 RSA 实验室与其它安全系统开发商为促进公钥密码的发展而制订的一系列标准,PKCS 目前共发布过 ...

  4. 腾讯云-NGINX搭建静态网站

    搭建静态网站 搭建Http静态服务器环境 任务时间:15min ~ 30min 搭建静态网站,首先需要部署环境.下面的步骤,将告诉大家如何在服务器上通过 Nginx 部署 HTTP 静态服务. 00. ...

  5. Oracle的PLSQL别名中文出现乱码解决方法

     乱码之乱,乱在心里.行而上,眼迷茫! 01.查询oracle服务端默认语言 select * from nls_database_parameters NLS_LANGUAGE AMERICAN   ...

  6. 转:一个多目录结构C程序的Makefile

    来源: ChinaUnix博客 一个多目录结构的C程序Makefile,代码存在main init input output exit目录. CC = gcc RDIR = RelsMAIN_DIR ...

  7. hihoCoder 1014 Trie树 (Trie)

    #1014 : Trie树 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描写叙述 小Hi和小Ho是一对好朋友.出生在信息化社会的他们对编程产生了莫大的兴趣,他们约定好互相帮 ...

  8. iOS UIKit Dynamics入门 UIKit动力学,实现重力、连接、碰撞、悬挂等动画效果

    本文为转载文章 版权归原文所有 什么是UIKit动力学(UIKit Dynamics) 其实就是UIKit的一套动画和交互体系.我们现在进行UI动画基本都是使用CoreAnimation或者UIVie ...

  9. mybatis实现多表联合查询

    本文转自:http://www.cnblogs.com/xdp-gacl/p/4264440.html#!comments 一.一对一关联 1.1.提出需求 根据班级id查询班级信息(带老师的信息) ...

  10. setContentView(R.layout.activity_main)无法正常引用

    今天在写Android代码的过程中,编译器一直报错,错误出在这一行代码: setContentView(R.layout.activity_main) 提示信息是: activity_main can ...