Need help on accessing attributes from AD

V

Viju

Hi,

We are using the EMDS provider, a third party provider, to read
attributes from Quest Active Roles Server(ARS) in our application. And
one amongst the attributes in ARS is a milti valued virtual attribute.
We have the vb script for accessing the same. but we are unable to
convert into
..net equivalent code. Has anyone tried reading the multi valued
virtual attributes
in .net?

Vb Script

set objUser = getObject("EDMS://" & user)
objUser.GetInfoEx Array("edsvaMDMRole"),0
arrRoles = objUser.getEx("edsvaMDMRole")

for each rolevalue in arrRoles
wscript.echo "User:" & objUser.name & vbTab & "MDMRole:" & rolevalue
next

..net code which we are using

DirectoryEntry objEDMSDir = new DirectoryEntry("EDMS://" + sUser,
sUserId, sPwd, AuthenticationTypes.Secure);
objEDMSDir.Invoke("GetInfoEx", new object[] { "edsvaMDMRole", 0 });
objEDMSDir.Invoke("GetEx", "edsvaMDMRole");

But the last line is throwing error like "The directory property
cannot be found in the cache.The specified property 'edsvaMDMRole'
cannot be found in the property cache."

Are we invoking the GetEx method correctly? How should we call the
GetEx method.
Instead of native method call, we have also tried with RefreshCache
method. But no luck.
Using RefreshCache, we are able to read values correctly for those
attributes which have multiple values, For ex, if edsvaMDMRole has
values as "Test,Test1" then we are able to get the data. If the
attribute has value like 'Test', we are not able to retrieve it
through RefreshCache method.

Any idea as how to read multi valued virtual attributes from AD
 
G

Guest

Hi,

We are using the EMDS provider, a third party provider, to read
attributes from Quest Active Roles Server(ARS) in our application. And
one amongst the attributes in ARS is a milti valued virtual attribute.
We have the vb script for accessing the same. but we are unable to
convert into
.net equivalent code. Has anyone tried reading the multi valued
virtual attributes
in .net?

 Vb Script

 set objUser = getObject("EDMS://" & user)
objUser.GetInfoEx Array("edsvaMDMRole"),0
 arrRoles = objUser.getEx("edsvaMDMRole")

 for each rolevalue in arrRoles
 wscript.echo "User:" & objUser.name & vbTab & "MDMRole:" & rolevalue
 next

.net code which we are using

DirectoryEntry objEDMSDir = new DirectoryEntry("EDMS://" + sUser,
sUserId, sPwd, AuthenticationTypes.Secure);
objEDMSDir.Invoke("GetInfoEx", new object[] { "edsvaMDMRole", 0 });
objEDMSDir.Invoke("GetEx", "edsvaMDMRole");

 But the last line is throwing error like "The directory property
cannot be found in the cache.The specified property 'edsvaMDMRole'
cannot be found in the property cache."

Are we invoking the GetEx method correctly? How should we call the
GetEx method.
Instead of native method call, we have also tried with RefreshCache
method. But no luck.
Using RefreshCache, we are able to read values correctly for those
attributes which have multiple values, For ex, if edsvaMDMRole has
values as "Test,Test1" then we are able to get the data. If the
attribute has value like 'Test', we are not able to retrieve it
through RefreshCache method.

Any idea as how to read multi valued virtual attributes from AD

I think that invoking requiring an array, so try

objEDMSDir.Invoke("GetInfoEx", new Object[] { new object[]
{ "edsvaMDMRole" }, 0});

GetInfoEx and GetEx copy properties into cache, but usually, you can
read properties directly.

DirectoryEntry objEDMSDir = new DirectoryEntry(...);
//objEDMSDir.RefreshCache(new string[] { "edsvaMDMRole" });
objEDMSDir.Properties["edsvaMDMRole"][0].ToString();

I think it should work without RefreshCache, and I've commented it
out.

You can also try to enumerate all properties to ensure what you get
out of directory
 
V

Viju

We are using the EMDS provider, a third party provider, to read
attributes from Quest Active Roles Server(ARS) in our application. And
one amongst the attributes in ARS is a milti valued virtual attribute.
We have the vb script for accessing the same. but we are unable to
convert into
.net equivalent code. Has anyone tried reading the multi valued
virtual attributes
in .net?
 Vb Script
 set objUser = getObject("EDMS://" & user)
objUser.GetInfoEx Array("edsvaMDMRole"),0
 arrRoles = objUser.getEx("edsvaMDMRole")
 for each rolevalue in arrRoles
 wscript.echo "User:" & objUser.name & vbTab & "MDMRole:" & rolevalue
 next
.net code which we are using
DirectoryEntry objEDMSDir = new DirectoryEntry("EDMS://" + sUser,
sUserId, sPwd, AuthenticationTypes.Secure);
objEDMSDir.Invoke("GetInfoEx", new object[] { "edsvaMDMRole", 0 });
objEDMSDir.Invoke("GetEx", "edsvaMDMRole");
 But the last line is throwing error like "The directory property
cannot be found in the cache.The specified property 'edsvaMDMRole'
cannot be found in the property cache."
Are we invoking the GetEx method correctly? How should we call the
GetEx method.
Instead of native method call, we have also tried with RefreshCache
method. But no luck.
Using RefreshCache, we are able to read values correctly for those
attributes which have multiple values, For ex, if edsvaMDMRole has
values as "Test,Test1" then we are able to get the data. If the
attribute has value like 'Test', we are not able to retrieve it
through RefreshCache method.
Any idea as how to read multi valued virtual attributes from AD

I think that invoking requiring an array, so try

objEDMSDir.Invoke("GetInfoEx", new Object[] { new object[]
{ "edsvaMDMRole" }, 0});

GetInfoEx and GetEx copy properties into cache, but usually, you can
read properties directly.

DirectoryEntry objEDMSDir = new DirectoryEntry(...);
//objEDMSDir.RefreshCache(new string[] { "edsvaMDMRole" });
objEDMSDir.Properties["edsvaMDMRole"][0].ToString();

I think it should work without RefreshCache, and I've commented it
out.

You can also try to enumerate all properties to ensure what you get
out of directory- Hide quoted text -

- Show quoted text -

Hi,

Ive tried with and without refreshcache() method. But still unable to
get the values.
why does it faile saying 'The property cannot be found in the cache'
when it actually exists.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top