DirectoryEntry CommitChanges() 未提交更改?

发布于 2024-12-19 22:54:07 字数 959 浏览 1 评论 0原文

在您彻底结束这个重复问题之前,值得注意的是,答案不起作用。

所以这是我到目前为止所尝试的:

第一次尝试是在记录中使用 .InvokeSet:

adUser.InvokeSet("department", department);
adUser.CommitChanges();

第二次尝试是遵循 调用 commitChanges() 在 Active Directory 中不会执行任何操作? 并尝试直接访问本机对象:

IADsTSUserEx nativeUser = (IADsTSUserEx)adUser.NativeObject;
nativeUser.Department = department;
adUser.CommitChanges();

随后使用相反,IADsUser

最后,我只是尝试从 Value 属性中设置它:

adUser.Properties["department"].Value = department;
adUser.CommitChanges();

所以我在这里不知所措。以上都没有真正起到保存更改的作用。我有写访问权限,并且没有遇到任何异常。我在这里错过了什么吗?我想这不是我试图争论选择已损坏...

编辑:请参阅下面的答案。

Before you outright close out this question as a duplicate, it's worth noting that the answer did not work.

So here's what I've tried thus far:

First attempt was to use .InvokeSet on the record:

adUser.InvokeSet("department", department);
adUser.CommitChanges();

Second attempt was to follow the answer on Calling commitChanges() does nothing in Active Directory? and try accessing the native object directly:

IADsTSUserEx nativeUser = (IADsTSUserEx)adUser.NativeObject;
nativeUser.Department = department;
adUser.CommitChanges();

Following up that with IADsUser instead.

Finally, I just tried setting it from the Value property:

adUser.Properties["department"].Value = department;
adUser.CommitChanges();

So I'm at a loss here. None of the above actually worked at saving changes. I have write access, and I'm not getting any exceptions. Am I just missing something, here? I'd like to think it's not a case of me trying to argue Select is Broken...

EDIT: See answer below.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你是年少的欢喜 2024-12-26 22:54:07

看来问题是我的不耐烦造成的。

adUser.Properties["department"].Value = department;
adUser.CommitChanges();

完全按照我的需要做了;此时更改还没有通过所有 AD 服务器复制。

It appears the problem was a case of my impatience.

adUser.Properties["department"].Value = department;
adUser.CommitChanges();

did exactly what I needed; changes just hadn't replicated through all the AD servers at that point.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文