DirectoryEntry toFix = new DirectoryEntry(groupPath,privilegedUserName,privilegedPassword,AuthenticationTypes.Secure);
有没有办法添加" SMTP:bleh@myemail.com"到现有的toFix.Properties列表[" proxyAddresses"]?
Thakns
答案 0 :(得分:0)
查看此MSDN主题:Setting Properties with Multiple Values。以下是上述链接中的一些代码示例。
以下代码示例演示如何使用AddRange方法。
DirectoryEntry ent = new DirectoryEntry("LDAP://Fabrikam/CN=My Username,CN=Users,DC=Fabrikam,DC=com");
ent.Properties["otherTelephone"].AddRange(new object[] {"(425) 523 1462","(523) 125 6321"});
ent.CommitChanges();
以下代码示例演示如何使用Insert方法。
DirectoryEntry ent = new DirectoryEntry("LDAP://Fabrikam/CN=My Username,CN=Users,DC=Fabrikam,DC=com");
ent.Properties["otherTelephone"].Insert(2, "525 623 5423");
ent.CommitChanges();
以下代码示例演示如何使用数组在多值属性上设置值。
DirectoryEntry ent = new DirectoryEntry("LDAP://Fabrikam/CN=My Username,CN=Users,DC=Fabrikam,DC=com");
ent.Properties["otherTelephone"][0] = "425 263 6234";
ent.CommitChanges();