DirectoryEntry CommitChanges() 未提交更改?
在您彻底结束这个重复问题之前,值得注意的是,答案不起作用。
所以这是我到目前为止所尝试的:
第一次尝试是在记录中使用 .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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来问题是我的不耐烦造成的。
完全按照我的需要做了;此时更改还没有通过所有 AD 服务器复制。
It appears the problem was a case of my impatience.
did exactly what I needed; changes just hadn't replicated through all the AD servers at that point.