Skip to main content
adding query. Somehow it got missing in the question
Source Link
sk5991
  • 23
  • 1
  • 4

For example: I have a following SharePoint list:

ID FileName Modified

11 Text.docx 15 Aug 2018

13 Text2.docx 25 May 2013

14 Text3.docx 12 Mar 2011

My output should look like this: List ID 11 and Modified on 15 Aug 2018

I tried something below but in the section, I have added which gives all the update done in the last 30 days. However this doesn't satisfies my example's output above:

$SiteURL="https://abc.sharepoint.com/site/sitename $ListName="Testing" Connect

Connect-PnPOnline -Url $SiteURL -Credentials $Credentials $Query= " "

$Query="<View <Query <Where <Gt <FieldRef Name='Modified' Type='DateTime'/ <Value Type='DateTime' IncludeTimeValue='TRUE' <Today OffsetDays='-30'/ </Value </Gt </Where </Query </View"

$ListItems = Get-PnPListItem -List $ListName -Query $Query Write-host "Total Number of Items Found:"$ListItems.count

$ListItems | ForEach-Object { Write-host ("List Item: {0} was Modified on {1}" -f $["FileLeafRef"],$["Modified"]) }

Please help.

For example: I have a following SharePoint list:

ID FileName Modified

11 Text.docx 15 Aug 2018

13 Text2.docx 25 May 2013

14 Text3.docx 12 Mar 2011

My output should look like this: List ID 11 and Modified on 15 Aug 2018

I tried something below but in the section, I have added which gives all the update done in the last 30 days. However this doesn't satisfies my example's output above:

$SiteURL="https://abc.sharepoint.com/site/sitename $ListName="Testing" Connect-PnPOnline -Url $SiteURL -Credentials $Credentials $Query= " "

$ListItems = Get-PnPListItem -List $ListName -Query $Query Write-host "Total Number of Items Found:"$ListItems.count

$ListItems | ForEach-Object { Write-host ("List Item: {0} was Modified on {1}" -f $["FileLeafRef"],$["Modified"]) }

Please help.

For example: I have a following SharePoint list:

ID FileName Modified

11 Text.docx 15 Aug 2018

13 Text2.docx 25 May 2013

14 Text3.docx 12 Mar 2011

My output should look like this: List ID 11 and Modified on 15 Aug 2018

I tried something below but in the section, I have added which gives all the update done in the last 30 days. However this doesn't satisfies my example's output above:

$SiteURL="https://abc.sharepoint.com/site/sitename $ListName="Testing"

Connect-PnPOnline -Url $SiteURL -Credentials $Credentials

$Query="<View <Query <Where <Gt <FieldRef Name='Modified' Type='DateTime'/ <Value Type='DateTime' IncludeTimeValue='TRUE' <Today OffsetDays='-30'/ </Value </Gt </Where </Query </View"

$ListItems = Get-PnPListItem -List $ListName -Query $Query Write-host "Total Number of Items Found:"$ListItems.count

$ListItems | ForEach-Object { Write-host ("List Item: {0} was Modified on {1}" -f $["FileLeafRef"],$["Modified"]) }

Please help.

Source Link
sk5991
  • 23
  • 1
  • 4

Getting latest modified item ID and Modified date from SharePoint list using PowerShell

For example: I have a following SharePoint list:

ID FileName Modified

11 Text.docx 15 Aug 2018

13 Text2.docx 25 May 2013

14 Text3.docx 12 Mar 2011

My output should look like this: List ID 11 and Modified on 15 Aug 2018

I tried something below but in the section, I have added which gives all the update done in the last 30 days. However this doesn't satisfies my example's output above:

$SiteURL="https://abc.sharepoint.com/site/sitename $ListName="Testing" Connect-PnPOnline -Url $SiteURL -Credentials $Credentials $Query= " "

$ListItems = Get-PnPListItem -List $ListName -Query $Query Write-host "Total Number of Items Found:"$ListItems.count

$ListItems | ForEach-Object { Write-host ("List Item: {0} was Modified on {1}" -f $["FileLeafRef"],$["Modified"]) }

Please help.