How to access and delete packages using Octopus.Client

Hello,
I need to get a list of all packages in the main feed (feeds-builtin) and then delete some of them. I tried to solve this using Octopus.Client and PowerShell. There is no method to retrieve this information, is it? Are you going to add this ability in future versions of Octopus.Client?
Is Rest-API is the only way to list/delete packages?
Thanks in advance.

Hi Denis,

You are correct. You cannot currently do this via the .NET client. At the moment we don’t have plans to add this functionality.

Generally, we suggest relying on Retention Policies to clean up packages. Otherwise, as you suggest, you can do this via the REST API.

I hope this helps,
Michael

Thank you for response.
I tried Retention Policies to clean up packages. But there is one issue.
We use #{package} template in our releases. So, octopus don’t delete packages. It writes in log something like that:

bla-bla-package was published on 17.09.2015 14:35:19 +00:00. It will be kept. Reason: the package used by a project that uses #{…} references in the package ID field, and the project has deployed a package with this name before.

Is there any workaround?

Oh, I understand.
When you use a variable (i.e. #{...}) for the package ID, no packages for the project are removed by retention-policies, as you’ve discovered.

No, there is no work-around for this. You can delete the packages directly from the file-system (by default at C:\Octopus\Packages). Then, restarting the Octopus service will force re-indexing of the packages.

But based on your original question, I suspect you are looking to automate this. I apologize that we don’t currently expose this functionality via the .NET API. The REST API is your best option.

Regards,
Michael