Avatar of upobDaPlaya
upobDaPlaya
 asked on

What is the SharePoint cmdlet for lists, calendars, etc. for a SharePoint 2013 site using PowerShell

I have used the cmdlet Get-DocInventory  within a PowerShell script which gave me every single document on my site which was great.

However, I need everything above this level to be listed such as Calendars, Lists, Root Folders, etc.  What is the cmdlet to get this data and how do I within the powershell script indicate to export it to a csv file.
Microsoft SharePoint

Avatar of undefined
Last Comment
upobDaPlaya

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
colly92002

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
upobDaPlaya

ASKER
Thanks Colly92002 this is great and a a good reference - 2 quick follow-ups

1-How would I get the data out to a csv file ?
2-I understand you explanation about a list, it thus appears I would have everything by running the above so then you threw me for a curve when you mentioned "just extend it to cover whatever you want it to show:.."  what would be an example of me extending the above query ?

Thanks
colly92002

1 - Powershell has a handy Export-CSV cmdlet for this - example here: http://porchcode.blogspot.co.uk/2013/04/exporting-sharepoint-list-items-to-csv.html

2 - The example I gave you is very basic, it will export a single list, and only the "Title" column.  All I am trying to say is that you could add more code to export for example more columns from your list, or export more than a single list (cut'n'paste code block with a different list name).   If you wanted to, you add code to iterate through all the lists in your site and iterate through all the columns in the lists and export them all :)  Powershell is incredibly powerful, one you are started with it there is virtually no limit to what you can do.

Also, Windows comes with a really good Powershell dev envrionmnt, but it's hidden away for some reason.  Have a look at this: https://technet.microsoft.com/en-us/library/dd315244.aspx
upobDaPlaya

ASKER
Thanks Colly92002 to add more columns is there a handy reference where I would find the additional columns.  I assume I would just add below the line

{
        Write-Host $item.Title
        Write-Host $item.Col2 eg. Last Update
    }
}
while ($spQuery.ListItemCollectionPosition -ne $null)
$expath = $outPath + '\' + $list.Title + '.csv'
  $exportlist | Export-Csv -path $expath #$oPath

thx !
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
colly92002

Yes that is correct, just add more lines like:
Write-Host $item.Title
(I have a feeling the syntax is slightly diffferent for non-built in columns, see here for other examples of how to do this: http://www.thorntontechnical.com/tech/sharepoint/quick-tip-sharepoint-powershell-get-items-in-a-list-based-on-custom-columns-and-other-hints#.VRpxwuEvzks)

Here is an example of how to iterate through all the columns:
http://sharepoint-community.net/profiles/blogs/sharepoint-get-spfield-details-for-sharepoint-lists-using

Powershell can be infuriating as the syntax is very specific, and there are so many ways to do the same thing!  However it is very powerful so worth learning.
upobDaPlaya

ASKER
Thx !  I want to spend one more day reviewing and then I will post the grade. this is great thanks again
upobDaPlaya

ASKER
Great sample and more importantly a great resource to benefit my learning of PowerShell
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.