tfs = vim.TaskFilterSpec()
task_collector = si.RetrieveContent().taskManager.CreateCollectorForTasks(tfs)
len(task_collector.latestPage) #10
i created a collector for tasks,but the latestPage length just 10,how can i change the page size by using setLatestPageSize method?
You can set the LatestPageSize by modifying the Service's SetCollectorPageSize object.
For example, here I set my CollectorPageSize to 500, so the service object, updates the eventHistory collector's page size from the default which is 10 I believe.
Here is my code is in C#, can totally relate to yours,
Initiation:
protected ServiceContent _serviceContent;
protected VimPortType _service;
While creating the taskManager:
ManagedObjectReference taskManager = _serviceContent.taskManager;
ManagedObjectReference task_collector = _service.CreateCollectorForEvents(taskManager , taskFilter);
_service.SetCollectorPageSize(task_collector , 500);
I understand this was posted a year ago, but thought it could help someone else sometime since VMware's documentation is really terrible IMHO.