I am using the Releases.GetDeployments method which has an optional “skip” parameter. The method ignores any value passed in and will always use “0”.
string apiKey = ConfigurationManager.AppSettings["OctopusApiKey"];
var server = "http://myoctopusserver";
var endpoint = new OctopusServerEndpoint(server, apiKey);
var octoRepository = new OctopusRepository(endpoint);
List<ProjectResource> projectList = octoRepository.Projects.FindAll();
foreach (var project in projectList)
{
int releasePageIndex = 0;
ResourceCollection<ReleaseResource> releases = octoRepository.Projects.GetReleases(project, 0);
while (releases.Items.Count > 0)
{
foreach (var release in releases.Items)
{
int deployPageIndex = 0;
ResourceCollection<DeploymentResource> deployments = octoRepository.Releases.GetDeployments(release, 0);
while (deployments.Items.Count > 0)
{
foreach (var deployment in deployments.Items)
{
//Do Something
}
deployPageIndex++;
//This call will always return the first page and ignore the skip parameter.
deployments = octoRepository.Releases.GetDeployments(release, (30 * deployPageIndex));
}
}
releasePageIndex++;
releases = octoRepository.Projects.GetReleases(project, (30 * releasePageIndex));
}
}
Octopus Deploy 2.6.3.886
Octopus.Client.dll, v3.0.23.0