This example shows how to create a library item that stores an ISO image file.

This example uses the steps that are described in the Create an Empty Library Item procedure.

...
using vmware.content;
using vmware.content.library;
 
...
// Create an instance of the ItemModel class and specify the item settings.
var libItemSpec = new ItemModel();
libItemSpec.SetName("ESXi ISO image");
libItemSpec.SetDescription("ISO image with the latest security patches for ESXi 5.5 as of 2/3/2015");
libItemSpec.SetType("iso");
 
// Associate the item with an existing content library.
libItemSpec.SetLibraryId("<content_library_ID>");
 
// Create the new Item instance, using the specified model.
Item libItemService = ServiceManager.VapiConnection.GetService<Item>();
var itemID = Guid.NewGuid().ToString();
var newItem = libItemService.Create(itemID, libItemSpec);