Lif*_*ipt 3 powershell sharepoint
如何使用PowerShell修改SharePoint列表中的项目值?当我尝试以下内容时:
$splist.GetItems() | ForEach-Object{
#Write-Host $_["Item"]
if($_["Item"] -eq $null){
$SPFileCollection = $folder.Files
$upFile=Get-ChildItem D:\Tools\SP-scripts\MDNSO-template.aspx
$tmpValue = $_["Title"]
$filename = "EM_Doc_Library\$tmpValue"
$SPFileCollection.Add("EM_Doc_Library\$tmpValue",$upFile.OpenRead(),$false)
Write-Host "creating the file"
Write-Host $_["Title"]
$_["Item"] = "MDNSO-<$tmpValue>"
}
}
Run Code Online (Sandbox Code Playgroud)
它说,unable to index into an object of type SPlistItem.
以下是您可以尝试执行的操作的摘要:
$spWeb = Get-SPWeb -Identity http://yourdomain/sites/config
$spList = $spWeb.Lists["AppSettings"]
$spItem = $spList.GetItemById(10013) //or another way that you prefer.
$spItem["Name"] = "MyName"
$spItem.Update()
Run Code Online (Sandbox Code Playgroud)
有关详细信息,请查看此博客文章.它包含了如何添加,更新和删除列表项使用PowerShell的例子:http://mysharepointwork.blogspot.no/2010/09/addupdatedelete-list-items-using.html
| 归档时间: |
|
| 查看次数: |
44362 次 |
| 最近记录: |