Get Files and Folders from SharePoint Document Library RRS feed

  • Question

  • Hi Guys,

    I'm new to PowerShell, I need to loop through a document library and get metadata of the files and folders.

    I'm looking also for empty folders to delete them.

    I was able to get something working but not the document library see my code below

    #Using PnP PowerShell Cmdlets
    #Get Connection Credential
    $User = "myuser@username.com"
    $File = "C:\Users\myuser\OneDrive - username\mycompany\PowerShell\MyPassword.txt"
    $Cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, (Get-Content $File | ConvertTo-SecureString)
    #connect to the pnp extension 
    Connect-SPOnline -Url https://my.sharepoint.com -Credentials $Cred 
    #Get-help Get-SPOList -Examples
    Get-SPOList | Format-Table
    #get-help Get-SPOList -Examples
    #Get-Help Get-PnPFolder -Examples


    Thursday, December 22, 2016 10:32 PM

All replies

  • The url has to point to you SharePoint management site.

    https://<your domainname>.sharepoint.com


    Thursday, December 22, 2016 10:58 PM
  • I changed mydomainname purposely to my.sharepoint for abstraction only.

    when I use all my variables correct the syntax is working but it's bringing some lists I want to bring or read document library files and folders



    Friday, December 23, 2016 2:49 AM
  • ????? - Clear as mud.


    Friday, December 23, 2016 2:51 AM