Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: Redemption: Recipients aren't added after CreateItemFromTemplate()

Geek News

Redemption: Recipients aren't added after CreateItemFromTemplate()
tsahling[ at ]hausmannwynen.de 8/31/2006 2:46:32 PM
Hi!

If I create an item by template, Outlook ignores setted recipients by
Redemption.SafeMailItem. The message always appears without recipient.
If I create the message by CreateItem(), the recipient appears:

--- test.js ---
var outlook = new ActiveXObject( "Outlook.Application" );
var session = outlook.GetNamespace( "MAPI" );
var strEntryID;
// --
session.Logon( "", "", false, false );
// --
{
var mail = outlook.CreateItemFromTemplate( "D:\\work\\vorlage.oft" );
// --
mail.Subject = "test";
mail.Attachments.Add( "D:\\work\\3827319625bsp.pdf" );
mail.Save();
// --
{
var smail = new ActiveXObject( "Redemption.SafeMailItem" );
// --
smail.Item = mail;
smail.Recipients.Add( "test[ at ]test.de" );
// --
mail.Save();
// --
smail = null;
}
// --
strEntryID = mail.EntryID;
// --
mail = null;
}
// --
{
var mail = session.GetItemFromID( strEntryID );
// --
mail.Display( true );
}
// --
session.Logoff();
--- test.js ---

(Redemption 4.12, Outlook 2000, Win 2000 Prof. SP4)

Does anyone has an idea what the problem could be here?

Thanks!

Re: Redemption: Recipients aren't added after CreateItemFromTemplate()
"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> 8/31/2006 5:13:09 PM
Thomas,
I replied yesterday to your question sent to my e-mail address (as as well
to your previous question). Have you received my reply?

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

Try to use RDO family of objects alone to make sure Outlook does not even
see the message until GetItemfromID is called.




var outlook = new ActiveXObject( "Outlook.Application" );
var session = outlook.GetNamespace( "MAPI" );
var strEntryID;
// --
session.Logon( "", "", false, false );
// --
{
var RDOSession = new ActiveXObject( "Redemption.RDOSession" );

RDOSession.MAPIOBJECT = session.MAPIOBJECT;
var mail =
RDOSession.GetDefaultFolder(olFolderDrafts).Items.Add("IPM.Note")

Mail.Import("D:\\work\\vorlage.oft", olMsg);

// --
mail.Subject = "test";
mail.Attachments.Add( "D:\\work\\3827319625bsp.pdf" );

mail.Recipients.Add( "test[ at ]test.de" );
mail.Save();

strEntryID = mail.EntryID;

//now use OOM

//or you can call mail.Display(true) without even using OOM
var OutlookMail = session.GetItemFromID( strEntryID );
OutlookMail.Display( true );
}
// --
session.Logoff();



Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

<tsahling[ at ]hausmannwynen.de> wrote in message
news:1157035592.618174.134160[ at ]h48g2000cwc.googlegroups.com...
[Quoted Text]
> Hi!
>
> If I create an item by template, Outlook ignores setted recipients by
> Redemption.SafeMailItem. The message always appears without recipient.
> If I create the message by CreateItem(), the recipient appears:
>
> --- test.js ---
> var outlook = new ActiveXObject( "Outlook.Application" );
> var session = outlook.GetNamespace( "MAPI" );
> var strEntryID;
> // --
> session.Logon( "", "", false, false );
> // --
> {
> var mail = outlook.CreateItemFromTemplate( "D:\\work\\vorlage.oft" );
> // --
> mail.Subject = "test";
> mail.Attachments.Add( "D:\\work\\3827319625bsp.pdf" );
> mail.Save();
> // --
> {
> var smail = new ActiveXObject( "Redemption.SafeMailItem" );
> // --
> smail.Item = mail;
> smail.Recipients.Add( "test[ at ]test.de" );
> // --
> mail.Save();
> // --
> smail = null;
> }
> // --
> strEntryID = mail.EntryID;
> // --
> mail = null;
> }
> // --
> {
> var mail = session.GetItemFromID( strEntryID );
> // --
> mail.Display( true );
> }
> // --
> session.Logoff();
> --- test.js ---
>
> (Redemption 4.12, Outlook 2000, Win 2000 Prof. SP4)
>
> Does anyone has an idea what the problem could be here?
>
> Thanks!
>


Re: Redemption: Recipients aren't added after CreateItemFromTemplate()
tsahling[ at ]hausmannwynen.de 9/1/2006 7:35:47 AM
[Quoted Text]
> I replied yesterday to your question sent to my e-mail address (as as well
> to your previous question). Have you received my reply?

Yes, I received it. But since I got problems with RDOSession and I
needed a quick solution I tried the newsgroup for alternatives.

Re: Redemption: Recipients aren't added after CreateItemFromTemplate()
"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> 9/1/2006 9:40:01 PM
So did that script work Ok for you?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

<tsahling[ at ]hausmannwynen.de> wrote in message
news:1157096146.974224.49450[ at ]b28g2000cwb.googlegroups.com...
[Quoted Text]
>> I replied yesterday to your question sent to my e-mail address (as as
>> well
>> to your previous question). Have you received my reply?
>
> Yes, I received it. But since I got problems with RDOSession and I
> needed a quick solution I tried the newsgroup for alternatives.
>


Re: Redemption: Recipients aren't added after CreateItemFromTemplate()
tsahling[ at ]hausmannwynen.de 9/4/2006 12:38:16 PM
[Quoted Text]
> So did that script work Ok for you?

I could not use MAPIOBJECT of Outlook.Session, since we support Outlook
2000, but had to Logon. But with the COINIT_APARTMENTTHREADED parameter
for CoInitializeEx it works.

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net