在SharePoint 2010中用PowerShell添加列表项
一个使用powershell脚本向SharePoint 2010列表中添加列表项的例子。
$spAssignment = Start-SPAssignment $mylist = (Get-SPWeb -identity http://SP2010U -AssignmentCollection $spAssignment).Lists["Kind"] $newItem = $mylist.Items.Add() $newItem["标题"] = “生物科学” $newItem["Kind"] = “微生物学” $newItem.Update() Stop-SPAssignment $spAssignment
在本例中,我们使用Start-SPAssignment 和Stop-SPAssignment cmdlet来确保该对象正确的销毁。同时,注意我们指派Get-SPWeb给该assignment。然后,我们使用Add()方法来在SharePoint 2010中创建一个列表项。
参考资料