I’m trying to build out a script to update Teams properties (UserRoles). Teams.FindByName($teamName) returns nothing. I can do a Teams.FindAll and retrieve what appears to be the first 10. I have been searching for documentation on the parameters for FindByName/FindAll, but having no luck. I suspect something like skip,take in the REST API. Is there documentation for these and other methods?
Thanks for getting in touch! I’m sorry to see you’re hitting this unexpected behavior. I gave this a test locally (running version 2022.3.10382) and my $repository.Teams.FindByName($teamName) looks to return the one team correctly, as shown in the following screenshot.
I’m hoping some additional information will help us identify the issue in your instance. Could you let me know your Octopus version? Would you be willing to share the sanitized script you’re running?
I look forward to hearing back and getting to the bottom of this one!
Thanks for responding. This would be v2021.1 (Build 7316). I can select one of the top 10 and get a good response. It seems like maybe pagination of some sort. I haven’t been able find documentation on the parameters for Octopus.Client to return all records. Unless the length of the team name is an issue. For the script, I’m basically reusing the following:
I know I’ve had to deal with this in a REST call “/api/teams/Teams-181/scopeduserroles{?skip,take}” but need to understand parameter for the Octopus.Client.
I’ve just tried this on my test Octopus.Client solution and I can successfully retrieve a list of 13 teams for a space using the Teams.FindAll() method.
I noticed that the Count was an extension method when pushing the TeamResources into an IEnumerable list. I would assume this would be the same using the Client outside of a .Net environment: