Adding a CC address to a mail

N

Nat

Excuse me for my ignorance, however I am no programmer. Someone contacted me
becuase we have a custom form created, and when they click a link on that
form, it generates an email to one of our users. They would like to include
additional addresses in teh CC field. I viewed the code behind the form and
this is what I found
Sub CommandButton1_Click


set MyItem = Application.CreateItem(0)
myitem.to = " Joe Schmoe"
myitem.subject = "Bulletin Board Meeting Notice"
myitem.Body = "This is a request for the following meeting to be displayed
on the electronic bulletin board: " & chr(10) & chr(10) & " " &
userproperties.find("MeetingTitle").value & chr(10)& chr(10)& "The meeting
will be held on: " & userproperties.find("calcdate").value & " from " &
userproperties.find("calcstarttime").value & " to " &
userproperties.find("calcendtime").value & chr(10) & Chr(10) & "The meeting
location is: Conference Room " & userproperties.find("ConfRoom").value & "."
& chr(10) & chr(10) & "Please contact " &
userproperties.find("ContactPerson").value & ", " &
userproperties.find("Division").value & ", at " &
userproperties.find("ContactPhone").value & " for more information."
Myitem.display

item.userproperties("BulletinMessageSent").value = "True"
item.save
End Sub

My guess is that the myitem.to="Joe Schmoe" is where I want to start,
however I am not positive how to add another user but as a CC, or if I just
have to add addl users on the same line.

Any help would be greatly appreciated.
 
N

Nat

Thanks a lot Sue,

I have added teh code, adn then I published the form ,and wehn I closed it
asked If I wanted to save. I said Yes, but now when I open the form and click
on either of the custom buttons they do not work. did I miss a step, or do I
just need to wait a bit for Exchange server to see the updated form? Thanks
again.
 
S

Sue Mosher [MVP]

Did you publish the form to the Organizational Forms library with the "send
form definition with item" box on the (Properties) page unchecked? Those are
requirement.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
N

Nat

Thanks for the follow up Sue. I am not sure what settings you are speaking
of. We have OL007 and Exchange 07 as well. What I did was chose developer
tab>Chose Design this form>View Code. I edited the code and closed the
script editor window. then I chose Publish this form. Not sure if I should
just publish form or publish form as and browse to folder in public folders.

The form is supposed to fill in some of the fields from the address book but
it only seems to work for me. It should show the user's name, division and
phone number wehn they open the form but it only shows the user name
correctly. When I login it shows my info corect. Here is the code behind
the form :

'**********************************************************************
'* PROCEDURE: SetDefaultFields
'* DESCRIPTION: Populate employee fields on the form with information
'* retrieved about the user from the address book.
'***********************************************************************
Sub SetDefaultFields()
On Error Resume Next

Set user = olemsession.CurrentUser

'PR_DISPLAY_NAME
item.userproperties.find("ContactPerson") = user.Name

'PR_DIVISION / DEPARTMENT_NAME
item.userproperties.find("Division") = user.Fields.item(&h3a18001e)

'PR_BUSINESS_TELEPHONE_NUMBER
item.userproperties.find("ContactPhone") = user.Fields.item(&h3a08001e)

end sub



Sorry but I am not sure how I screwed this up, and why it seems to only work
on my OL profile.
I even tried clearing all my information in the but would always get the
message that one or more nec fields was blank, so I am out of ideas.
 
S

Sue Mosher [MVP]

As I indicated in my earlier response, a message form must be published to
the Organizational Forms library on the Exchange server (or to each user's
Personal Forms library). If it is published only to a public folder, only
items actually stored in that folder will have full functionality. You must
also make sure that the "send form definition with item" box on the form
design's (Properties) page is *not* checked. But if you're getting some code
to run, that's a sign that it's correctly unchecked.

I don't see what the code you posted has to do with the original question
about adding a Cc address. Also, the code doesn't show where the olemsession
object variable comes from. I presume there is some other procedure that
returns it using CDO 1.21? Has CDO been installed on other users' machines?

Commenting out the On Error Resume Next statement might help you
troubleshoot by allowing you to get more information on what errors might be
occurring.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
N

Nat

Sue you are correct on 2 accounts:
1. The "send form definition with item" was indeed checked as you surmised.
2. this second issue has nothing to do with the original CC question. That
has been resolved. Many thanks.

I will open up a new thread that deals with my current issue and hopefully
someone can point me in the right direction.

Thanks again,
Nat
 
Top