A while back, I promised I'd continue talking about CDO, .Net, Exchange, AD, and good stuff like that. Albeit belatedly, I thought I'd post how to mailbox enable a user in VB.Net.
I'm goign to assuem that the user is already in the directory, as we already covered creating objects a while back. Inorder to do this, you're goign to need the Exchange Management Tools installed on your dev box, as a COM object does the work here.
In your VS project, you'll need to add a reference to the “Microsoft CDO for Exchange Management Library” (aka CDOEXM). You're also going to need the full distinguished name of the exchange mailbox store you're planning to create the mailbox in. This can be a hassle to get right if you've never tried to type out the path by hand. The easiest way to find the path, copy & paste ready is to use the handy ldp utility included with any server OS (see my previous blog entry on using this utility). The data is in the Configuration/Services/Microsoft Exchange/Your Org/Administrative Groups/Your Admin Group/Servers/Your Server/Information Store/Information Store Name/MailboxStoreName tree.
There's actually only a couple of lines of code involved in doing the actual mailbox creation. The code is below, and then I'll explain briefly below:
>>>>>
Option Strict Off
Imports System.DirectoryServices
Imports CDOEXM
Dim user As New DirectoryEntry(”LDAP://cn=john doe,cn=users,dc=mydomain,dc=local”)
Dim mbx as IMailboxStore = user.NativeObject
mbx.CreateMailbox(”CN=My Mailbox Store (MyServer),CN=Information Store,CN=InformationStore,CN=MyServer,CN=Servers,CN=MyAdminGroup,CN=Administrative Groups,CN=MyOrganization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=mydomain,DC=local”)
user.CommitChanges
<<<<<<<
So, what we've done here is quite simple: First, we bound to the user in the directory, and then we created a IMailboxStore object representing the user. We then called IMailboxStore.CreateMailbox, passing the distinguished name of the mailbox store to it. We saved the changes to the user object, and, voila, mailbox created! The IMailboxStore object has a bunch of other properties, items such as quotas and other odd's and ends. They're pretty self explanatory if explored through intellisense, and there are full docs in MSDN.
Sometimes remembering or deriving the full distinguished name of an object in the directory can be painful to do by hand. Luckily, Microsoft provides a nice little browser utility with the server os' and the 2003 admin pack. Beware that you can do A LOT of damage with the utility, so, my recommendation is to use standard user credentials when binding - you could delete a nice chunk of the directory tree without much effort!
So, open up the utility (start>run>ldp), and then goto File>connect, and up in the FQDN of the domain you want to bind to (e.g. mycompany.local). Next, goto File>bind, and put in some domain credentials - stadnard user ones are more than enough and highly recommended! The third step is going to View>tree, and then just press OK. If you're in a large domain, you might want to specify the DN of a root to cut down on DC load.
Now you can browse to the object you need the DN of. Find it, and double click. On the right, if you scroll up a bit, you'll find all the object's attributes, including it's DN. Highlight it, press Ctrl + C, and paste it in whereever useful
April 2004 MSDN Lib is up on Subscriber Downloads.
School T1 really moves at 1:15AM - 160KB/sec.
KC Blogged about the lack of IT Bloggers. I signed up for a blog here on aspnet back when it was actually .net focused. The site has obviously changed quite a bit since then. I've always kept most of my non-.Net stuff at my own site - www.briandesmond.com.
With the route this site has gone, should I start cross posting general IT stuff here?
I've noticed this issue where intraVnews will periodically stop downloading certain feeds. It appears, based on my extensive research (err interpetation of the dialog), that after an error getting a feed, intraVNews will stop downloading it. This is easy to correct, though:
- Open the subscriptions dialog from the toolbar
- Sort the list at the bottom by status
- Select all the blogs with some sort of error or “Not Active“
- Right click and goto Reset Feed History
- This will force intraVnews to redownload the RSS from the selected items
The side effect is that you may end up with some duplicates in the blog's folder, but, it's better than manually resubscribing to each blog.
Last week, Greg Reinacker, the creator of Newsgator linked me to this post on his blog which details how to set ActiveSync up to download only messages in the blogs section of your PST. Very straightforward.
Now I can sit on the train in the morning, and read all the blogs I have setup in Outlook.
I have a Dell Axim which I use for my tasks, contacts calendar, and as an MP3 Player. I've read a bit about various RSS Aggregators for the PPC on this feed ad a few others.
What I need/want, though, is for the items I read on my PPC to be marked read in Outlook when I've read them on my PocketPC. I currently use Intravnews at home. I thought ActiveSync would let you sync an arbitrary folder in your PST, but, it appears to be solely the inbox, and I don't want to read email on the train in the morning.
Is there a solution available to do what I want, or am I out of luck for now?
I thought I'd post a solution to a debug issue I had today. I've had it before, and now I'll be able to google my blog for the solution.
When trying to debug a WinForms app, VS reports “The debugger is not properly installed. Run setup to install or repair the debugger.”'
This is pretty easy to fix. Close out VS, and open a command prompt.
Browse to %ProgramFiles%\Common Files\Microsoft Shared\VS7Debug
reregister each of the dll's (e.g. regsvr32 coloader.dll), and then run mdm and vs7jit with a /regserver switch (e.g. vs7jit /regserver).
Load up VS again, and it should be fixed.
I'm curious how other people do this. I can't figure out how to easily check the output of an SPROC which does a FOR XML. I tried copying the textual output to VS and then hitting the format code button, but there's some sort of wrapping issue, so the XML is invalid.
I learnt how to enable sorting on a datagrid with Viewstate disabled for the grid. Quite simple, actually - here's how:
You have to rebind on every page load, and manually put the SortExpression in Viewstate:
Sub Page_Load (sender as Object, e as EventArgs) Handles MyBase.Load
' Note that you CANNOT enclose in the usual If Not Page.IsPostback block!
myGrid.DataSource = myDataSet
myGrid.DataBind()
End Sub
Sub myGrid_SortCommand(sender as Object, e as DatagridSortCommandEventArgs)
Viewstate(“SortExpression“) = e.SortExpression
myGrid.DataSource = mySortedDataset
myGrid.DataBind()
End Sub
That's it! You'll, of course, find your page size to be much much smaller if viewstate is disabled on the grid.
More Posts
Next page »