d0se
Contributor
Contributor

C# vSphere SDK: advanced search with VimClient.FindEntityViews()

Hi,

i'd like to do some advanced search with VimClient.FindEntityViews(Type viewType, ManagedObjectReference beginEntity, NameValueCollection filter, string[] properties). Actually i get some VMs based on the Name property of a VM like this:

VimClient client = getVimClient();

NameValueCollection nvc = new NameValueCollection();

nvc.Add("name", "some-Name");

List results = client.FindEntityViews(typeof(VirtualMachine), null, nvc, null);

Then i have to sort out all VMs with special further properties manually in my C# program.

Is there a possibility to do searches like in SQL? I thought about something like

"Select all VMs where Name is not 'some-Name' "

Any suggestions?

Thanks and regards

Tags (2)
0 Kudos
1 Reply
jeffpatton
Enthusiast
Enthusiast

I've not tested this out but perhaps

^((?!some-Name).)*$

Message was edited by: Jeff Patton Hit enter too soon!

Jeffrey S. Patton Systems Specialist, Enterprise Systems University of Kansas 1001 Sunnyside Ave. Lawrence, KS. 66045 http://patton-tech.com
0 Kudos