Group description

263 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Mark Rae

ungelesen,
10.04.2006, 09:54:4310.04.06
an
Hi,

I'm querying AD through SQL Server using a linked server as described on the
Microsoft site. All is working well, except that I can't query group
descriptions. E.g. the following query works perfectly:

SELECT
*
FROM
OpenQuery(ADSI,
'SELECT
cn
FROM
''LDAP://DC=MyDomain,DC=com''
WHERE
objectClass = ''Group''
')

According to this site: http://www.dx21.com/scripting/adsi/ADGUI/SG1.ASP
(extremely useful reference, BTW), the ADSI property for the Description
field is 'description'. However, when I add that to the above query, I get
the following error:

Could not get the data of the row from the OLE DB provider 'ADSDSOObject'.
Could not convert the data value due to reasons other than sign mismatch or
overflow.
OLE DB error trace [OLE/DB Provider 'ADSDSOObject' IRowset::GetData returned
0x40eda: Data status returned from the provider: [COLUMN_NAME=cn
STATUS=DBSTATUS_S_OK], [COLUMN_NAME=description
STATUS=DBSTATUS_E_CANTCONVERTVALUE]].

I've done a Google search on that, but can't find anything helpful.

Any assistance gratefully received.

Mark


Richard Mueller

ungelesen,
10.04.2006, 11:46:0410.04.06
an
Mark Rae wrote:

Hi,

Although description is treated as a single valued attribute by the system,
and you can only assign one value, it is actually a multi-valued attribute,
similar to memberOf. The value returned by ADO can be Null or a Variant()
array with upper bound 0.

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net


Mark Rae

ungelesen,
10.04.2006, 12:56:1710.04.06
an
"Richard Mueller" <rlmuelle...@ameritech.NOSPAM.net> wrote in message
news:eld8hXLX...@TK2MSFTNGP03.phx.gbl...

> Although description is treated as a single valued attribute by the
> system, and you can only assign one value, it is actually a multi-valued
> attribute, similar to memberOf. The value returned by ADO can be Null or a
> Variant() array with upper bound 0.

So how do I do it, then...?


Richard Mueller

ungelesen,
10.04.2006, 14:11:1710.04.06
an

"Mark Rae" <ma...@markN-O-S-P-A-M.co.uk> wrote in message
news:eg6Lx%23LXGH...@TK2MSFTNGP02.phx.gbl...

I'm sorry, I don't know what language/environment you are in. I have not
seen how you retrieve description. If VB or VBScript:

adoRecordset.Source = "SELECT distinguishedName, description " _
& "FROM 'LDAP://dc=MyDomain,dc=com' " _
& "WHERE objectCategory = 'person'"
adoRecordset.Open
Do Until adoRecordset.EOF
strDN = adoRecordset.Fields("distinguishedName").Value
arrDescr = adoRecordset.Fields("description").Value
If IsNull(arrDescr) Then
strDescr = "<none>"
Else
For Each strLine In arrDescr
strDescr = strLine
Next
End If
Wscript.Echo strDN & ";" & strDescr
adoRecordset.MoveNext
Loop
adoRecordset.Close

If you are using T-SQL, I have not seen how to handle this. You would have
the same issue with any multi-valued attribute, like memberOf, objectClass,
otherTelephone, etc. Searching previous newsgroup postings I fear it cannot
be done in T-SQL. There seems to be no datatype that supports multi-valued
fields, even though it seems to be in the recordset. Does anyone else have a
solution in SQL?

Mark Rae

ungelesen,
10.04.2006, 17:39:1610.04.06
an

"Richard Mueller" <rlmuelle...@ameritech.NOSPAM.net> wrote in message
news:%23kr8qoM...@TK2MSFTNGP02.phx.gbl...

Mark Rae

ungelesen,
10.04.2006, 17:40:1310.04.06
an
"Richard Mueller" <rlmuelle...@ameritech.NOSPAM.net> wrote in message
news:%23kr8qoM...@TK2MSFTNGP02.phx.gbl...

> I'm sorry, I don't know what language/environment you are in.

SQL Server.

> I have not seen how you retrieve description.

See my original post.


Allen antworten
Dem Autor antworten
Weiterleiten
0 neue Nachrichten