Powershell script caml query date -how to get data based on modified date

$now = (Get-Date).AddDays(-1);
   $lastrun_converted = [microsoft.sharepoint.utilities.sputility]::CreateISO8601DateTimeFromSystemDateTime($now);
   write-host $lastrun_converted;
   $camlsource = "<Where><Geq><FieldRef Name='Modified'/><Value Type='DateTime' IncludeTimeValue='True'>$lastrun_converted</Value></Geq></Where>"
  
   #$query=new-object Microsoft.SharePoint.SPQuery
       $queryfromsource=new-object Microsoft.SharePoint.SPQuery  
   #$query.ViewAttributes = "Scope=`"Recursive`""
 
   $queryfromsource.ViewAttributes = "Scope=`"Recursive`""
   $queryfromsource.Query=$camlsource

1 comment:

  1. Outstanding! That solved my date comparison problem. Thank you!

    ReplyDelete

SPFX - HTTPClient - Curd Operations - SharePoint list.

  Create solution in the name of SpfxCrud. ISpfxCrudProps.ts export interface ISpfxCrudProps {   description : string ;     context : an...