This example shows how to find an item using the item name and then shows how to change the name and description of the retrieved item.

This example uses the steps that are described in the Edit the Settings of a Library Item procedure.

...
using vmware.content;
using vmware.content.library;
 
...

var libItemService = ServiceManager.VapiConnection.GetService<Item>();
var itemFilesService = ServiceManager.VapiConnection.GetService<
vmware.content.library.item.File>();

// List the items in a published library
foreach (var itemId in libItemService.List(libraryId))
{

     // List the files uploaded to each library item and print their names and size
     foreach (var singleFile in itemFilesService.List(itemId))
     {
         Console.WriteLine("Library item with name " + singleFile.GetName() +
             " has size " + singleFile.GetSize());
     }

     // Change the name and description of the library item with the specified name
     var singleItem = libItemService.Get(itemId);
     if (singleItem.GetName().Equals("simpleVmTemplate"))
     {
          var libItemUpdated = new ItemModel();
          libItemUpdated.SetName("newItemName");
          libItemUpdated.SetDescription("Description of the newItemName");
          libItemService.Update(singleItem.GetId(), libItemUpdated);
      }
}