Morten
Guest
|
Posted:
Sat Oct 22, 2005 4:58 pm Post subject:
Problem wit address lists |
|
|
Hi!
I have some code that will create an Exchange address list and modify the
permissions so that only specific users have acces to the list. The code we
use is at the end of this post.
Everything is created correctly but when users try to logon via Outlook they
get an error because their names can't be found in the address list. If we
then open the address list from Exchange System Manager, preview members and
close the list everything works as expected. Any suggestions?
Morten
LDAPAddress = LDAPAddress.Insert(7,"CN=All Global Address Lists,CN=Address
Lists Container,CN=" + organisation + ",CN=Microsoft
Exchange,CN=Services,CN=Configuration,");
DirectoryEntry root = new DirectoryEntry(LDAPAddress);
DirectoryEntry tempDE = null;
tempDE = root.Children.Add("cn="+companyDomain + "
GAL","addressBookContainer");
//Sets security settings
IADsSecurityDescriptor sd = (SecurityDescriptor)
tempDE.Properties["ntSecurityDescriptor"].Value;
IADsAccessControlList acl= (AccessControlList) sd.DiscretionaryAcl;
//remove "Authenticated Users" and "Everyone"
foreach(AccessControlEntry ace in (IEnumerable) acl)
{
if (ace.Trustee.Equals(@"NT AUTHORITY\Authenticated Users"))
{
acl.RemoveAce(ace);
}
if(ace.Trustee.Equals("Everyone"))
{
acl.RemoveAce(ace);
}
}
tempDE.Properties["ntSecurityDescriptor"].Value = sd;
tempDE.CommitChanges();
//Add AllUsers
System.Messaging.Trustee AllTrust = new
System.Messaging.Trustee(defaultDomain+@"\AllUsers."+companyDomain);
AccessControlEntry obNewAce1 = new AccessControlEntry();
obNewAce1.AceType = 0;
obNewAce1.Trustee = AllTrust.Name;
obNewAce1.AccessMask = (131220 | 256);
obNewAce1.AceFlags = 2;
obNewAce1.Flags = 0;
acl.AddAce(obNewAce1);
tempDE.Properties["ntSecurityDescriptor"].Value = sd;
tempDE.CommitChanges();
//Order the ace's ind the acl
sortACE("LDAP://"+getDNC(), companyDomain, "GAL");
tempDE.CommitChanges();
//Add the new GAL to the CN=Microsoft Exchange object, so that Outlook
clients would know the list of all the GALs
DirectoryEntry msExchService = new
DirectoryEntry("LDAP://"+server+"/CN=Microsoft
Exchange,CN=Services,CN=Configuration,"+getDNC());
msExchService.Properties["globaladdresslist"].Add(tempDE.Properties["distinguishedName"].Value.ToString());
msExchService.CommitChanges();
msExchService.Close();
}
}
|
|