-
Notifications
You must be signed in to change notification settings - Fork 0
Files and Folders
Takashi Shinohara edited this page Aug 31, 2021
·
1 revision
There are two ways to upload a file using the cmdlets Add-KshFile and Save-KshFile.
The difference is:
- The
Add-KshFile
cmdlet usesFileCreationInformation
class. Maximum file size that can be uploaded is 2 MB. - The
Save-KshFile
cmdlet usesStartUpload
,ContinueUpload
, andFinishUpload
method on theFile
class. No file size limits.
For more details, see docs.
$folder = Get-KshFolder -FolderUrl '/sites/japan/hr/Shared%20Documents'
$fstream = [System.IO.File]::OpenRead('./README.txt')
Save-KshFile -Folder $folder -Content $fstream -FileName 'README.txt'
Use the Open-KshFile cmdlet in order to download a file.
$file = Get-KshFile -FileUrl '/sites/japan/hr/Shared%20Documents/README.txt'
$istream = Open-KshFile -Identity $file
$fstream = [System.IO.File]::OpenWrite('./README.txt')
$istream.CopyTo($fstream)
$istream.Close()
$fstream.Close()