This example creates a tag specification and then uses it to create the tag. The tag specification references the category identifier that was returned from the category create operation. Use the returned tag identifier for subsequent operations on the tag.

This example is based on the information that is provided in Creating a Tag.

This example is based on code in the TagLifecycle.cs sample file. This file is located in the following vCloud Suite SDK for .NET directory: client/samples/src/Samples/vmware/vcloud/suite/samples/cis/tagging/

using vmware.cis.tagging;
 
var tagStub = myStubFactory.CreateStub<Tag>(myStubConfiguration);
 
// Set up a tag create spec.
var createSpec = new TagTypes.CreateSpec();
createSpec.SetName(“red”);
createSpec.SetDescription(“My favorite color”);
createSpec.SetCategoryId(newCategoryId);
 
String tagId = tagStub.Create(spec);