.NET Example of
Creating a Library Item
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.
For related code
samples, see the
vSphere Automation SDK .NET
samples at GitHub.
... // 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"); 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);