Login to participate
Endpoint Management & Virtualization IdeasRSS
7

List all Collections / List all Packages

itsmillertime4u's picture

I'm trying to find a way to have a script returns back all of the collections and/or packages on a NS server. I figured I could do it via the ASDK, but I can't seem to find a method that returns this. I see documentation and examples of how to modify/create a specific collection/package, but I can't seem to find a way for it to return all of them as a 'collection' so that I can run a for each loop on them, echoing/modifying the properties of each one found.

I also haven't really figured out how to find a GUID of a package. I thought I could use the "ItemManagement" "GetItemsByNameAndType" giving it a package Name, and then giving it "PackageItemEx" as the type, but no cigar. I want to modify a package using "ModifyPackageExDetail" but I need the package GUID, which I can't find.

I also can't seem to figure out how to use the "ItemDetails" class. I know how to list the memebers of a collection, but the list ends up being a list of guids, and I would like to find a way to use the "ItemDetails" to have it returns the names instead of the guid. Any help would be very appreciated.

Jeff Gebhart's picture

Listing

If it's a list you want, just go in through the SQL.

select * from vCollection

select * from vSWDPackage

Screenbert's picture

GetItemsByType will do just the trick!

[C#]
// See ItemManagementLib Overview for an example of setting up m_proxy.
string collectionTypeName = "Collection";
ItemDetails[] items = m_proxy.GetItemsByType(collectionTypeName);
string allItemNames = "";
foreach( ItemDetails NSItemDetails in items )
{
allItemNames += ", " + NSItemDetails.Name;
}

Screenbert