This example shows how you can publish a local library, which already exists in your virtual environment.

This example uses the steps that are described in the Publish an Existing Content Library procedure.

...
using vmware.content;
using vmware.content.library;
 
// Access the LocalLibrary service.
var localLibraryService = ServiceManager.VapiConnection.GetService<LocalLibrary>();
 
// Retrieve an existing local library.
var libraryModel = localLibraryService.Get(libraryId);
var publishInfo = new PublishInfo();
 
// Configure how the local library is published by using BASIC authentication.
publishInfo.SetUserName("vcsp");
publishInfo.SetPassword("password".ToCharArray());
publishInfo.SetAuthenticationMethod(PublishInfo.AuthenticationMethod.BASIC);
 
// Set the local library to published and update the library instance.
publishInfo.SetPublished(true);
libraryModel.SetPublishInfo(publishInfo);
localLibraryService.Update(libraryModel.GetId(), libraryModel);