I have found 100's of pages about getting groups, but best I can find about getting a list of all document is killing me!!
I have altered my script which works well with groups and tried to change it to documents.. but literally nothing is working for me.. executes and no errors
$site = Get-SPOSite https://mysharepointsite.sharepoint.com/sites/construction
#Get all web sites in the site collections
$wc = $site.AllWebs
foreach($w in $wc)
{
write-host "in-loop-one" -foreground "magenta"
#loopthrouh the lists and libraries in the site
foreach($l in $w.Lists)
{
write-host "in-loop-two" -foreground "magenta"
#Check for only document libraries
if($l.BaseTemplate -eq "DocumentLibrary")
{
write-host "in-if-three" -foreground "magenta"
Write-Host $l.Title"(Web: "$w.Title")"
}
}1
}
--
None of the write-host are triggering..
I have a document library called "documents" with 360 items in it.. I am trying to get a list of each of thoses documents..
can anyone point me in the right direction?
1
on the second-to-last line there. Otherwise, are you sure that the call toGet-SPOSite
is returning a site collection? If not,$site
will be$null
, and there will not be any$w
in$wc
. If$site -ne $null
, there will be at least oneSPWeb
(namely$site.RootWeb
), so the firstWrite-Host
will display.