filtering and though a sharepoint list items with powershell

Posted by naijacoder on Stack Overflow See other posts from Stack Overflow or by naijacoder
Published on 2011-02-14T12:41:55Z Indexed on 2011/02/14 15:25 UTC
Read the original article Hit count: 229

Filed under:
|

I have tried below but not getting any result back Not sure if i'm doing this well. Can i filter in the foreach or in my if statement Thanks in advance

[DateTime] $CreatedDate = $item["Created"] 
$convertedCreatedDate = $CreatedDate.ToString("yyyy-MM-dd")
$today = (Get-Date).AddDays(-1).ToString("yyyy-MM-dd")

foreach ($item in $list.items | where {$convertedCreatedDate -eq $today}) {

    if ($list.items | where {$convertedCreatedDate -eq $today}) 
    {
        Write-Host $item["Created"] 
    }

    Write-Host $item["Created"] 
}

© Stack Overflow or respective owner

Related posts about powershell

Related posts about powershell-v2.0