<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://bloggingabout.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tags 'SharePoint', 'UserProfile', 'LDAP', 'AD', and 'Error'</title><link>http://bloggingabout.net/search/SearchResults.aspx?a=1&amp;o=DateDescending&amp;tag=SharePoint,UserProfile,LDAP,AD,Error&amp;orTags=0</link><description>Search results matching tags 'SharePoint', 'UserProfile', 'LDAP', 'AD', and 'Error'</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>LDAP Problems updating LDAP information: saving attribute values gives error: 0x8000500C - The Active Directory Datatype Cannot be Converted to/from a Native DS Datatype / LDAPConnection: The LDAP server is unavailable</title><link>http://bloggingabout.net/blogs/bas/archive/2009/05/22/ldap-problems-updating-ldap-information-saving-attribute-values-gives-error-0x8000500c-the-active-directory-datatype-cannot-be-converted-to-from-a-native-ds-datatype-ldapconnection-the-ldap-server-is-unavailable.aspx</link><pubDate>Fri, 22 May 2009 15:19:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:481681</guid><dc:creator>Bas</dc:creator><description>&lt;p&gt;Our customer had the wish to synchronise some Sharepoint UserProfileProperties of UserProfiles back to LDAP, so that information could be synced with SAP. The attributes that needed to be saved, where inherited from custom schemas in LDAP, which gave us some trouble. When updating attribute values in LDAP, and they inherit from the default scheme, there is really no problem. But at the moment that we tried to update an attribute that inherited from a custom schema, we saw some very weird behaviour:&lt;/p&gt;

&lt;div style="font-family:Courier New;font-size:10pt;color:black;background:white;"&gt;
&lt;p&gt;&lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; UpdateAttribute(&lt;span style="color:#2b91af;"&gt;SearchResult&lt;/span&gt; sr)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#2b91af;"&gt;DirectoryEntry&lt;/span&gt; de = sr.GetDirectoryEntry();&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;if&lt;/span&gt;(de.Properties.Contains(&lt;span style="color:#a31515;"&gt;&amp;quot;customProperty&amp;quot;&lt;/span&gt;))&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; de.Properties[&lt;span style="color:#a31515;"&gt;&amp;quot;customProperty&amp;quot;&lt;/span&gt;][0] = &lt;span style="color:#a31515;"&gt;&amp;quot;bla&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; de.CommitChanges();&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;threw a com exception: &lt;strong&gt;0x8000500C - The Active Directory Datatype Cannot be Converted to/from a Native DS Datatype.&lt;/strong&gt; It even threw the exception at the&amp;nbsp;line: &lt;/p&gt;
&lt;div style="font-family:Courier New;font-size:10pt;color:black;background:white;"&gt;
&lt;p&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt;(de.Properties.Contains(&lt;span style="color:#a31515;"&gt;&amp;quot;customProperty&amp;quot;&lt;/span&gt;))&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;When trying to access a property that didn&amp;#39;t exist or a property that inherited from the default schema, no exception was thrown. What is the case? There are 2 possibilities:&lt;/p&gt;
&lt;p&gt;1) the schema cache&amp;nbsp;can&amp;#39;t be updated on our machine, and with the lack of a correct schema, the datatype couldn&amp;#39;t be converted. &lt;br /&gt;2) For some reason, LDAP V2 is used instead of V3, which has the problem that custom attributes can&amp;#39;t be loaded&lt;/p&gt;
&lt;p&gt;We didn&amp;#39;t find a solution for this, but googled brought me an alternative solution:&lt;/p&gt;
&lt;p&gt;the System.DirectoryServices.Protocols namespace!&lt;br /&gt;I tried to make a connection to the LDAP server with the following Code:&lt;/p&gt;

&lt;div style="font-family:Courier New;font-size:10pt;color:black;background:white;"&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:#2b91af;"&gt;LdapDirectoryIdentifier&lt;/span&gt; id = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;LdapDirectoryIdentifier&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;LDAP://&amp;quot;&lt;/span&gt; + &lt;span style="color:#2b91af;"&gt;ConfigurationManager&lt;/span&gt;.AppSettings[&lt;span style="color:#a31515;"&gt;&amp;quot;LdapServer&amp;quot;&lt;/span&gt;], 389);&lt;/p&gt;
&lt;/div&gt;

&lt;div style="font-family:Courier New;font-size:10pt;color:black;background:white;"&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:#2b91af;"&gt;LdapConnection&lt;/span&gt; _LdapConnection = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;LdapConnection&lt;/span&gt;(id, &lt;span style="color:#2b91af;"&gt;AuthType&lt;/span&gt;.Basic);&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _LdapConnection.SessionOptions.ProtocolVersion = 3;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _LdapConnection.Bind();&amp;nbsp; &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;But this threw another error: The LDAP server is unavailable. 2 hours of trial and error brought me to the conclusion: leave the &amp;quot;LDAP://&amp;quot; when specifying the server :S&lt;/p&gt;
&lt;p&gt;Using &lt;span style="color:#2b91af;"&gt;LdapDirectoryIdentifier&lt;/span&gt; id = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;LdapDirectoryIdentifier&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;ConfigurationManager&lt;/span&gt;.AppSettings[&lt;span style="color:#a31515;"&gt;&amp;quot;LdapServer&amp;quot;&lt;/span&gt;], 389);&amp;nbsp;everything worked fina, and now we have a 2-way working synchronization between a LDAP store and a SharePoint UserProfileStore!&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>