Can't link team to projects | api/teams/ outdated documentation | scoped user role resource

usability
(Ioan Stoita) #1

Hi!
I have a PowerShell script which is executed as a Process Step and its role is to create teams and link them to the desired project. Last year the script was working correctly, but now it doesn’t work anymore.

I see in your documentation that the teams resource has “ProjectIds” property, which I think is no more valid, because I get error when trying to populate this property and I also downloaded your repository from GitHub, searched for TeamResource and found out that this property is now in ScopedUserRoleResource class…

So, how should I now link the team to a project?
version 2018.9.10
Have a great day!

(Dalmiro Grañas) #3

Hi @ioan.stoita,

Thanks for reaching out! You are correct there. A Team will have a ScopedUserRole resource related to it that will contain all the scoping info such as the Projects.

Is your Powershell script using the REST API or the .NET client? I’m asking so I can give you an example that fits your scenario.

Thanks,
Dalmiro

(Ioan Stoita) #4

@Dalmiro I think it’s using the REST API:

$endpoint = new-object -TypeName Octopus.Client.OctopusClient(New-Object Octopus.Client.OctopusServerEndpoint($OctopusParameters[’$OctopusURI’],$ApiKey))
$endpoint.post("/api/teams/", $newTeam, $null)

Also not sure what’s the second parameter for ($null). I’m repairing it :slight_smile:
Thank you!

(Ioan Stoita) #6

have you died?

(system) closed #7

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.