VMware

This Question is Possibly Answered

1 "correct" answer available (10 pts) 2 "helpful" answers available (6 pts)
1 Replies Last post: Oct 20, 2009 10:06 PM by AngelaS  

error trying to retreive extensionlist posted: Oct 2, 2009 5:35 AM

Click to view rickyelqasem's profile Enthusiast 93 posts since
Apr 13, 2006
I'm try to retreive in c# the extsionlist where the plugins reside and failing. Can you help me? Here is s copy of my code:

_service = new VimService();
_service.Url = url;
_svcRef = new ManagedObjectReference();
_svcRef.type = "ServiceInstance";
_svcRef.Value = "ServiceInstance";
_service.CookieContainer = new System.Net.CookieContainer();
CreateServiceRef("ServiceInstance");
_sic = _service.RetrieveServiceContent(_svcRef);
_propCol = _sic.propertyCollector;
_rootFolder = _sic.rootFolder;

String userName = userTextBox.Text;
String password = passTextBox.Text;

if (_sic.sessionManager != null)
{
_service.Login(_sic.sessionManager, userName, password, null);
ManagedObjectReference extMOREF = _sic.extensionManager;


PropertySpec pSpec = new PropertySpec();
pSpec.type = "extensionList";
pSpec.all = true;
// pSpec.all = false;
//pSpec.pathSet = new string[] { "extensionList" };
ObjectSpec oSpec = new ObjectSpec();
oSpec.obj = _sic.extensionManager;

PropertyFilterSpec pfSpec = new PropertyFilterSpec();
pfSpec.propSet = new PropertySpec[] { pSpec };
pfSpec.objectSet = new ObjectSpec[] { oSpec };

ObjectContenthttp:// ocary = _service.RetrieveProperties(_propCol, new PropertyFilterSpechttp://] ocary = _service.RetrieveProperties(_propCol, new PropertyFilterSpec[ { pfSpec });


Ricky El-Qasem

VCI/VCP - MCSE - RHCT

Re: error trying to retreive extensionlist

1. Oct 20, 2009 10:06 PM in response to: rickyelqasem
Click to view AngelaS's profile Enthusiast 43 posts since
Sep 28, 2009

Hi,

You need to set the type of the managed object whose properties you wanted to retrieve as the "type" property of "PropertySpec". The property of the managed object to be retrieved is passed in the pathset. So, set the type property of PropertySepc to the type of the managed object "ExtensionManager".

Please refer to the below code snippet:

ManagedObjectReference extMOREF = _sic.extensionManager;

PropertySpec pSpec = new PropertySpec();

pSpec.type = extMOREF.type ;

pSpec.all = true;

pSpec.pathSet = new string[] { "extensionList" };

ObjectSpec oSpec = new ObjectSpec();

oSpec.obj = extMOREF;

Try the above changes at your end and let us know if you were able to resolve the issue.

Developer Social Media

Communities