How to find the version of a package installed in an environment

Hi,
I have a requirement that the deployment should only happen for packages which are different from the PROD environment (We have 3 stages QA, staging and PROD, there are scenarios where in the staging package version will be higher than prod but never reaches prod) So I would like to get the package versions that have been deployed successfully in PROD (or any other environment) thru API. I did go thru http://help.octopusdeploy.com/discussions/questions/5624-machine-names-involved-in-deployment-through-api, but this does not fully meet my requirements.
Is there a way I can query for the packages installed in an environment and get the version details?? It would be great if you can share a C# sample.

Thanks,
Anand

Hi Anand,

Thank you for getting in touch. I’ve modified one of our example scripts to get the information you want. You can find it here

Hope that helps,

Robert W

Hi Robert,
Thanks you so much! This was exactly what I was looking for.

Thanks,
Anand