{"id":3152,"date":"2010-09-21T23:31:38","date_gmt":"2010-09-21T23:31:38","guid":{"rendered":"https:\/\/test.simple-talk.com\/uncategorized\/system-directoryservices-unknown-error-0x80005000-resolution\/"},"modified":"2016-07-28T10:50:09","modified_gmt":"2016-07-28T10:50:09","slug":"system-directoryservices-unknown-error-0x80005000-resolution","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/blogs\/system-directoryservices-unknown-error-0x80005000-resolution\/","title":{"rendered":"System.DirectoryServices Unknown error (0x80005000) Resolution"},"content":{"rendered":"<p>This seems completely ridiculous.&#160; I needed to write some queries against Active Directory so I made a quick console application to thresh things out before putting them inside SharePoint.&#160; After getting everything working, I dropped it into a web part and deployed it out to our test server.&#160; After setting up the LDAP connection on the web part (I made them editable properties instead of hardcoding them) I ended up getting the following obscure error:<\/p>\n<p>COM Exception was unhandled   <br \/>Unknown error (0x80005000)    <br \/>Error Code: -2147463168    <br \/>Source: System.DirectoryServices<\/p>\n<p>At first I was thinking it was a SharePoint induced security problem and was expecting a long and arduous road of getting everything working.&#160; However, after finding a random comment in a forum it turns out this is really simple issue with a terrible error message.&#160; <\/p>\n<p><strong>Resolution<\/strong>:<\/p>\n<p><strong>Capitalize LDAP:\/\/ in the connection string.<\/strong><\/p>\n<p>It turns out I accidentally did everything right in the console app but failed to do it again when configuring my web part.&#160; I&#8217;m glad I found this now instead of running into it while deploying it to production.&#160; What I decided to do was just add this code to the set section of my web part property:<\/p>\n<p>Regex.Replace(value, &#8220;ldap:\/\/&#8221;, &#8220;LDAP:\/\/&#8221;, RegexOptions.IgnoreCase); <\/p>\n<p>It uses a regular expression to locate ldap:\/\/ in the connection string regardless of how it is spelled (Ldap, LDap, ldaP, etc) and replaces it with the fully uppercased version. Pretty easy fix.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This seems completely ridiculous.&#160; I needed to write some queries against Active Directory so I made a quick console application to thresh things out before putting them inside SharePoint.&#160; After getting everything working, I dropped it into a web part and deployed it out to our test server.&#160; After setting up the LDAP connection on&#8230;&hellip;<\/p>\n","protected":false},"author":46738,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2],"tags":[],"coauthors":[],"class_list":["post-3152","post","type-post","status-publish","format-standard","hentry","category-blogs"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/3152","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/46738"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=3152"}],"version-history":[{"count":2,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/3152\/revisions"}],"predecessor-version":[{"id":41941,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/3152\/revisions\/41941"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=3152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=3152"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=3152"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=3152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}