SharePoint自动化系列——通过PowerShell创建SharePoint Lists
转载请注明出自天外归云的博客园: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的更多相关文章
- SharePoint自动化系列——通过PowerShell创建SharePoint Site Collection
通过PowerShell创建SharePoint Site Collection,代码如下: Add-PSSnapin microsoft.sharepoint.powershell function ...
- SharePoint自动化系列——通过PowerShell创建SharePoint List Items
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 代码如下(保存到本地ps1文件中,右键run with PowerShell即可): Add-PS ...
- SharePoint自动化系列——通过PowerShell创建SharePoint Web
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 代码如下(保存到本地ps1文件中,右键run with PowerShell即可): Add-PS ...
- SharePoint自动化系列——通过PowerShell在SharePoint中批量做数据
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ PowerShell是基于.NET的一门脚本语言,对于SharePoint一些日常操作支持的很好. ...
- SharePoint自动化系列——Upload files to SharePoint library using PowerShell.
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 日常的SharePoint站点测试中,我们经常要做各种各样的数据,今天又写了几个脚本,发现自己写的 ...
- 使用PowerShell 创建SharePoint 站点
使用PowerShell 创建SharePoint 站点 在SharePoint开发中,你应该学会使用PowerShell管理SharePoint网站.SharePoint Manag ...
- SharePoint自动化系列——Site/Web/List级别的导航菜单
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 需求:在不同的测试用例中,对脚本中不确定的因素需要和用户交互来确定,比如选择哪个site,选择哪个 ...
- SharePoint自动化系列——创建MMS terms
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ PowerShell脚本实现MMS group.termSet.terms的自动化创建: Add- ...
- SharePoint自动化系列——Manage "Site Subscriptions" using PowerShell
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 你可以将普通的sites加入到你的site subscriptions中,前提是你需要有一个 Te ...
随机推荐
- exception javax.crypto.BadPaddingException: Given final block not properly padded
exception javax.crypto.BadPaddingException: Given final block not properly padded CreationTime--20 ...
- venus之hello world
Venus Service Framework提供服务器端开发SDK以及客户端SDK.它们之间采用Venus自定义的私有协议.encoder.decoder采用多种序列化方式,客户端根据自己的语言选择 ...
- 图文例解C++类的多重继承与虚拟继承
文章导读:C++允许为一个派生类指定多个基类,这样的继承结构被称做多重继承. 在过去的学习中,我们始终接触的单个类的继承,但是在现实生活中,一些新事物往往会拥有两个或者两个以上事物的属性,为了解决这个 ...
- SpringBoot之自定义验证码
代码地址如下:http://www.demodashi.com/demo/14280.html 项目介绍 Spring Security是一个能够为基于Spring的企业应用系统提供声明式的安全访问控 ...
- HDUOJ---hello Kiki
Hello Kiki Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 修改Subversion用户登录密码
找到svn建立的repository地址 %repository%/xxxx库/conf/ 修改passwd文件即可
- JavaScript和JQuery中的事件\委托链\事件冒泡\事件捕获,兼容所有浏览器
有做过北大青鸟培训讲师经验的我,如今在一家公司做技术部经理的职位,发现有很多程序员的基本功相当糟糕,在组织企业内部培训时讲解了一些案例,总结了一些经典代码,希望对自己和有需要的人提供一些帮助吧: Ja ...
- Concurrency Managed Workqueue(二)CMWQ概述
一.前言 一种新的机制出现的原因往往是为了解决实际的问题,虽然linux kernel中已经提供了workqueue的机制,那么为何还要引入cmwq呢?也就是说:旧的workqueue机制存在什么样的 ...
- Linux内核scatterlist API介绍
1. 前言 我们在那些需要和用户空间交互大量数据的子系统(例如MMC[1].Video.Audio等)中,经常看到scatterlist的影子.对我们这些“非英语母语”的人来说,初见这个词汇,脑袋瞬间 ...
- ASP.NET自定义Web服务器控件-DropDownList/Select下拉列表控件
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; usin ...