Use the vSphere Automation API to create queries for libraries that match your criteria. You can also retrieve a list of all libraries or only the libraries of a specific type.

Listing All Content Libraries

You can retrieve a list of all content library IDs in your virtual environment, regardless of their type, by using the Library service.

You can use the list function to retrieve all local and subscribed libraries in your system.

Listing Content Libraries of a Specific Type

You can use the vSphere Automation API to retrieve content libraries of a specific type. For example, you can list only the local libraries in your virtual environment.

If you want to retrieve only a list of the local libraries, you must retrieve the LocalLibrary service and use the list function on the LocalLibrary service. To list only subscribed libraries, you must retrieve the SubscribedLibrary service and call the list function on the SubscribedLibrary service.

Listing Content Libraries by Using Specific Search Criteria

You can filter the list of content libraries and retrieve only the libraries that match your specific criteria. For example, you might want to publish all local libraries with a specific name.

To a filter with specific search criteria, call the find (find_spec) function of the Library service. Pass as argument a LibraryTypes.FindSpec instance that contains your search criteria. Upon a successful completion of the call, you receive a list of all content libraries that match your search criteria.