PC Review


Reply
Thread Tools Rate Thread

Load MSG into PST

 
 
MON205
Guest
Posts: n/a
 
      20th Jul 2008
Hello,
I want to load a stand alone MSG file (on disk) into Outlook. To do this, I
tried using the CreateItemFromTemplate() function. This always return
"invalid argument" when trying to pass a folder as the second argument. To go
over this, I tried ignoring the second parameter. Now, the MSG loaded into
the DRAFTS folder. Another time, I went over this by moving the mail to the
Inbox. Also, the Message Dates changed (creation / Delivery). These dates can
be updated.
The problem now that the MSG appaers as "not sent". I tried setting the
(0xF402) property using OutlookSPY, but that didn't change anything. Also
Redemption.RDOMail.put_Sent() returned "0x8004011a"!!!!!
Any help?
 
Reply With Quote
 
 
 
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      20th Jul 2008
How exactly did you call CreateItemFromTemplate?
RDOMail.Sent can be set only before the message is saved for the very first
time, otherwise you will get the MAPI_E_COMPUTED error.
If oyu are using Redemption, why do you even need
Namespace.CreateItemFromTemplate?
Something like the following will do the trick:

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Folder = Session.GetDefaultFolder(...)
set Msg = Folder.Items.Add
Msg.Sent = true
Msg.Import(..., olMsg)
Msg.Save

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"MON205" <(E-Mail Removed)> wrote in message
news:28AC6640-9C21-489B-BEEB-(E-Mail Removed)...
> Hello,
> I want to load a stand alone MSG file (on disk) into Outlook. To do this,
> I
> tried using the CreateItemFromTemplate() function. This always return
> "invalid argument" when trying to pass a folder as the second argument. To
> go
> over this, I tried ignoring the second parameter. Now, the MSG loaded into
> the DRAFTS folder. Another time, I went over this by moving the mail to
> the
> Inbox. Also, the Message Dates changed (creation / Delivery). These dates
> can
> be updated.
> The problem now that the MSG appaers as "not sent". I tried setting the
> (0xF402) property using OutlookSPY, but that didn't change anything. Also
> Redemption.RDOMail.put_Sent() returned "0x8004011a"!!!!!
> Any help?



 
Reply With Quote
 
MON205
Guest
Posts: n/a
 
      21st Jul 2008
1. How exactly did you call CreateItemFromTemplate?
pInboxFolder = m_spApp->GetNamespace( "MAPI" ).GetDefaultFolder(
Outlook:lFolderInbox );
MSG = m_spApp->CreateItemFromTemplate( TEXT( "f:\\test.msg" ), _variant_t(
pInboxFolder ) );
// Here a E_INVALIDARG exception raise

2. Importing using Redemption succeeded. I noticed that the dates are the
same as the original message, is there any property that I should set
manually as the "Sent"?

3. I think that the Redemption is a great library, but I think that it needs
more work on the documentation.

Thanks Dmitry
-------------------------------------------------

"Dmitry Streblechenko" wrote:

> How exactly did you call CreateItemFromTemplate?
> RDOMail.Sent can be set only before the message is saved for the very first
> time, otherwise you will get the MAPI_E_COMPUTED error.
> If oyu are using Redemption, why do you even need
> Namespace.CreateItemFromTemplate?
> Something like the following will do the trick:
>
> set Session = CreateObject("Redemption.RDOSession")
> Session.MAPIOBJECT = Application.Session.MAPIOBJECT
> set Folder = Session.GetDefaultFolder(...)
> set Msg = Folder.Items.Add
> Msg.Sent = true
> Msg.Import(..., olMsg)
> Msg.Save
>
> --
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
> -
> "MON205" <(E-Mail Removed)> wrote in message
> news:28AC6640-9C21-489B-BEEB-(E-Mail Removed)...
> > Hello,
> > I want to load a stand alone MSG file (on disk) into Outlook. To do this,
> > I
> > tried using the CreateItemFromTemplate() function. This always return
> > "invalid argument" when trying to pass a folder as the second argument. To
> > go
> > over this, I tried ignoring the second parameter. Now, the MSG loaded into
> > the DRAFTS folder. Another time, I went over this by moving the mail to
> > the
> > Inbox. Also, the Message Dates changed (creation / Delivery). These dates
> > can
> > be updated.
> > The problem now that the MSG appaers as "not sent". I tried setting the
> > (0xF402) property using OutlookSPY, but that didn't change anything. Also
> > Redemption.RDOMail.put_Sent() returned "0x8004011a"!!!!!
> > Any help?

>
>
>

 
Reply With Quote
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      21st Jul 2008
1. How did you declare pInboxFolder?
2. No, unless you want to overwrite whatever teh MSG file has or if you want
to add a property not in teh MSG file.
3. That's what the newsgroups are for :-)

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"MON205" <(E-Mail Removed)> wrote in message
news:BA2E2576-FFAE-45B6-A8CC-(E-Mail Removed)...
> 1. How exactly did you call CreateItemFromTemplate?
> pInboxFolder = m_spApp->GetNamespace( "MAPI" ).GetDefaultFolder(
> Outlook:lFolderInbox );
> MSG = m_spApp->CreateItemFromTemplate( TEXT( "f:\\test.msg" ), _variant_t(
> pInboxFolder ) );
> // Here a E_INVALIDARG exception raise
>
> 2. Importing using Redemption succeeded. I noticed that the dates are the
> same as the original message, is there any property that I should set
> manually as the "Sent"?
>
> 3. I think that the Redemption is a great library, but I think that it
> needs
> more work on the documentation.
>
> Thanks Dmitry
> -------------------------------------------------
>
> "Dmitry Streblechenko" wrote:
>
>> How exactly did you call CreateItemFromTemplate?
>> RDOMail.Sent can be set only before the message is saved for the very
>> first
>> time, otherwise you will get the MAPI_E_COMPUTED error.
>> If oyu are using Redemption, why do you even need
>> Namespace.CreateItemFromTemplate?
>> Something like the following will do the trick:
>>
>> set Session = CreateObject("Redemption.RDOSession")
>> Session.MAPIOBJECT = Application.Session.MAPIOBJECT
>> set Folder = Session.GetDefaultFolder(...)
>> set Msg = Folder.Items.Add
>> Msg.Sent = true
>> Msg.Import(..., olMsg)
>> Msg.Save
>>
>> --
>> Dmitry Streblechenko (MVP)
>> http://www.dimastr.com/
>> OutlookSpy - Outlook, CDO
>> and MAPI Developer Tool
>> -
>> "MON205" <(E-Mail Removed)> wrote in message
>> news:28AC6640-9C21-489B-BEEB-(E-Mail Removed)...
>> > Hello,
>> > I want to load a stand alone MSG file (on disk) into Outlook. To do
>> > this,
>> > I
>> > tried using the CreateItemFromTemplate() function. This always return
>> > "invalid argument" when trying to pass a folder as the second argument.
>> > To
>> > go
>> > over this, I tried ignoring the second parameter. Now, the MSG loaded
>> > into
>> > the DRAFTS folder. Another time, I went over this by moving the mail to
>> > the
>> > Inbox. Also, the Message Dates changed (creation / Delivery). These
>> > dates
>> > can
>> > be updated.
>> > The problem now that the MSG appaers as "not sent". I tried setting the
>> > (0xF402) property using OutlookSPY, but that didn't change anything.
>> > Also
>> > Redemption.RDOMail.put_Sent() returned "0x8004011a"!!!!!
>> > Any help?

>>
>>
>>



 
Reply With Quote
 
MON205
Guest
Posts: n/a
 
      22nd Jul 2008
Now it is 1-0 for you
About the "pInboxFolder", GetDefaultFolder() returns a smart pointer
"MAPIFolderPtr" when passin this smart pointer, the exception raised. Also I
tried passing "pInbox.GetInterfacePtr( )" to pass the interface, the function
succeeded but the message added to the Drafts folder.

"Dmitry Streblechenko" wrote:

> 1. How did you declare pInboxFolder?
> 2. No, unless you want to overwrite whatever teh MSG file has or if you want
> to add a property not in teh MSG file.
> 3. That's what the newsgroups are for :-)
>
> --
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
> -
> "MON205" <(E-Mail Removed)> wrote in message
> news:BA2E2576-FFAE-45B6-A8CC-(E-Mail Removed)...
> > 1. How exactly did you call CreateItemFromTemplate?
> > pInboxFolder = m_spApp->GetNamespace( "MAPI" ).GetDefaultFolder(
> > Outlook:lFolderInbox );
> > MSG = m_spApp->CreateItemFromTemplate( TEXT( "f:\\test.msg" ), _variant_t(
> > pInboxFolder ) );
> > // Here a E_INVALIDARG exception raise
> >
> > 2. Importing using Redemption succeeded. I noticed that the dates are the
> > same as the original message, is there any property that I should set
> > manually as the "Sent"?
> >
> > 3. I think that the Redemption is a great library, but I think that it
> > needs
> > more work on the documentation.
> >
> > Thanks Dmitry
> > -------------------------------------------------
> >
> > "Dmitry Streblechenko" wrote:
> >
> >> How exactly did you call CreateItemFromTemplate?
> >> RDOMail.Sent can be set only before the message is saved for the very
> >> first
> >> time, otherwise you will get the MAPI_E_COMPUTED error.
> >> If oyu are using Redemption, why do you even need
> >> Namespace.CreateItemFromTemplate?
> >> Something like the following will do the trick:
> >>
> >> set Session = CreateObject("Redemption.RDOSession")
> >> Session.MAPIOBJECT = Application.Session.MAPIOBJECT
> >> set Folder = Session.GetDefaultFolder(...)
> >> set Msg = Folder.Items.Add
> >> Msg.Sent = true
> >> Msg.Import(..., olMsg)
> >> Msg.Save
> >>
> >> --
> >> Dmitry Streblechenko (MVP)
> >> http://www.dimastr.com/
> >> OutlookSpy - Outlook, CDO
> >> and MAPI Developer Tool
> >> -
> >> "MON205" <(E-Mail Removed)> wrote in message
> >> news:28AC6640-9C21-489B-BEEB-(E-Mail Removed)...
> >> > Hello,
> >> > I want to load a stand alone MSG file (on disk) into Outlook. To do
> >> > this,
> >> > I
> >> > tried using the CreateItemFromTemplate() function. This always return
> >> > "invalid argument" when trying to pass a folder as the second argument.
> >> > To
> >> > go
> >> > over this, I tried ignoring the second parameter. Now, the MSG loaded
> >> > into
> >> > the DRAFTS folder. Another time, I went over this by moving the mail to
> >> > the
> >> > Inbox. Also, the Message Dates changed (creation / Delivery). These
> >> > dates
> >> > can
> >> > be updated.
> >> > The problem now that the MSG appaers as "not sent". I tried setting the
> >> > (0xF402) property using OutlookSPY, but that didn't change anything.
> >> > Also
> >> > Redemption.RDOMail.put_Sent() returned "0x8004011a"!!!!!
> >> > Any help?
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Load request form fails: Could not load some objects because they arenot available on this machine Mandyli611@gmail.com Microsoft Outlook 1 5th Aug 2008 11:22 PM
Using Assembly.Load(byte[]) to load multiple versions of dll, and AppDomain.AssemblyResolve Stephen Ahn Microsoft Dot NET Framework 1 8th May 2006 11:35 AM
beginning page load immediately on postback with a long load time ? Mad Scientist Jr Microsoft ASP .NET 7 30th Jun 2004 09:40 PM
Windows XP hangs between login and load: press esc key begins load! Jason Sirota Windows XP General 2 24th Apr 2004 10:20 AM
can't load system32/config/software and windows failed to load T'ing Jun Windows XP Security 2 2nd Sep 2003 10:39 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:49 AM.