.NET Example of Updating a Tag Description
This example is based on code in the TaggingWorkflow.cs sample file.
This example adds timestamp in a tag description to identify when a resource was last reconfigured. The tag description is updated with the timestamp after the resources is reconfigured.
This example is based on the information that is provided in Updating a Tag.
Note: For a complete and
up-to-date version of the sample code, see the
vSphere Automation SDK .NET
samples at GitHub.
... // Format current time. String newDescription = String.format(“Server tag updated at ({0}).”, DateTime.Now); // Create update spec ta change Description field. TagTypes.UpdateSpec updateSpec = new TagTypes.UpdateSpec(); updateSpec.SetDescription(newDescription); // Apply update spec to tag. var tagStub = myStubFactory.CreateStub<Tag>(myStubConfiguration); tagStub.Update(myTagId, updateSpec);