我有一个csv文件,我能够使用客户端powershell将数据导入到包含单行文本和多行的SP列表,但我无法导入查找值。如何将csv中的列导入查阅列。(这就是如何动态设置查找的id)
答案 0 :(得分:0)
#For Lookup values: Lookup Parent List
$DepartmentList=$web.Lists["Department"]
#Get the Lookup Item from Parent List
$LookupItem = $departmentList.Items | Where-Object { $_.Item("Title") -eq $row.Department}
if($LookupItem -ne $null)
{
$deptLookup = New-Object Microsoft.Sharepoint.SPFieldLookupValue($LookupItem.ID,$row.Department)
}
#Set the Lookup field value
$item["Department"] = $deptLookup
$item.Update()
Read more: http://www.sharepointdiary.com/2013/04/import-from-csv-file-to-sharepoint-list-using-powershell.html#ixzz40VmbNqi0
其中$ row变量是csv row。