My goal is to upload approximately 10,000 folders to a SharePoint library (call it T2) and create a list in SharePoint (say T1) that lists these folders along with other details and their corresponding links for access.
Users can access this T1 list, filter, search, and sort. If they want to view a specific case, they can click on the link and access the folder (in T2). I’ve managed to upload a portion of the folders for testing, and I’ve also figured out how to create the list with all the relevant fields.
However, I’m having difficulty understanding how to obtain the links to the folders. Moreover, it appears that by default, such links are not present. Let me explain further: I manually copied the link to one of the folders (in T2) for testing purposes and added it to the list (in T1). Later, I found an online script and tried it out. Interestingly, only one folder from the library appeared when I ran the script. I manually copied a second folder link and ran the script again, and both folders showed up. It seems that I need to authorize sharing first.
For creating folders and files, I use this piece of code:
#Function to upload all files from a local folder to SharePoint Online Folder
Function Upload-PnPFolder($LocalFolderPath, $TargetFolderURL)
{
Write-host "Processing Folder:"$LocalFolderPath -f Yellow
#Get All files and SubFolders from the local disk
$Files = Get-ChildItem -Path $LocalFolderPath -File
#Ensure the target folder
Resolve-PnPFolder -SiteRelativePath $TargetFolderURL | Out-Null
#Upload All files from the local folder to SharePoint Online Folder
ForEach ($File in $Files)
{
Add-PnPFile -Path "$($File.Directory)\$($File.Name)" -Folder $TargetFolderURL -Values @{"Title" = $($File.Name)} | Out-Null
Write-host "`tUploaded File:"$File.FullName -f Green
}
}
The code I'm using to get the link is this one: How to get a list of shared links in a SharePoint Online document library? Any PowerShell or other way?
How do I get the list of ALL the uploaded folders?
Thanks for all the help.