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: 23 Aug 2005 10:32:46 -0700,    group: microsoft.public.exchange2000.development        back       


Error trying to create new Virtual Directory in the Public Folders   
Hey all,

I've been using the following code from Microsoft to attempt to
programtically create a new Virtual Directory under the Public folders:

' StrFolderName: The folder path that you want to publish as the
virtual directory. Use the following format:
"<TreeName>\<SubFolderName>"
' strComputerName: The computer name of your Exchange 2000 server where
you set up this virtual directory.
Function CreateWeb(strFolderName As String, strComputerName As String)
As Boolean

    Dim iServer         As New CDOEXM.ExchangeServer
    Dim strFHName       As String
    Dim NewWeb          As IADsContainer
    Dim ADCont          As IADsContainer

    Set iServer = CreateObject("CDOEXM.ExchangeServer")

    Result = True

    iServer.DataSource.Open strComputerName
    Set ADCont = GetObject("LDAP://" & iServer.DirectoryServer &
"/CN=1,CN=HTTP,CN=Protocols," & Mid(iServer.DataSource.SourceURL,
InStr(1, iServer.DataSource.SourceURL, "cn=")))

    Set NewWeb = ADCont.Create("msExchProtocolCfgHTTPVirtualDirectory",
"cn=" & strFolderName)

    NewWeb.Put "hTTPPubGAL", CBool(0)
    NewWeb.Put "anonymousAccount", "IUSR_" & strComputerName
    NewWeb.Put "folderPathname", CStr(strFolderName)
    ' "msExchAccessFlags" property: contains the virtual directory
execute permission:
    '512 = Execute Permission=Script
    '516 = Execute Permission=Script&Execute
    '1=Read, 2=Write, 16=Script Access
    NewWeb.Put "msExchAccessFlags", CInt(535)
    ' "msExchAuthenticationFlags" property: contains the virtual
directory authentication settings:
    '1=Anonymous Access, 2=Basic, 4=NTLM
    NewWeb.Put "msExchAuthenticationFlags", CInt(7)
    NewWeb.Put "msExchBasicAuthenticationDomain", CStr(strDomainName)
    NewWeb.Put "msExchDefaultLogonDomain", CStr(strDomainName)
    ' "msExchDirBrowseFlags" property: controls the Web directory
browse permission of the virtual directory:
    '1073741854=No Dir Browse, -1073741794=Dir Browse
    NewWeb.Put "msExchDirBrowseFlags", -1073741794

    'The property specifies the logon method for clear text logons
    NewWeb.Put "msExchLogonMethod", CInt(3)
    NewWeb.Put "msExchServerAutoStart", CBool(-1)
    ' "msExchServerRole" property: This virtual directory resides on
the front end or back end server:
    ' 1 = This is a front end server
    ' 0 = This is a back end server
    NewWeb.Put "msExchServerRole", CInt(0)
    NewWeb.Put "name", CStr(strFolderName)
    'newweb.Put "showInAdvancedViewOnly", cbool(-1)

    On Error Resume Next
    Err.Clear
    NewWeb.SetInfo
    If Err <> 0 Then
       ' If user exists no need to raise an err
       If Err.Number <> &H80071392 Then
          MsgBox "(" + CStr(Err.Number) + ") " + Err.Description, ,
Err.Source
          Result = False
        End If
    End If

    Set NewWeb = Nothing
    Set ADCont = Nothing
    Set iServer = Nothing

    CreateWeb = Result
End Function


I am passing "public\test" to the function as suggested by the
comments, but I receive this error:

"(-2147016654) Automation error
An invalid dn syntax has been specified."

Could someone let me know what I need to do to get this to work?  I
need to be able to create several layers worth of Virtual Directories
within the Public Folders.

Thanks!
date: 23 Aug 2005 10:32:46 -0700   author:   unknown

Google
 
Web ureader.com


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