<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>LDAP, AD, ADSI, DS, GDS</title>
        <link>http://geekswithblogs.net/TimH/category/3264.aspx</link>
        <description>AODSC (any old directory services crap)</description>
        <language>en-NZ</language>
        <copyright>Tim Huffam</copyright>
        <managingEditor>timhuffam@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>System.DirectoryServices.DirectorySearcher.Timeout and ServerTimeLimit not working for non AD LDAP directory (GDS)</title>
            <link>http://geekswithblogs.net/TimH/archive/2006/05/19/78919.aspx</link>
            <description>&lt;P&gt;I've been running several searches against a GDS LDAP directory - and &lt;BR&gt;the Timeout and ServerTimeLimit properties of the DirectorySearcher &lt;BR&gt;class appear to have no effect. &lt;/P&gt;
&lt;P&gt;After further testing I've discovered that the problem is caused because I was using sub second timeout periods eg 500ms - and the LDAP server I'm accessing (GDS) only supports timeout periods of whole number seconds.&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;Tim&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=78919"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=78919" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/TimH/aggbug/78919.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Tim Huffam</dc:creator>
            <guid>http://geekswithblogs.net/TimH/archive/2006/05/19/78919.aspx</guid>
            <pubDate>Thu, 18 May 2006 20:34:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/TimH/comments/78919.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/TimH/archive/2006/05/19/78919.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/TimH/comments/commentRss/78919.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/TimH/services/trackbacks/78919.aspx</trackback:ping>
        </item>
        <item>
            <title>ADSI error: The directory datatype cannot be converted to/from a native DS datatype. When retrieving DS property value.</title>
            <link>http://geekswithblogs.net/TimH/archive/2005/11/09/59573.aspx</link>
            <description>&lt;P&gt;This occurs when using ADSI (ActiveDs.dll) when&amp;nbsp;retreiving a property value whose type (in the schema) is not the same as that specified in the method you use.&lt;/P&gt;
&lt;P&gt;In my case I was trying to access a property which was a&amp;nbsp;dn (distinguished name), however the method I was using to retrieve the value was defaulting to type ADSTYPEENUM.ADSTYPE_CASE_IGNORE_STRING.&amp;nbsp; This caused the following error:&lt;/P&gt;
&lt;P&gt;Exception Information&lt;BR&gt;*********************************************&lt;BR&gt;Exception Type: System.Runtime.InteropServices.COMException&lt;BR&gt;ErrorCode: -2147463156&lt;BR&gt;Message: The directory datatype cannot be converted to/from a native DS datatype&lt;/P&gt;
&lt;P&gt;TargetSite: System.Object GetPropertyItem(System.String, Int32)&lt;BR&gt;HelpLink: NULL&lt;BR&gt;Source: Active Directory&lt;/P&gt;
&lt;P&gt;StackTrace Information&lt;BR&gt;*********************************************&lt;BR&gt;&amp;nbsp;&amp;nbsp; at ActiveDs.IADsPropertyList.GetPropertyItem(String bstrName, Int32 lnADsType)&lt;BR&gt;...&lt;/P&gt;
&lt;P&gt;When I explicitly specify the correct ADS type, in this case ADSTYPEENUM.ADSTYPE_DN_STRING, it works a treat.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Faulty code:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#0000ff size=2&gt;...&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SearchResultCollection resultColl =&amp;nbsp;&lt;SPAN class=564355609-09112005&gt;dirS&lt;/SPAN&gt;earcher.FindAll();&lt;BR&gt;&lt;/FONT&gt;&lt;SPAN class=564355609-09112005&gt;&lt;FONT face=Arial color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DirectoryEntry localDirectoryEntry = resultColl[0].GetDirectoryEntry();&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; localDirectoryEntry.RefreshCache(); // This should refresh the cache and avoid the error - but it doesnt&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IADsPropertyList propList = (IADsPropertyList)localDirectoryEntry.NativeObject;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;IADsPropertyEntry propEntry = (IADsPropertyEntry)propList.GetPropertyItem("companydn",(&lt;/STRONG&gt;&lt;STRONG&gt;int)ADSTYPEENUM.&lt;FONT color=#ff0000&gt;ADSTYPE_CASE_IGNORE_STRING&lt;/FONT&gt;);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN class=564355609-09112005&gt;&lt;FONT face=Arial color=#0000ff size=2&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;STRONG&gt;Correct code:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#0000ff size=2&gt;&lt;STRONG&gt;...&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SearchResultCollection resultColl =&amp;nbsp;&lt;SPAN class=564355609-09112005&gt;dirS&lt;/SPAN&gt;earcher.FindAll();&lt;BR&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;SPAN class=564355609-09112005&gt;&lt;FONT face=Arial color=#0000ff size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DirectoryEntry localDirectoryEntry = resultColl[0].GetDirectoryEntry();&lt;BR&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#0000ff size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; localDirectoryEntry.RefreshCache(); // This should refresh the cache and avoid the error - but it doesnt&lt;BR&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IADsPropertyList propList = (IADsPropertyList)localDirectoryEntry.NativeObject;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IADsPropertyEntry propEntry = (IADsPropertyEntry)propList.GetPropertyItem("companydn",(int)ADSTYPEENUM.&lt;FONT color=#ff0000&gt;ADSTYPE_DN_STRING&lt;/FONT&gt;);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/SPAN&gt;
&lt;P&gt;My environment comprised of .NET 1.1 code using the ADSI COM library (ActiveDs.dll) accessing a GDS LDAP directory.&lt;/P&gt;
&lt;P&gt;See Brendans blog for a better explanation &lt;A href="http://codebetter.com/blogs/brendan.tompkins/archive/2004/03/30/10362.aspx"&gt;here&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;Tim&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=59573"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=59573" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/TimH/aggbug/59573.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Tim Huffam</dc:creator>
            <guid>http://geekswithblogs.net/TimH/archive/2005/11/09/59573.aspx</guid>
            <pubDate>Wed, 09 Nov 2005 00:17:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/TimH/comments/59573.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/TimH/archive/2005/11/09/59573.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/TimH/comments/commentRss/59573.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/TimH/services/trackbacks/59573.aspx</trackback:ping>
        </item>
    </channel>
</rss>