Skip to content

How to Assign Task Description

In one of comments the following code did not set a task description (shown in vSphere Client in Details column):

LocalizableMessage lm = new LocalizableMessage();
lm.setMessage(“Hello World”);
myTask.getTaskInfo().setDescription(lm);

The problem is in missing key property of the newly created LocalizableMessage: it must be assigned from the task itself.

This is how it’s suppose to be done (Java):

LocalizableMessage lm = new LocalizableMessage();
lm.setKey(myTask.getTaskInfo().getKey());
lm.setMessage(“Hello World”);
myTask.getTaskInfo().setDescription(lm);

This is an example in C# (taskInfo is known value of Vim.TaskInfo type):

LocalizableMessage myDetailMessage = new Vim25Api.LocalizableMessage()
   { key = taskInfo.key, message = "my details" };
connection.Service.SetTaskDescription(taskInfo.task, myDetailMessage);

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*

Soft & Virt is Digg proof thanks to caching by WP Super Cache