Tue. Jan 4th, 2022

function SearchforTitle($sitesList, $credentials)
{

try
{
foreach ($row in $sitesList)
{
$ListName = “SiteList”
$SiteTitle = $row.Title

        #CAML Query to Filter List Items
        $Query = "<View><Query><Where>
                <Eq>
                    <FieldRef Name='Title' /><Value Type='Text'>"+$SiteTitle+"</Value>
                </Eq>
        </Where></Query></View>"

        #Get All List Items matching given query
        $ListItems = Get-PnPListItem -List $ListName -Query $Query
        write-host Looking for $SiteTitle $ListItems.count
        if($ListItems.count -eq 1)
        {
            ForEach($Item in $ListItems)
            {
                $Sprint = $row.Sprint
                $SrcURL = $row.SrcURL
                $dstURL = $Item["URL"].Url
                $output = "$Sprint,$SiteTitle,$SrcURL,$dstURL"
                Add-Content $OutputFile $output
            }
        }
    } 
}catch{
    Write-Host "Error - " $_.Exception.Message -ForegroundColor Red
}

}

This website uses cookies. By continuing to use this site, you accept our use of cookies.