0

I want to recreate a clients' ct structure using VS2012 so some cts and their guids I did have a go but it would be nice only to add the properties I want to my csv file rather than whole lot.. Any suggestions please

$site = Get-SPSite http://myclient.local/

$web = $site.RootWeb

$psObject = New-Object psobject
foreach ($ctype in $web.ContentTypes) 
{
  $OutputString = $ctype.Name,$ctype.Group,$ctype.Id, $ctype.Description 

Add-Member -InputObject $psobject -MemberType noteproperty -Name $ctype.Name -  Value $ctype  

#$ExportInfo += $ctype.Name
#$ExportInfo += $ctype.Group
#$ExportInfo += $ctype.Id
#$ExportInfo += $ctype.Description

}

     $psobject | Export-CSV c:\dev\Ctlist4.csv -NoTypeInformation
0
$web = Get-SPWeb http://myclient.local/

$web.ContentTypes | Select-Object Name, Group, Id, Description | Export-Csv c:\dev\Ctlist4.csv -NoTypeInformation
  • Thanks... I think I need learn that short hand for describing an object.... – westerdaled Jul 2 '13 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.