0

在共享点库中。我有带有元数据的文件夹(在列中)。我需要循环遍历每个文件夹的子文件夹和子文件夹中的文件,并将父文件夹中的元数据添加到子文件夹和文件中。

你能给我powershell循环吗?

我正在尝试这两个循环不能很好地工作。

$web = Get-SPWeb "https://testweb"
$list = $web.lists["TestDoc"]
Function Get-FilesFromFolder([Microsoft.SharePoint.Client.Folder]$Folder)
{
    $Ctx.load($Folder.files)
    $Ctx.ExecuteQuery()
    
    ForEach ($File in $Folder.files)
    {
       $File["Input"] = $Folder["Input"]
    }
    $Ctx.load($Folder.Folders)
    $Ctx.ExecuteQuery()
 
    #Exclude "Forms" system folder and iterate through each folder
    ForEach($SubFolder in $Folder.Folders | Where {$_.Name -ne "Forms"})
    {
        $SubFolder["Input"] = $Folder.Folders["Input"]
    }
}
4

0 回答 0