Keeper-Security / keeper-sdk-dotnet

.Net and PowerShell version of Keeper Commander, a CLI and SDK interface for the Keeper Security platform.
https://docs.keeper.io/secrets-manager/commander-cli/using-commander/dotnet-powershell
MIT License
29 stars 20 forks source link

PowerCommander - Add support for uploading attachments #120

Closed bror-lauritz closed 4 months ago

bror-lauritz commented 4 months ago

PowerCommander doesn't expose any ability to upload attachments, only download them.

I've been trying to get the DotNet SDK working in powershell, but to no avail. The file is registered as uploaded but is not showing up in Keeper. There's only a paper clip and record history says "changed file or photo".

Could you please look into implementing attachment uploading in the PowerCommander module?

--- My DotNet-based script, if you're able to tell me what I'm doing wrong

[KeeperSecurity.Vault.VaultOnline]$vault = getVault

$filename = 'test.txt'
$uploadTask = [KeeperSecurity.Vault.FileAttachmentUploadTask]::new($filename)

$recordUID = '<redacted>'
$keeperRecord = Get-KeeperRecord $recordUID

$temp = $vault.UploadAttachment($keeperRecord, $uploadTask)
$temp.GetAwaiter().GetResult()
sk-keeper commented 4 months ago

Your code is correct. File upload method has been rewritten to use HttpClient library. The older HttpWebRequest implementation had issues.

Please update to PowerCommander 0.9.11. File upload cmdley is Copy-FileToKeeperRecord

bror-lauritz commented 4 months ago

Thanks! The new functions seems to work wonderfully :D