-
Notifications
You must be signed in to change notification settings - Fork 0
Folders and Files
Use the Add-KshFolder cmdlet to create a folder.
$parentFolder = Get-KshFolder -FolderUrl '/sites/japan/hr/Shared%20Documents'
Add-KshFolder -Folder $parentFolder -FolderName 'Estimates'The default approval status is Pending. You can use the Set-KshApprovalStatus cmdlet with the -Approve parameter to approve a folder. The -Comment parameter is optional. The approval status will be set to Approved.
$folder = Get-KshFolder -FolderUrl '/sites/japan/hr/Shared%20Documents/Estimates'
Set-KshApprovalStatus -Folder $folder -Approve -Comment 'Approved'You can use the -Reject parameter to reject a folder. The -Comment parameter is optional. The approval status will be set to Rejected.
$folder = Get-KshFolder -FolderUrl '/sites/japan/hr/Shared%20Documents/Estimates'
Set-KshApprovalStatus -Folder $folder -Reject -Comment 'Rejected'To change the approval status to Pending, you can use the -Pending parameter.
$folder = Get-KshFolder -FolderUrl '/sites/japan/hr/Shared%20Documents/Estimates'
Set-KshApprovalStatus -Folder $folder -PendingThere are two ways to upload a file using the cmdlets Add-KshFile and Save-KshFile.
The differences are:
- The
Add-KshFilecmdlet uses theFileCreationInformationclass. The maximum file size that can be uploaded is 2 MB. - The
Save-KshFilecmdlet uses theStartUpload,ContinueUpload, andFinishUploadmethods of theFileclass. There are no file size limits.
For more details, see the documentation.
$folder = Get-KshFolder -FolderUrl '/sites/japan/hr/Shared%20Documents'
$uploadStream = [System.IO.File]::OpenRead('./README.txt')
Save-KshFile -Folder $folder -Content $uploadStream -FileName 'README.txt'You can use the Open-KshFile cmdlet to download a file.
$file = Get-KshFile -FileUrl '/sites/japan/hr/Shared%20Documents/README.txt'
$fileStream = Open-KshFile -Identity $file
$downloadStream = [System.IO.File]::OpenWrite('./README.txt')
$fileStream.CopyTo($downloadStream)
$downloadStream.Close()You can use the Set-KshCheckOutStatus cmdlet with the -CheckOut parameter to check out a file. If a file is checked out, another user cannot edit it.
$file = Get-KshFile -FileUrl '/sites/japan/hr/Shared%20Documents/README.txt'
Set-KshCheckOutStatus -File $file -CheckOutTo check in a file, use the -CheckIn parameter. The -Comment and -CheckInType parameters are optional.
$file = Get-KshFile -FileUrl '/sites/japan/hr/Shared%20Documents/README.txt'
Set-KshCheckOutStatus -File $file -CheckIn -Comment 'Updated README' -CheckInType MajorCheckInIf you want to discard the check-out state, use the -UndoCheckOut parameter.
$file = Get-KshFile -FileUrl '/sites/japan/hr/Shared%20Documents/README.txt'
Set-KshCheckOutStatus -File $file -UndoCheckOut