Creare una MailBox in Exchange (un'altra soluzione)

In un mio precedente post avevo spiegato come creare una mailbox in Exchange utilizzando l’SDK di Exchange e .NET; è una soluzione che funziona correttamente, tuttavia a livello di performance lascia un po’ a desiderare, inoltre obbliga ad installare l’SDK di Exchange sul client che utilizziamo.

Per fortuna esiste una soluzione alternativa, ovvero scrivere direttamente su Active Directory tutti gli attributi necessari per l’attivazione della MailBox:

 

DirectoryEntry user = new DirectoryEntry("LDAP://CN=username,DC=myDomain,DC=local");

 

// Definisce i proxyAddresses

string[] proxy = {"SMTP:username@ugidotnet.it", "X400:c=US;a= ;p=Organization;o=Exchange;s=samaccountname;"};

 

// Imposta le proprietà

user.Properties["mail"].Value = " nomeutente@ugidotnet.it";

user.Properties["textEncodedORAddress"].Value = "X400:c=US;a= ;p=Organization;o=Exchange;s=username;";

user.Properties["proxyAddresses"].Value = proxy;

user.Properties["msExchUserAccountControl"].Value = 0;

 

user.Properties["mDBUseDefaults"].Value = "FALSE";

user.Properties["mDBOverHardQuotaLimit"].Value = 3145728;

user.Properties["mDBOverQuotaLimit"].Value = 3145728;

user.Properties["mDBStorageQuota"].Value = 2831155;

user.Properties["msExchQueryBaseDN"].Value = "OU=Empty,OU=MyOU,DC=emslabw3,DC=local";

user.Properties["msExchMailboxFolderSet"].Value = 130869;

user.Properties["msExchOmaAdminWirelessEnable"].Value = 0;

user.Properties["showInAddressBook"].Value = "CN=Default Global Address List,CN=All Global Address Lists,CN=Address Lists Container,CN=EMSEXC,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=myDomain,DC=local";

user.Properties["submissionContLength"].Value = 30720;

user.Properties["delivContLength"].Value = 30720;

user.Properties["msExchOmaAdminWirelessEnable"].Value = 0;

user.Properties["msExchPoliciesIncluded"].Value = "{2B48DE9A-B639-440F-A239-E258B0FE4F4F},{26491CFC-9E50-4857-861B-0CB8DF22B5D7}";

user.Properties["homeMTA"].Value = "CN=Microsoft MTA,CN=SERVERNAME,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=EMSEXC,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=myDomain,DC=local";

user.Properties["homeMDB"].Value = "CN=Mailbox Store (SERVERNAME),CN=First Storage Group,CN=InformationStore,CN=SERVERNAME,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=EMSEXC,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=myDomain,DC=local;";

user.Properties["mailNickname"].Value = "samaccountname";

user.Properties["legacyExchangeDN"].Value = "/o=EMSEXC/ou=First Administrative Group/cn=Recipients/cn=samaccountname";

user.Properties["msExchMailboxGuid"].Add(System.Guid.NewGuid().ToByteArray());

user.Properties["msExchHomeServerName"].Value = "/o=EMSEXC/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=SERVERNAME";

 

// Attivazione mailbox

user.CommitChanges();

 

Anche in questo caso, come nel precedente, l’operazione non crea realmente la mailbox, ma rende l’utente in AD "MailBox Enabled". La mailbox verrà realmente creata solo al primo accesso, e la lingua impostata sarà quella del browser con cui si è effettuato l’accesso; se si desidera forzare la creazione della mailbox è necessario fare una chiamata http che simuli l’accesso alla mailbox tramite browser.

 

Technorati Tags: , ,

posted @ giovedì 19 gennaio 2006 17:47

Print

Comments on this entry:

# re: Creare una MailBox in Exchange (un'altra soluzione)

Left by Mitch at 20/01/2006 00:03
Gravatar
...o più semplicemente puoi mandare una mail alla nuova casella.

Ciao.
Comments have been closed on this topic.
«luglio»
domlunmarmergiovensab
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910