错误截图错误日志位置:C:\ProgramFiles\CommonFiles\microsoftshared\WebServerExtensions\15\LOGS主要错误ThecurrentuserisnotanSharePointServerfarmadministrator.处理过程查看了当前User确实不是场管理员,但......
2022-04-11 67 SharePoint ERROR the current user not Server farm 错误
最近,有这么个需求,需要使用PowerShell为网站集创建网站栏,好吧,直接看代码吧。
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$webUrl = "HTTP://SITEURL"
$listname = "LISTNAME"
$fieldname = "FIELDNAME"
$IsRequired = $False
$FieldType = [Microsoft.SharePoint.SPFieldType]::Text
$site = Get-SPSite $webUrl
$Web = $site.OpenWeb()
$list = $web.Lists.TryGetList($listname)
$field = $list.Fields[$fieldname];
if($field -eq $null)
{
$list.Fields.Add($fieldname,$FieldType,$IsRequired)
$list.Update()
Write-Host $fieldname "is created"
}
else
{
Write-Host $fieldname "is already exist"
}
复制代码
结束语
其实,整个代码逻辑和SharePoint其他对象很相似,只要掌握PowerShell和其他对象一些简单的语法区别即可。
标签: PowerShell创建网站栏
相关文章
SharePoint2013爬网报错AnunrecognizedHTTPresponsewasreceivedwhenattemptingtocrawlthisitem.Verifywhethertheitemcanbeaccessedusingyourbrowser.然后登陆网站,发现在服务器上输入3次用户名密码白页,考虑到......
2022-04-11 449 SharePoint ERROR unrecognized HTTP response was received
最近使用SharePoint中,遇到一个需要重命名网站集的需求,主要是网站用数据库备份/还原的方式,想要改网站集的地址,然后搜了一下PowerShell:$site=Get-SPSite-Identityhttp://server/sites/Demo$site.......
2022-04-11 299 SharePoint重命名网站集名称