sdk-powershell-api-v2 icon indicating copy to clipboard operation
sdk-powershell-api-v2 copied to clipboard

Looking For File Update & File Property Change Cmdlets

Open uspeoples opened this issue 10 years ago • 0 comments

I was hoping to find file upload & change file properties cmdlets. I've been able to use DAV with 'net use' to create a Windows drive letter "net use b: \dav.box.com@SSL\dav /u:[email protected] password" but later found that DAV doesn't preserve modified dates, which is problematic. If you happen to have a PowerShell script which uploads files to Box or one that changes the lastaccesstime, please email me at grjenkins AT gmail . com. Thanks.

BTW - thought I'd share my first attempt at capturing the full folder structure.

$folderlist = $nul $temp = $nul $children = $nul

if ($folderlist -eq $nul){$Folderlist = (irm "https://api.box.com/2.0/folders/0/items?fields=type,parent,id,name" -headers $Authheader).entries|? {$_.type -eq "folder"}}

$folderlist|add-member -notepropertyname Processed -notepropertyvalue No $folderlist|add-member -notepropertyname Path -notepropertyvalue ""

Folder: 2951467469 - FPAs

$i = 1

do{

$children = $folderlist|? {$.id -ne "234234234" -and $.id -ne "222333444" -and $.id -ne "235234234" -and $.processed -eq "No"}

foreach ($c in $children){ $url = ("https://api.box.com/2.0/folders/" + $c.id + "/items?fields=type,parent,id,name&limit=1000&offset=0") $url1 = ("https://api.box.com/2.0/folders/" + $c.id + "/items?fields=type,parent,id,name&limit=1000&offset=1000") $url2 = ("https://api.box.com/2.0/folders/" + $c.id + "/items?fields=type,parent,id,name&limit=1000&offset=2000") $url3 = ("https://api.box.com/2.0/folders/" + $c.id + "/items?fields=type,parent,id,name&limit=1000&offset=3000") $url4 = ("https://api.box.com/2.0/folders/" + $c.id + "/items?fields=type,parent,id,name&limit=1000&offset=4000") $url5 = ("https://api.box.com/2.0/folders/" + $c.id + "/items?fields=type,parent,id,name&limit=1000&offset=5000") $url6 = ("https://api.box.com/2.0/folders/" + $c.id + "/items?fields=type,parent,id,name&limit=1000&offset=6000") $url7 = ("https://api.box.com/2.0/folders/" + $c.id + "/items?fields=type,parent,id,name&limit=1000&offset=7000") $url8 = ("https://api.box.com/2.0/folders/" + $c.id + "/items?fields=type,parent,id,name&limit=1000&offset=8000") $url9 = ("https://api.box.com/2.0/folders/" + $c.id + "/items?fields=type,parent,id,name&limit=1000&offset=9000") $temp = (irm $url -headers $Authheader).entries|? {$.type -eq "folder"} if ($temp.count -eq 1000){$temp += (irm $url1 -headers $Authheader).entries|? {$.type -eq "folder"}} if ($temp.count -eq 2000){$temp += (irm $url2 -headers $Authheader).entries|? {$.type -eq "folder"}} if ($temp.count -eq 3000){$temp += (irm $url3 -headers $Authheader).entries|? {$.type -eq "folder"}} if ($temp.count -eq 4000){$temp += (irm $url4 -headers $Authheader).entries|? {$.type -eq "folder"}} if ($temp.count -eq 5000){$temp += (irm $url5 -headers $Authheader).entries|? {$.type -eq "folder"}} if ($temp.count -eq 6000){$temp += (irm $url6 -headers $Authheader).entries|? {$.type -eq "folder"}} if ($temp.count -eq 7000){$temp += (irm $url7 -headers $Authheader).entries|? {$.type -eq "folder"}} if ($temp.count -eq 8000){$temp += (irm $url8 -headers $Authheader).entries|? {$.type -eq "folder"}} if ($temp.count -eq 9000){$temp += (irm $url9 -headers $Authheader).entries|? {$.type -eq "folder"}} $temp|add-member -notepropertyname Processed -notepropertyvalue No if ($c.path){$temp|add-member -notepropertyname Path -notepropertyvalue ($c.path + "" + $c.name)} if (!($c.path)){$temp|add-member -notepropertyname Path -notepropertyvalue ($c.parent.name + "" + $c.name)} if (($c.path) -and ($c.path -like "\folder\subfolder")){$temp|add-member -notepropertyname UNC -notepropertyvalue ($c.path.replace('\folder\subfolder','\server\share\folder\subfolder\Box Sync') + $c.name)} $folderlist += $temp $c.parent = $c.parent.id $c.Processed = "Yes" } $i++ } while ($i -le 100)

$folderlist = $folderlist|sort -unique ID

uspeoples avatar Apr 19 '15 05:04 uspeoples