Jump to content

Recommended Posts

Posted

Does anyone know of a way to use VB.net (Express 2008) to create an Exchange mailbox? I used to use the old CDO (cdo.dll,cdoexm.dll) methods but these don't seem to work on Server 2008.

 

Searching around the web always seems to come back to the CDO object, but surely there is another method available in .net that doesn't rely on dlls from 2001!

 

Another issue is that I can't install the Exchange 2003 Management tools onto 2008 Server which causes further problems.

Posted

Nice idea though!

 

Shame MS haven't provided the 2003 Exchange Management Tools for Server 2008. If I could register the cdoexm.dll on Server 2008 I would be OK as this would give me the references required.

 

I'm amazed there doesn't seem to be a proper,.NET, MS approved way of creating mailboxes!

Posted (edited)

Can you use this:

 

 	strAccountName = "ACCOUNTNAME"
'Get parent container
	Set oContainer = GetObject("LDAP://" & strNetworkLdap)
	'Create user
	Set oUser = oContainer.Create("User","CN=" & strAccountName)
	
	strHomeMDB = "CN=Mailbox Store (EXCHANGE),CN=First Storage Group,CN=InformationStore," & _
				"CN=EXCHANGE,CN=Servers,CN=First Administrative Group,CN=Administrative Groups," & _
				"CN=YOUR Storage GROUP,CN=Microsoft Exchange,CN=Services," & _
				"CN=Configuration,DC=YOUR,DC=DOMAIN" 
	oUser.Put "HomeMDB", strHomeMDB
	oUser.Put "mailNickname", strAccountName	'Set Exchange Alias to Username
	oUser.SetInfo

 

This will create a user.

Edited by apeo
For got to define oUser.
  • Thanks 1
Posted (edited)

I think that code just sets their mailbox location - it creates the user and set their Exchange details but doesn't actually create the mailbox itself.

 

I use similar code to the above to create the user account and set their details, but use references to the CDOEMX.IMailboxStore object to actually create mailboxs and set the storage limits. This simply won't work in Server 2008 and MS seem to offer no alternative.

 

EDIT: Actually I'm wrong that has worked (blame my poor typing!) - nice one! All I need to do now is find a way to set the mailbox sizes

Edited by GoldenWonder
Posted

No it doesnt create a mailbox, that gets created after. As for your mailbox sizes, if you're not using the defualt then:

 

		oUser.Put "mDBUseDefaults",False
	oUser.Put "mDBStorageQuota",SetNumericValueHereForIssueWarning
	oUser.Put "mDBOverHardQuotaLimit",SetNumericValueHereForProhibitSendAndReceive

Posted

Ahh now thats working a treat!

 

I had a few problems when setting the mDB... values, but checking ADSIEdit shows that these values must be integers (I was using Long) - and now it all seems to work!

 

Brilliant stuff, thanks for everyones help on this.

 

By the way, does the mailbox not get created until the users first login? (thats my understanding anyway)

  • Thanks 1
Posted
Ahh now thats working a treat!

 

I had a few problems when setting the mDB... values, but checking ADSIEdit shows that these values must be integers (I was using Long) - and now it all seems to work!

 

Brilliant stuff, thanks for everyones help on this.

 

By the way, does the mailbox not get created until the users first login? (thats my understanding anyway)

 

Yeah i should have said its an iteger, its basically the same value you put in when you do it manually. Glad you got it to work.

 

My understanding is the same, the details are put into AD but the Mailbox isnt created/finish properly until they login to their email account the first time. I think up till that point its there only in part. That being said, sometimes theres a delay and you find that users cant login right away. This isnt a problem, you can either wait a bit and it updates itself or you can open up the mailbox within your account in Outlook.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



  • 12 When would you like EduGeek EDIT 2025 to be held?

    1. 1. Select a time period you can attend


      • I can make it in June\July
      • I can make it in August\Sept
      • Other time period. Please comment in the thread what works for you
      • Either time

×
×
  • Create New...