Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Exchange
2000.active.directory
2000.admin
2000.announcements
2000.app.conversion
2000.applications
2000.clients
2000.clustering
2000.connectivity
2000.development
2000.documentation
2000.general
2000.information.store
2000.interop
2000.kms
2000.misc
2000.protocols
2000.realtime.collabo.
2000.setup
2000.transport
2000.win2000
admin
application.conversion
applications
clients
clustering
connectivity
design
development
misc
mobility
setup
tools
  
 
date: 5 Jul 2005 09:38:33 -0700,    group: microsoft.public.exchange2000.development        back       


DeleteMailbox ASP.NET (MVP? Anyone? please!)   
I'm running this code from a webservice on an Exchange 2000 server
itself.

The process is running as the generic user, but the account that it
actually performs the action as is specified in the credentials read
from web.config (I've tried it with different accounts, including an
exchange full admin, and one simply deletegated delete mailbox rights
just to rule out the rights issue)
as you can see below when it connects to the object.

I have similar code that creates a mailbox, and that works fine and
dandy, but this delete mailbox keeps giving me a CDOEXM.Interop
COMException saying "Unspecified error" as the message.

Here's another snag for you... I use this same exact code from an XP
box with the management tools only installed, and it works.... (yes I
assure you I'm dumbfounded by this as well, but it works from my xp
host, but not on the exchagne server itself, and yes, I use the same
credentials for both hosts.)

(A major difference between the XP host and the 2000 server, xp host
has .net 1.0, server has .net 1.1)

I know the interfact to IMailboxStore is functioning because I can read
back the HomeMDB from the objMailbox and return it  (commented out
below) successfully.

here's the code:

 Try


            Dim objADSIuser As New DirectoryEntry("LDAP://" & dcServer
& "/" & dn, ConfigurationSettings.AppSettings.Item("serviceAcctName"),
ConfigurationSettings.AppSettings.Item("serviceAuthen"),
(AuthenticationTypes.Secure + AuthenticationTypes.ServerBind))

            Dim objMailbox As CDOEXM.IMailboxStore =
objADSIuser.NativeObject

            'tried the following commented out line to make sure it's
not null
            'Return objMailbox.HomeMDB 'works so its pointing to the
real deal

            objMailbox.DeleteMailbox() 'unspecified error (COMExeption)

            objADSIuser.CommitChanges()

            Return "<Message>Mailbox Deleted Successfully</Message>"

        Catch exceptionEx As System.Exception


            Return "<xml version=\"1.0\" encoding=\"utf-8\">
<Message><StackTrace>" + exceptionEx.StackTrace +
"</StackTrace><ExceptionSource>" + exceptionEx.Source +
"</ExceptionSource><ExceptionMessage>" + exceptionEx.Message +
"</ExceptionMessage></Message>"

        End Try

I'm really quite stumped becasue the libraries are the same for both
create and delete mailbox, to my knowledge, and yet, somehow it doesn't
work for deletemailbox, while still being able to create one in the
same webservice. (I know I'm repeating myself, but someone will miss
what I wrote the first time, and tell me to try something I already
have, it happens all the time, so the repeating gives one ample
opportunity to get the scenario.)

I know that I'm not using CDOEX.dll because on the xp host when it
works, there is no such dll, so that can't be it either.

Please help, I think I'm starting to go insane.

FYI, here's the create code, which actually works on both hosts:

 Try

            Dim objADSIuser As New DirectoryEntry("LDAP://" & dcServer
& "/" & dn, ConfigurationSettings.AppSettings.Item("serviceAcctName"),
ConfigurationSettings.AppSettings.Item("serviceAuthen"))



            Dim objMailbox As CDOEXM.IMailboxStore =
objADSIuser.NativeObject

            ldapString = "LDAP://" & dcServer & "/" & _
             "CN=" & mailStore & "," & _
             "CN=" & storageGroup & "," & _
             "CN=InformationStore," & _
             "CN=" & mailServer & "," & _
             "CN=Servers," & _
             "CN=" & adminGroup & "," & _
             "CN=Administrative Groups," & _
             "CN=" & "Company" & "," & _
             "CN=Microsoft Exchange," & _
             "CN=Services," & _
             "CN=Configuration," & "dc=company,dc=com"

            objMailbox.CreateMailbox(ldapString)

            objADSIuser.CommitChanges()

            Return "<Message>Mailbox Created Successfully</Message>"

        Catch exceptionEx As System.Exception

            ' Return ldapString

            Return "<Message>Error Creating Mailbox: " +
exceptionEx.Message + _
            "( " + ldapString & " )</Message>"

        End Try
date: 5 Jul 2005 09:38:33 -0700   author:   unknown

Re: DeleteMailbox ASP.NET (MVP? Anyone? please!)   
ok I figured it out.  I just went into web.config and enabled
impersonation for the entire web service.  (I didn't want to have to do
that which is why I went to all the trouble of specifying credentials
in the first place.) But, some things are beyond my control
date: 7 Jul 2005 10:38:18 -0700   author:   aldousd666

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us