SharePoint自动化系列——创建MMS terms
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/
PowerShell脚本实现MMS group、termSet、terms的自动化创建:
Add-PSSnapin Microsoft.SharePoint.PowerShell
function CreateTerms{
param($siteUrl,$groupName,$termSetName,$termsCount)
#Connect to the Metadata Service
$taxSite = Get-SPSite $siteUrl
$taxonomySession = Get-SPTaxonomySession -site $taxSite
$termStore = $taxonomySession.TermStores["Managed Metadata Service"]
$flag = $true
foreach($group in $termStore.Groups)
{
if($group.name -eq $groupName)
{
Write-Warning "Group exists."
$flag = $false
}
}
if($flag -eq $true)
{
$termGroup = $termStore.CreateGroup($groupName)
$termStore.CommitAll()
}else
{
$termGroup = $termStore.Groups[$groupName]
}
$flag = $true
foreach($termSet in $termGroup.termSets)
{
if($termSet.name -eq $termSetName)
{
Write-Warning "TermSet exists."
$flag = $false
}
}
if($flag -eq $true)
{
$termSet = $termGroup.createTermSet($termSetName)
$termStore.CommitAll()
}else
{
$termSet = $termGroup.termSets[$termSetName]
}
for($i=1;$i -le $termsCount;$i++)
{
try{
$termSet.CreateTerm("Term"+$i,1033)
$termStore.CommitAll()
}catch
{
Write-Warning "Term exists."
}
}
Read-Host
}
CreateTerms -siteUrl http://xxxx -groupName xxxx -termSetName xxxx -termsCount xx
脚本保存到ps1文件,在server上右键run with PowerShell即可。
实现:在Managed Metadata Service这个service application下创建指定名字的Group,Termset以及指定数量的Terms。如果有同名情况出现会提示相应内容已存在,不会重复创建:
SharePoint自动化系列——创建MMS terms的更多相关文章
- SharePoint自动化系列——Set MMS field value using PowerShell.
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 本章将总结一下设置SharePoint list中item的Managed Metadata fi ...
- SharePoint自动化系列——Site/Web/List级别的导航菜单
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 需求:在不同的测试用例中,对脚本中不确定的因素需要和用户交互来确定,比如选择哪个site,选择哪个 ...
- SharePoint自动化系列——通过Coded UI录制脚本自动化创建SharePoint Designer Reusable Workflow
Coded UI非常好,我开始还在想,怎么样能让一个通过SharePoint Designer创建的Workflow publish三百五十次?想不到一个好的方法,也不知道SharePoint Des ...
- SharePoint自动化系列——通过PowerShell创建SharePoint Web
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 代码如下(保存到本地ps1文件中,右键run with PowerShell即可): Add-PS ...
- SharePoint自动化系列——通过PowerShell创建SharePoint Site Collection
通过PowerShell创建SharePoint Site Collection,代码如下: Add-PSSnapin microsoft.sharepoint.powershell function ...
- SharePoint自动化系列——通过PowerShell创建SharePoint Lists
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 代码如下(保存到本地ps1文件中,右键run with PowerShell即可): Add-PS ...
- SharePoint自动化系列——通过PowerShell创建SharePoint List Items
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 代码如下(保存到本地ps1文件中,右键run with PowerShell即可): Add-PS ...
- SharePoint自动化系列——Add content type to list.
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 将创建好的content type(若是跨web application需要事先publish c ...
- SharePoint自动化系列——Create a local user and add to SharePoint
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 实现过程:在本地创建一个local user并将该user添加到Administrators组中, ...
随机推荐
- url组成部分
协议 eg:http 主机IP地址 eg :端口号8080 项目资源地址 eg:目录名,文件夹名
- PHP5各个版本的新功能和新特性总结(转载 http://www.jb51.net/article/48150.htm)
本文目录:PHP5.2 以前:autoload, PDO 和 MySQLi, 类型约束PHP5.2:JSON 支持PHP5.3:弃用的功能,匿名函数,新增魔术方法,命名空间,后期静态绑定,Heredo ...
- Repeater 时间格式化
Repeater 时间格式化 <%# Eval("AboutDate","{0:yyyy-MM-dd hh:mm:ss}")%> 个人认为最好用 ...
- SIFT算法详解(转)
http://blog.csdn.net/zddblog/article/details/7521424 目录(?)[-] 尺度不变特征变换匹配算法详解 Scale Invariant Feature ...
- ThinkPHP讲解(八)——显示、修改、添加、删除
一.显示数据 <h1>主页面</h1> <table width="100%" border="1" cellpadding=&q ...
- php基础知识和函数
<?php /* echo "hello","aaaa"; //输出语法,可以输出多个字符串 print "world"; //可以输 ...
- Fatal error: Call to a member function bind_param() on a non-object in
今天在练习 mysql是出现错误: Fatal error: Call to a member function bind_param() on a non-object in 解决步骤: 1. ...
- android 项目学习随笔十三(ListView实现ITEM点击事件,将已读状态持久化到本地)
1.因为给LISTVIEW增加了两个头布局,所以在点击事件ITEM索引会增加2,比如原来第一条数据的索引应该为0,增加两个头布局后,它的索引变为 2,为了使LISTVIEW的ITEM在点 ...
- mysql笔记02 创建高性能的索引
创建高性能的索引 1. 索引(在MySQL中也叫做"键(key)")是存储引擎用于快速找到记录的一种数据结构. 2. 索引可以包含一个或多个列的值.如果索引包含多个列,那么列的顺序 ...
- shell 日期加减
shell 日期加减运算 比如今日是2012-04-22 $ date -d "+1 day" +%Y-%m-%d 2012-04-23 $ date -d "- ...