|
 |
asp_cdo thread: transform
Message #1 by "Andry Fixa" <fixafixa@m...> on Mon, 5 Feb 2001 15:25:07 +0700
|
|
I have Visual Basic Codes, but I am confuse to transform Visual Basic Codes
to VB Script.
Please help me to transform that code to vbscript
thanks
================================================
Dim objPerson As New CDO.Person
Dim objMailbox As CDOEXM.IMailboxStore
objPerson.DataSource.Open "LDAP://" + ServerName + _
"/CN=" + recipname + _
",CN=users," + DomainName
Set objMailbox = objPerson
If objMailbox.HomeMDB = "" Then
MsgBox "No Mailbox found."
Else
objMailbox.DeleteMailbox
objPerson.DataSource.Save
MsgBox "Mailbox for " + recipname + " deleted successfully"
End If
=====================================================
Message #2 by "Anand [EG-GOE]" <anand@s...> on Tue, 6 Feb 2001 15:10:45 +0800
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0019_01C0904E.FB5ED980
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hi, Since in VBScript all the variables when you declare are Variants(ie you
cannot declare the variable as integer or as an object in Dim Statement),
you declare the variable and then when u initialize it automatically
VBScript takes care of its data and type. Now in VBScript your code should
look like,
Dim objPerson 'Declare
Dim objMailbox 'Declare
Dim strLDAP 'Declare
Set objPerson = Server.Createobject("CDO.Person") 'Initialize
Set objMailbox = Server.Createobject("CDOEXM.IMailboxStore") 'Initialize
strLDAP = "LDAP://" & ServerName & "/CN=" & recipName & ",CN=users," &
DomainName
objPerson.DataSource.Open strLDAP
Set objMailbox = objPerson
If objMailbox.HomeMDB = "" Then
Response.Write "No Mailbox Found"
Else
objMailbox.DeleteMailbox
objPerson.Datasource.Save
Response.Write "Mailbox for " & recipName & " delete successfully."
End If
Here in VBScript you should use Response.Write else MSGBOX may endup
displaying messages in the Server rather than the client. Hope this would
help you.
Anand
HCL Perot Systems.
-----Original Message-----
From: Andry Fixa [mailto:fixafixa@m...]
Sent: Monday, February 05, 2001 4:25 PM
To: ASP CDO
Subject: [asp_cdo] transform
I have Visual Basic Codes, but I am confuse to transform Visual Basic Codes
to VB Script.
Please help me to transform that code to vbscript
thanks
================================================
Dim objPerson As New CDO.Person
Dim objMailbox As CDOEXM.IMailboxStore
objPerson.DataSource.Open "LDAP://" + ServerName + _
"/CN=" + recipname + _
",CN=users," + DomainName
Set objMailbox = objPerson
If objMailbox.HomeMDB = "" Then
MsgBox "No Mailbox found."
Else
objMailbox.DeleteMailbox
objPerson.DataSource.Save
MsgBox "Mailbox for " + recipname + " deleted successfully"
End If
=====================================================
---
http://www.asptoday.com - the leading site for timely,
in-depth information for ASP developers everywhere.
|
|
 |