SharePoint發行版本有SharePoint2003、SharePoint2007、Sharepoint 2010、SharePoint2013和SharePoint2016。SharePoint提供了功能強大的團隊協作環境,使得組織能夠在整個組織內部實現整合、組織、查找和提供 SharePoint站點。 最近,有這么個需求,需要使用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和其他對象一些簡單的語法區別即可。
Sharepoint 可以幫助企業用戶輕松完成日常工作。
|