Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_cdo thread: Setting Mail Headers


Message #1 by "Sumanesh Maharabhusanam" <studysuman@r...> on 21 Jan 2002 06:16:53 -0000

hi again,=0D=0A   i want to add a note to my mail so that i can retrieve an

d process that note after the receipient opens that mail and do some operat

ion based on the note.. so i thought of adding it in Comment field of Mail 

Header. as i am using CDO.Message to send new mails, i can not find that pr

operty in that object, so i had to append a new field and after going throu

gh MSDN, i found a coding...=0D=0A=0D=0A-----------------------------------

---------------=0D=0A1.    Dim Msg as New CDO.Message=0D=0A2.    Dim Flds a

s ADODB.Fields=0D=0A3.=0D=0A4.    Set Flds =3D Msg.Fields=0D=0A5.    With F

lds=0D=0A6.      .Append("urn:schemas:mailheader:message-id") =3D id=0D=0A7

.      .Append("urn:schemas:mailheader:custom")   =3D "some value"=0D=0A8. 

     .Update=0D=0A9.    End With=0D=0A-------------------------------------

-------------=0D=0A=0D=0Aand it is not working (even in VB) in line number 

4, it is giving an error Type Mismatch. and i ve removed the 4th line code 

and i ve tried to append a  field directly to CDO.Message, using this code,

=0D=0A=0D=0AMsg.Fields.Append "TestField" , adVariant=0D=0A=0D=0Aand it is 

saying an error as =0D=0A=0D=0AArguments are of the wrong type, are out of 

acceptable range, or are in conflict with one another=0D=0A=0D=0Aand i dont

 know why.. please help.=0D=0A=0D=0Athanks in advance=0D=0ASumanesh =0A

Message #2 by "Siegfried Weber" <sweber@c...> on Mon, 21 Jan 2002 08:31:24 +0100
If you're getting an error on line 4 you might have a configuration

issue with this machine. You should be able to retrieve the fields

collection of the CDO.Message without any problem.



Did you install MDAC 2.7 by any chance?



<Siegfried />



> -----Original Message-----

> From: Sumanesh Maharabhusanam [mailto:studysuman@r...]

> Sent: Monday, January 21, 2002 7:17 AM

> To: ASP CDO

> Subject: [asp_cdo] Setting Mail Headers

>

>

> hi again,

>    i want to add a note to my mail so that i can retrieve and process

that

> note after the receipient opens that mail and do some operation based

on

> the note.. so i thought of adding it in Comment field of Mail Header.

as i

> am using CDO.Message to send new mails, i can not find that property

in

> that object, so i had to append a new field and after going through

MSDN,

> i found a coding...

>

> --------------------------------------------------

> 1.    Dim Msg as New CDO.Message

> 2.    Dim Flds as ADODB.Fields

> 3.

> 4.    Set Flds =3D Msg.Fields

> 5.    With Flds

> 6.      .Append("urn:schemas:mailheader:message-id") =3D id

> 7.      .Append("urn:schemas:mailheader:custom")   =3D "some value"

> 8.      .Update

> 9.    End With

> --------------------------------------------------

>

> and it is not working (even in VB) in line number 4, it is giving an

error

> Type Mismatch. and i ve removed the 4th line code and i ve tried to

append

> a  field directly to CDO.Message, using this code,

>

> Msg.Fields.Append "TestField" , adVariant

>

> and it is saying an error as

>

> Arguments are of the wrong type, are out of acceptable range, or are

in

> conflict with one another

>

> and i dont know why.. please help.

>

> thanks in advance

> Sumanesh

>

>




$subst('Email.Unsub').

Message #3 by Sumanesh Maharabhusanam <sumaneshm@y...> on Mon, 21 Jan 2002 19:51:20 -0800 (PST)
hi Siegfried,

   Thanks for replying, then it was not giving any

error in the retrieval of the fields, it was giving

error in the assignment of the cdo.fields to

ADODC.Fields.

 

and the coding for creation of login using ADSI also

didnt work (u ve sent me) 



"http://www.cdolive.net/download/adusermanagement.zip"



it is simply saying Errors Occured while trying to use

SaveTo method of CDO.Person.



and i ve tried a different code, tat read...

------------------------------------------------------

Sub CDOCreateMailBoxRecipient(MDBName, _

                              domainName, _

                              exchangeOrg, _

                              adminGroup, _

                              storageGroup, _

                              storeName, _

                              emailname, _

                              firstName, _

                              lastName)

 Dim objPerson

 Set objPerson = CreateObject("CDO.Person")

 Dim objMailbox



 Dim domTokens

 domTokens     = split(domainName,".",-1,1)

 domainDN      = join(domTokens,",DC=")

 domainDN      = "DC=" &  domainDN	



 objPerson.FirstName = FirstName

 objPerson.LastName  = LastName

 objPerson.Fields("userPrincipalName") = LastName

 objPerson.Fields("userAccountControl") = 512

 objPerson.Fields("userPassword") = "password"

 objPerson.Fields.Update

 

 objPerson.DataSource.SaveTo "LDAP://CN=" + MDBName +

_

                            ",CN=" + emailname + _

                            ",CN=users," + domainDN



 

....

------------------------------------------------------



and it is saying that "There is no such object in the

Server" in the "objPerson.dataSource.SaveTo" method.

please tell me how to see the MDB name. I have used

the exchange database name of the Public Folder ... in

the System Manager -> Servers -> Server (server name)

-> First Storage Group.  and it read something like

pub1.edb.. and i ve used "pub1" for MDBName. is it

correct. please help me.



Thanks for your time

Sumanesh





__________________________________________________

Do You Yahoo!?

Send FREE video emails in Yahoo! Mail!

http://promo.yahoo.com/videomail/

Message #4 by "Siegfried Weber" <sweber@c...> on Tue, 22 Jan 2002 10:59:00 +0100
The code I mentioned works perfectly on an Exchange 2000 Server, which

is required because you'd otherwise miss the CDOEX &CDOEXM libraries. As

I mentioned also, I don't have documentation hence there is no mentioned

what the requirements are but I figured you will be able to get this

sorted out yourself with the code.



<Siegfried />



> -----Original Message-----

> From: Sumanesh Maharabhusanam [mailto:sumaneshm@y...]

> Sent: Tuesday, January 22, 2002 4:51 AM

> To: ASP CDO

> Subject: [asp_cdo] RE: Setting Mail Headers

>

> hi Siegfried,

>    Thanks for replying, then it was not giving any

> error in the retrieval of the fields, it was giving

> error in the assignment of the cdo.fields to

> ADODC.Fields.

>

> and the coding for creation of login using ADSI also

> didnt work (u ve sent me)

>

> "http://www.cdolive.net/download/adusermanagement.zip"

>

> it is simply saying Errors Occured while trying to use

> SaveTo method of CDO.Person.

>

> and i ve tried a different code, tat read...

> ------------------------------------------------------

> Sub CDOCreateMailBoxRecipient(MDBName, _

>                               domainName, _

>                               exchangeOrg, _

>                               adminGroup, _

>                               storageGroup, _

>                               storeName, _

>                               emailname, _

>                               firstName, _

>                               lastName)

>  Dim objPerson

>  Set objPerson =3D CreateObject("CDO.Person")

>  Dim objMailbox

>

>  Dim domTokens

>  domTokens     =3D split(domainName,".",-1,1)

>  domainDN      =3D join(domTokens,",DC=3D")

>  domainDN      =3D "DC=3D" &  domainDN

>

>  objPerson.FirstName =3D FirstName

>  objPerson.LastName  =3D LastName

>  objPerson.Fields("userPrincipalName") =3D LastName

>  objPerson.Fields("userAccountControl") =3D 512

>  objPerson.Fields("userPassword") =3D "password"

>  objPerson.Fields.Update

>

>  objPerson.DataSource.SaveTo "LDAP://CN=3D" + MDBName +

> _

>                             ",CN=3D" + emailname + _

>                             ",CN=3Dusers," + domainDN

>

>

> ....

> ------------------------------------------------------

>

> and it is saying that "There is no such object in the

> Server" in the "objPerson.dataSource.SaveTo" method.

> please tell me how to see the MDB name. I have used

> the exchange database name of the Public Folder ... in

> the System Manager -> Servers -> Server (server name)

> -> First Storage Group.  and it read something like

> pub1.edb.. and i ve used "pub1" for MDBName. is it

> correct. please help me.

>

> Thanks for your time

> Sumanesh

>

>

> __________________________________________________

> Do You Yahoo!?

> Send FREE video emails in Yahoo! Mail!

> http://promo.yahoo.com/videomail/

>




$subst('Email.Unsub').


  Return to Index