使用powershell将列表内容类型数据导出到sharepoint中的CSV

时间:2016-11-22 20:13:33

标签: powershell sharepoint

我正致力于将列表内容类型数据中的数据导出为CSV。我能够将数据提取到CSV,但它会带来一些来自字段链接的垃圾值。

<dnn:DnnJsInclude runat="server" 
                  PathNameAlias="SkinPath"
                  FilePath="js/theme.min.js" 
                  ForceProvider="DnnFormBottomProvider" 
                  Priority="10000" />

并且输出包含一些带有数据的错误值,我复制了两个字段值:

$url = "http://mysite/abc"
$listName = "Issues"
$web = Get-SPWeb $url
$list = $web.Lists.TryGetList($listName)
$fields = $list.ContentTypes | %{ $_.FieldLinks } 
$items = @() #array to store objects representing list items
$list.Items | %{
  $item = $_; 
  $hash = @{}; #hash table to store field name-value pairs
  $fields | %{ $hash[$_.DisplayName] = $item[$_.DisplayName] }; 
  $items += New-Object PSObject -Property $hash
}
$items | Export-Csv -Path "C:\Temp\test2.csv" -NoTypeInformation

<div class="ExternalClass756614A031B94F15B792C243E62683BA"><p>?Vacations rearranged to remove conflict.&#160; No impact to project schedule</p></div>

0 个答案:

没有答案