Moving data from Form Item to olMailItem

D

djohnson

Hi,

Is it okay to do this, assuming the addresses are valid, in my send
routine? Or should there be some kind of loop to extract all
recipients from the Item and add them again individually?

Set olapp = CreateObject("Outlook.Application")
Set olmail = olapp.CreateItem(olMailItem)
With olMail
olmail.To = Item.To
olmail.CC = Item.CC
olmail.Subject = Item.Subject
olmail.body = Item.Body
olmail.Send
End With

I am doing this to avoid sending the whole form/code which would create
a message on the recipients' end about not being able to view in the
reading pane.

Thanks in advance
 
H

Hollis Paul [MVP - Outlook]

Is it okay to do this, assuming the addresses are valid, in my send
routine? Or should there be some kind of loop to extract all
recipients from the Item and add them again individually?

Set olapp = CreateObject("Outlook.Application")
Set olmail = olapp.CreateItem(olMailItem)
With olMail
olmail.To = Item.To
olmail.CC = Item.CC
olmail.Subject = Item.Subject
olmail.body = Item.Body
olmail.Send
End With

I am doing this to avoid sending the whole form/code which would create
a message on the recipients' end about not being able to view in the
reading pane.

Thanks in advance
Have you not read any of the other messages to the other people asking
about how to fill in the To: and cc: fields?

The way to do this is to create recipient objects of type To and Type CC
and add those recipient objects to the recipients collection object of
the item. Go to www.outlookcode.com and find the code examples for
adding recipients to messages.

But, more importantly, you need to tell us what you are really trying to
do. That codes looks like you are sending the second item to the same
recipients as the first message. Is that what you really intend to do?
 
D

djohnson

Have you not read any of the other messages to the other people asking
about how to fill in the To: and cc: fields?

I have seen other ways of doing it, but I was asking if this way should
work or not....

The way to do this is to create recipient objects of type To and Type CC
and add those recipient objects to the recipients collection object of
the item. Go to www.outlookcode.com and find the code examples for
adding recipients to messages.

But, more importantly, you need to tell us what you are really trying to
do. That codes looks like you are sending the second item to the same
recipients as the first message. Is that what you really intend to do?

Yes as my last sentence said, when I do an Item.Send the message
creates a "can't view in the reading pane" message on the receiving
end. This way it doesn't, only security messages on the senders' end.

As I said I am asking if this (my code or rationale) makes sense or are
there flaws in it? Thank you very much for your assistance.
 
D

djohnson

Have you not read any of the other messages to the other people asking
I would also like to add that I do find it difficult to find answers to
the most basic questions. I can only find sample code for more complex
routines. I am so sorry that I am a beginner and this is my first
Outlook form.
 
H

Hollis Paul [MVP - Outlook]

<[email protected]>
<[email protected]>
<[email protected]>
Newsgroups: microsoft.public.outlook.program_forms
NNTP-Posting-Host: pool-71-112-179-59.sttlwa.dsl-w.verizon.net 71.112.179.59
Lines: 1
Path: number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!msrtrans!TK2MSFTFEEDS01.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP02.phx.gbl
Xref: number1.nntp.dca.giganews.com microsoft.public.outlook.program_forms:78182

I am so sorry that I am a beginner and this is my first
Outlook form.
You need not be sorry for this. It is the classic problem of the
"expert" not being able to verbalize what has been reduced to habit. I
am gotten a good dose of it as I watched a senior support person flail
about until he found a solution for why my SBS server was not able to
send and receive email. I have a vague idea of what he did, but I
certainly could not reproduce it.
asking about how to fill in the To: and cc: fields?
I have seen other ways of doing it, but I was asking if this way >
should work or not....

You do not work with those fields in code. You enter stuff in those
fields before you go into design mode. Once you have gone into design
mode, then you do email addressing using the recipients collection
object and the recipient objects, all according to the rules specified
in the Outlook Object Model of the version you are working with.
 
H

Hollis Paul [MVP - Outlook]

<[email protected]>
<[email protected]>
Newsgroups: microsoft.public.outlook.program_forms
NNTP-Posting-Host: pool-71-112-179-59.sttlwa.dsl-w.verizon.net 71.112.179.59
Lines: 1
Path: number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!msrtrans!TK2MSFTFEEDS01.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP02.phx.gbl
Xref: number1.nntp.dca.giganews.com microsoft.public.outlook.program_forms:78179

Yes as my last sentence said, when I do an Item.Send the message
creates a "can't view in the reading pane" message on the receiving
end. This way it doesn't, only security messages on the senders' end.
The "can't view in the reading pane" is created because the message has
code behind it, but the form is not published where the viewer's
computer can access it. Is the receiver on the same Exchange server
system as the sender? If yes, then the form should be published to the
Organizational Forms Library so that the receiver can pull up the form.

When I design a form, I publish the form with a new name, like
SharePointTips_verXXX, in very small steps. I might wind up with 30
different named forms in the OrgFormsLib before I am done and I don't
delete any until I am done. I can do this because I am also the
Exchange Administrator of my domain (and the domain administrator, and
the dba, and the bottlewasher.) But, in the real world in which those
slots are filled by other people who get upset if they see an extra form
in the OrgFormsLib, then you have to be tricky. I keep several pst
files just to be able to move old form designs into the personal forms
library of those pst files.

In any case, you need to get the current test form to the recipient so
that the form can be installed and viewed in the preview pane.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top