powershell - Can I pass Parameter using Get-SPWeb andgetting list -


i'm using next code list of data sharepoint , export text file can pass parameter data date date : select * between

$myweb = get-spweb "http://ilike-eg.suz.itcgr.net/sm" $mylist = $myweb.lists["scgc"]  $exportlist = @()  $mylist.items |  foreach-object { $obj =   new-object psobject -property @{          "a"="   "+$_["aaccount_id"]         "b"="   "+$_["btransaction_id"]         "c"="          "+$_["cdate"]          "d"="      "+$_["dcustomer_id"]         "e"="     "+$_["ecustomer_name"]         "f"=" "+$_["famount"]         "g"=$_["gclass"]  }  #remove unnecessary sort $exportlist += $obj    $datestamp = get-date -uformat "%y-%m-%d@%h-%m-%s" $nameonly = "cdp"   #exporting sorted properties $exportlist | select-object a,b,c,d,e,f,g | export-csv -delimiter "`t"-path "$nameonly.txt" }  #removed duplicate get-content line $a, ${d:cdp.txt} = get-content .\cdp.txt  #combined replace statements avoid multiple read/writes (get-content d:\cdp.txt) | foreach-object {$_ -replace $([char]34) -replace "`t" -replace '/', ''} | set-content d:\cdp.txt   

yes, replace code:

$mylist.items | foreach-object {

with similar following code (you need declare date1 - startdate , date2 - enddate):

$mylist.items | {$_['created'] -gt $date1 -and $_['created'] -lt $date2} | foreach-object {


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -