Problem wit address lists
Exchange Server Forum Index Exchange Server
Discussion forums for Microsoft Exchange Server users.
Microsoft Outlook
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web ExchangeServerHelp.com
Problem wit address lists

 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development
Author Message
Morten
Guest





Posted: Sat Oct 22, 2005 4:58 pm    Post subject: Problem wit address lists Reply with quote

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();


}

}

Back to top
 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server Dedicated Servers
New Topics Powered by phpBB