> Hi, 
> 
>       While working with CDO for Exchange 2000 , I am facing small problem
> with Outlook.
> Here's what I do,
> 
> a) I use CDO methods to save the message into a local file, delete the
> bodyparts of the 
>    Message and add my text.
> 
> b) Then after a while, I try to read the Message from the file and save it
> back to the
>    Original location i.e Url of the Message.
> 
> PROBLEM:
> The Message get written to the Url BUT Outlook displays the message (when
> opened) as
> "This message has not been sent". If I resend it again, then I will get
> the Message as it was 
> originally.
> 
> Am I missing something? Is there anything I need to take care of, while
> using 
> Datasource.SaveTo() method. I assume that this method Overwrites to the
> Url (if the option
> "adCreateOverwrite" is set).Should I set any other property for the
> message? 
> 
> This problem occurs irregularly in my system.
> 
> Thanks and Regards
> Vijay 
> 
> 
> Below is the code for reference.
> 
> 
> VB Project References:
> a) Microsoft CDO for Exchange 2000 Library (cdoex.dll).
> b) Microsoft Activex Data Objects 2.6 Library (msado15.dll)
> 
> Code To save in a Local file
> ============================
> Dim iMsg As New CDO.Message
> Dim St As New ADODB.Stream
> Dim Url as string
> 
> Url = "file://./backofficestorage/Mydomain.com/MBX/vijay/Inbox/Hi.EML"
> 
> 
>     iMsg.DataSource.Open Url _
>                        , _
>                        , adModeReadWrite
> 
> 
>     Set St = iMsg.GetStream
> 
>     'Save it to local file
> 
>     St.SaveToFile "D:\MySavedMessage.EML", adSaveCreateOverWrite
> 
>     iMsg.BodyPart.BodyParts.DeleteAll
> 
>     'Put My Message
> 
>     Set iBp = iMsg.BodyPart.AddBodyPart
> 
>     Set Flds = iBp.Fields
> 
>     Flds("urn:schemas:mailheader:content-type") = "text/plain"
>     Flds.Update
> 
>     Set Strm = iBp.GetDecodedContentStream
> 
>     Strm.WriteText "Stored to a Local file"
>     Strm.Flush
> 
>     iMsg.DataSource.Save
> 
>     Set iBp = Nothing
>     Set iMsg = Nothing
>     Set St = Nothing
> 
> 
> 
> Code To rewrite from the Local file
> ===================================
> 
> Dim Stm As New ADODB.Stream
> Dim iMsg As New CDO.Message
> Dim iDsrc As IDataSource
> Dim Url as String
> 
> 
> Url = "file://./backofficestorage/Mydomain.com/MBX/vijay/Inbox/Hi.EML"
> 
>     Set iDsrc = iMsg
> 
>     Stm.Open
>     Stm.LoadFromFile "D:\MySavedMessage.EML"
> 
>     iDsrc.Open Url _
>                , _
>                , adModeReadWrite
> 
>     iDsrc.OpenObject Stm, "_Stream"
> 
>     iDsrc.SaveTo Url _
>                , _
>                  , adModeWrite _
>                  , adCreateOverwrite
>     
>     iMsg.DataSource.Save
> 
>     Set iDsrc = Nothing
>     Set iMsg = Nothing
>     Set Stm = Nothing

_________________________________________________________________
List posting FAQ:       http://www.swinc.com/resource/exch_faq.htm
Archives:               http://www.swynk.com/sitesearch/search.asp
To unsubscribe:         mailto:[EMAIL PROTECTED]
Exchange List admin:    [EMAIL PROTECTED]

Reply via email to