ShareFile-PowerShell
ShareFile-PowerShell copied to clipboard
Send-SfRequest : BadRequest: User must be added as an employee.
I'm trying to create an employee account (not a client) but I always get the same error. I'm not sure what am I doing wrong. When I put some domain of my company, I get the error. When a put a different domain like "@gmail.com" it does work.
Add-PSSnapin sharefile
$sfClient = Get-SfClient -Name "C:\Users\user\Documents\MySubdomain.sfps"
#create contact in ShareFile
$user = New-Object ShareFile.Api.Models.AccountUser
#required fields
$user.FirstName = "testuser"
$user.LastName = "shafiletest"
$user.Email = "[email protected]"
#create client user
Send-SfRequest $sfClient `
-Method POST `
-Entity users `
-Body $user `
-Parameters @{"addshared" = "true"}
You have the wrong Entity. Also, the "addshared" is obsolete (will always be true) and is unnecessary. If you want an example, you can look at this Gist.
Thank you so much!!! this did it for me