Closed kgarbet closed 2 years ago
I've found other cmdlets it's easier to do something like: $type = @{name='[name of type]'}
is easier for me. It seems like using the IDs always gives me more trouble.
Thanks for the suggestion! But, unfortunately that seems to throw the same error.
Have you tried doing it inline (not defining type as a variable) like in the example (they are setting the company):
PS C:\> New-CWMCompanyContact -firstName 'Chris' -lastName 'Taylor' -company @{id = $Company.id}
if this works you may need to look at what you are posting (use fiddler or something to inspect the data), probably find that you need to convert your variable to json or even wrap it in quotes to keep it as text (I haven't tested any of this, just reading the manual)
Yeah, I had also tried that before posting. I'm not an expert in PowerShell, but can usually figure it out. This one has me stuck
` Get-CWMCompanyContact -id 11621 | select id, types ` id types |
---|
11621 {@{id=13; name=Supported; _info=}}
I try either:
New-CWMCompanyContact -firstName 'Kris' -lastName 'Test123' -type @{id=13}
OR
New-CWMCompanyContact -firstName 'Kris' -lastName 'Test123' -type @{name='Supported'}
They all throw the same error I mentioned in the beginning
Please update to 0.4.8.0 Use the types parameter. This was changed some time ago to allow an array of items. Function updated to support the 'new' types parameter
Assuming I have a Type with id 37
$Type = @{ id = 37 }
New-CWMCompanyContact -firstName Kris -lastName Test12 -type $type
Returns Error Below: Also, it apears there is no "Type" for Update-CWMCompanyContact
Invoke-CWMWebRequest : An exception has been thrown. --> The remote server returned an error: (400) Bad Request. An error has been thrown. --> --> { "code": "ConnectWiseApi", "message": "Could not find member 'type' on object of type 'Contact'. Path 'type', line 3, position 11.Check your accept header to make sure you are using the correct version.", "errors": null } at Invoke-CWMWebRequest, C:\Program Files\WindowsPowerShell\Modules\ConnectWiseManageAPI\0.4.7.0\Private\Invoke\Invoke-CWMWebRequest.ps1: line 41 at Invoke-CWMNewMaster, C:\Program Files\WindowsPowerShell\Modules\ConnectWiseManageAPI\0.4.7.0\Private\Invoke\Invoke-CWMNewMaster.ps1: line 38 at New-CWMCompanyContact, C:\Program Files\WindowsPowerShell\Modules\ConnectWiseManageAPI\0.4.7.0\Public\Company\Contacts\New-CWMCompanyContact.ps1: line 68 at, : line 1
At C:\Program Files\WindowsPowerShell\Modules\ConnectWiseManageAPI\0.4.7.0\Private\Invoke\Invoke-CWMNewMaster.ps1:38 char:19