遍历属性时ActiveDirectory的错误0x8000500c [英] ActiveDirectory error 0x8000500c when traversing properties

查看:343
本文介绍了遍历属性时ActiveDirectory的错误0x8000500c的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了下面的代码片段(<$ C C $> SomeName / SomeDomain 包含在我的code实际值)

  VAR项=新的DirectoryEntry(LDAP:// CN = SomeName,OU =所有组,DC = SomeDomain,DC = COM);
的foreach(在entry.Properties对象属性)
{
    Console.WriteLine(属性);
}
 

它输出的第21性质确定,但后来失败:

 收到COMException {未知错误(0x8000500c)}
   在System.DirectoryServices.PropertyValueCollection.PopulateList()
   在System.DirectoryServices.PropertyValueCollection..ctor(的DirectoryEntry条目,串propertyName的)
   在System.DirectoryServices.PropertyCollection.PropertyEnumerator.get_Entry()
   在System.DirectoryServices.PropertyCollection.PropertyEnumerator.get_Current()
   在ActiveDirectory.Tests.IntegrationTests.ObjectFactoryTests.TestMethod1()在MyTests.cs:行22
 

为什么呢?我怎样才能prevent呢?

更新

这是失败。

自定义属性

我试图使用 entry.RefreshCache() entry.RefreshCache(新[] {theAttributeName})枚举的属性(没有帮助)之前。

UPDATE2

entry.InvokeGet(theAttributeName)作品(无需 RefreshCache )。

有人能解释,为什么?

UPDATE3

它的工作原理,如果我提供的FQDN到项目: LDAP://srv00014.ssab.com/CN=SomeName,xxxx

赏金

我在寻找既解决了以下的回答:

  • 为什么 entry.Properties [customAttributeName] 失败,并提到的异常
  • 为什么 entry.InvokeGet(customAttributeName)
  • 的异常的原因
  • 如何获得两个工作
解决方案
  

如果一个人想从一个机器,是不能访问自定义属性   自定义属性所在的域的一部分(凭证   已登录用户并不重要),人们需要完全通过   对象限定名称试图访问否则架构   在客户机上缓存没有被正确刷新,没关系所有   在schema.refresh()调用你让

找到的<一个href="http://www.pcreview.co.uk/forums/checking-accessing-custom-attribute-fails-0x8000500c-t2114136.html"相对=nofollow>此处。这听起来像你的问题,因为这个问题所做的更新。

I got the following snippet (SomeName/SomeDomain contains real values in my code)

var entry = new DirectoryEntry("LDAP://CN=SomeName,OU=All Groups,dc=SomeDomain,dc=com");
foreach (object property in entry.Properties)
{
    Console.WriteLine(property);
}

It prints OK for the first 21 properties, but then fail with:

COMException {"Unknown error (0x8000500c)"}
   at System.DirectoryServices.PropertyValueCollection.PopulateList()
   at System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName)
   at System.DirectoryServices.PropertyCollection.PropertyEnumerator.get_Entry()
   at System.DirectoryServices.PropertyCollection.PropertyEnumerator.get_Current()
   at ActiveDirectory.Tests.IntegrationTests.ObjectFactoryTests.TestMethod1() in MyTests.cs:line 22

Why? How can I prevent it?

Update

It's a custom attribute that fails.

I've tried to use entry.RefreshCache() and entry.RefreshCache(new[]{"theAttributeName"}) before enumerating the properties (which didn't help).

Update2

entry.InvokeGet("theAttributeName") works (and without RefreshCache).

Can someone explain why?

Update3

It works if I supply the FQDN to the item: LDAP://srv00014.ssab.com/CN=SomeName,xxxx

Bounty

I'm looking for an answer which addresses the following:

  • Why entry.Properties["customAttributeName"] fails with the mentioned exception
  • Why entry.InvokeGet("customAttributeName") works
  • The cause of the exception
  • How to get both working

解决方案

If one wants to access a custom attribute from a machine that is not part of the domain where the custom attribute resides (the credentials of the logged in user don't matter) one needs to pass the fully qualified name of the object is trying to access otherwise the schema cache on the client machine is not properly refreshed, nevermind all the schema.refresh() calls you make

Found here. This sounds like your problem, given the updates made to the question.

这篇关于遍历属性时ActiveDirectory的错误0x8000500c的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆