在SharePoint2007下测试通过。
使用SharePoint对象模型:
SPFieldCollection collFields = list.Fields; //Update the calculated column if (collFields.ContainsField("Document ID")) { collFields["Document ID"].Update(); }
使用Powershell:
[System.Reflection.Assembly]::LoadWithPartialName(”Microsoft.SharePoint”) #This will get the site URL $siteUrl= http://Site URL #This is to get the WebApp $webName = "WebAppName" $spSite = new-object Microsoft.SharePoint.SPSite($siteurl) $spWeb = $spSite.OpenWeb() Write-Host $spList = $spWeb.Lists["ListName"] Write-Host {list found} $collFields = $spList.Fields[""]; $collFields.Formula= "=[Field1]+[Field1No]+[Field45No]" $collFields.update();