DirectoryEntry entry=new DirectoryEntry(addpath,"username","password");
DirectoryEntry newEntry;newEntry=entry.Children.Add(entryName,"organizationalUnit");
newEntry.UsePropertyCache=true;
newEntry.Properties["description"].Value="testOU";
newEntry.CommitChanges();
DirectoryEntry newEntry;newEntry=entry.Children.Add(entryName,"organizationalUnit");
newEntry.UsePropertyCache=true;
newEntry.Properties["description"].Value="testOU";
newEntry.CommitChanges();
解决方案 »
- 怎么样在MdiParent父窗体的背景里画个标志
- 怎样将button做成圆的
- 线程问题,MessageBox.Show()
- 请教一个DOTNET2005的winform问题。
- 如何选择目录呀
- 求助,,,,c#多条数据合并
- 大哥,大姐们,winform窗口中能嵌入excle表格吗,这个功能你们能实现吗,最好给个代码
- datagridview 的问题
- 高分求解:我想實現想window資源管理器中的treeview的功能,即一打開窗口,我要展開我的一級目錄樹,然後我增加一個目錄,treeview自動焦
- 如何获取 共享文件夹的剩余空间
- 关于用.net remoting传送数组对象的问题
- 关于RadioButtonList对象的问题
怎么写?
DirectoryEntry entry=new DirectoryEntry(OUPath,(string)conns["username"],(string)conns["password"]);
DirectoryEntry newEntry;
string entryName="cn=userName";
newEntry=entry.Children.Add(entryName,"user");
newEntry.UsePropertyCache=true;
newEntry.Properties["sAMAccountName"].Value="userName";
newEntry.Properties["userPrincipalName"].Value=="userName";
newEntry.Properties["sn"].Value="usetsn";
newEntry.Properties["displayName"].Value="userName";
newEntry.Properties["userAccountControl"].Value="66048";
newEntry.Properties["givenName"].Value="givename";
newEntry.CommitChanges();
DirectoryEntry myds=new DirectoryEntry(OUPath,"username","password");
foreach(DirectoryEntry tempEntry in myds.Children)
{
if(tempEntry.SchemaClassName.ToString() == "user")
{
if(tempEntry.Properties["sAMAccountName"].Value.ToString().ToLower()=="userID")
{
myds.Children.Remove(tempEntry);
myds.CommitChanges();
}
}
}
提示"不支持此接口 "
具体程序如下:
DirectoryEntry OldUser,NewUser;
DirectoryEntry UserEntry=new DirectoryEntry("WinNT://compueter.com/mycomputer","username","password");
NewUser = UserEntry.Children.Add ("testOU","organizationalUnit");
NewUser.CommitChanges();但是:如果是add user就是对的如:NewUser = UserEntry.Children.Add ("testOU","user");我错在哪?
AddPath用LDAP指向一个OU
(DirectoryEntry)UserEntry.Invoke("Create",new object[2]{"organizationalUnit", "ou=testOU"});真的可以。(不过用Add方法不行,奇怪)
在活动目录中怎么读取email地址?(一个exchange2000)
NewUser = UserEntry.Children.Add ("ou=testOU","organizationalUnit");
是"ou=testOU"
ok?
关于email,你可以将DirectoryEntry对象的所有属性打出来看看
我用模拟身份验证,就不用username,password.
在webconfig中写:
<identity impersonate="true"/>
不过。好象不能社密码。我再去试一下.
怎样修改密码?(用ldap)
DirectoryEntry newEntry;
DirectoryEntry UserEntry=new DirectoryEntry ("LDAP://OU=TESTOU,DC=dev,DC=com");
OldUser = UserEntry.Children.Find (UserAccount,"User");
OldUser.Invoke ("SetPassword",new Object[]{Password});
OldUser.CommitChanges();
怎不行?