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.
Note: For related code samples, see the
vSphere Automation SDK .NET samples at GitHub.
... // 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);