J
Julian Neaum
Greetings
I've just started using vbscript to customise an
application and from a contact item in a set of exchange
public folders I need to call a special email form in the
same set of public folders. I have worked out how to do
this - but I need to record a journal in the same set of
public folders which links the email to the contact
specified in the original contact item. I can get the
journal to work and save in the correct place and I can
get access to the contact in the original item , but I
cannot figure out how to assign the contact to the
journal. I've tried all sorts frolm the various hjelp and
books I have, but the field never seems to set.
Please, what am I doing wrong? THanks in eager
anticipation - current code follows - I know it's not the
best, but I'm just starting out!
' Find the contact ready to assign to the journal
activity to be created for the email item
' Assumes that the current folder and selected
contact is the correct one!!!
' I'll probably be able to be tighter on this later
Set MyCurrentSelection =
Application.ActiveExplorer.Selection
MsgBox "MyCurrentSelectionCount = " &
MyCurrentSelection.Count
Set MyCurrentContact = MyCurrentSelection.Item(1)
'MyCurrentContact.Display
MsgBox "MyCurrentContact = " &
MyCurrentContact.Email1Address
'Set MyCurrentContact = MyCurrentSelection.Item(1)
MsgBox "MyCurrentContact =" &
MyCurrentContact.Email1Address
MsgBox "Item Sent MyCurrentContact = " &
MyCurrentContact.Email1Address
MsgBox "Item Sent MyCurrentContact = " &
MyCurrentContact.FullName
' Set the correct folder for the journal itme ot be
posted.
Set MyNameSpace = Application.GetNameSpace("MAPI")
Set MyRootFolder = MyNameSpace.Folders
("ReceptionDevelopmentFolders")
MsgBox "MyRootFolder = " & MyRootFolder
Set MyJournalFolder = MyRootFolder.Folders
("ReceptionJournal")
MsgBox "MyJOurnalFolder = " & MyJournalFolder
MsgBox "To Address = " & subject & subject
Set MyItem = MyJournalFolder.Items.Add
("IPM.Activity")
MyItem.Subject = subject
MyItem.Type = "E-mail Message"
MsgBox "MyCurrentContact.FullName = " &
MyCurrentContact.FullName
'MyItem.Contacts = MyCurrentContact.FullName
MyItem.ContactNames = "Rubbish;"
MsgBox "MyItem.ContactNames = " &
MyItem.ContactNames
Set MyRecipient = MyItem.Recipients
' MyRecipient.Type = 1
' MsgBox "MyRecipient,Type = " & MyRecipient.Type
' Test value to see if that works!
MyRecipient.Add("Rubbish")
MyItem.Display
I've just started using vbscript to customise an
application and from a contact item in a set of exchange
public folders I need to call a special email form in the
same set of public folders. I have worked out how to do
this - but I need to record a journal in the same set of
public folders which links the email to the contact
specified in the original contact item. I can get the
journal to work and save in the correct place and I can
get access to the contact in the original item , but I
cannot figure out how to assign the contact to the
journal. I've tried all sorts frolm the various hjelp and
books I have, but the field never seems to set.
Please, what am I doing wrong? THanks in eager
anticipation - current code follows - I know it's not the
best, but I'm just starting out!
' Find the contact ready to assign to the journal
activity to be created for the email item
' Assumes that the current folder and selected
contact is the correct one!!!
' I'll probably be able to be tighter on this later
Set MyCurrentSelection =
Application.ActiveExplorer.Selection
MsgBox "MyCurrentSelectionCount = " &
MyCurrentSelection.Count
Set MyCurrentContact = MyCurrentSelection.Item(1)
'MyCurrentContact.Display
MsgBox "MyCurrentContact = " &
MyCurrentContact.Email1Address
'Set MyCurrentContact = MyCurrentSelection.Item(1)
MsgBox "MyCurrentContact =" &
MyCurrentContact.Email1Address
MsgBox "Item Sent MyCurrentContact = " &
MyCurrentContact.Email1Address
MsgBox "Item Sent MyCurrentContact = " &
MyCurrentContact.FullName
' Set the correct folder for the journal itme ot be
posted.
Set MyNameSpace = Application.GetNameSpace("MAPI")
Set MyRootFolder = MyNameSpace.Folders
("ReceptionDevelopmentFolders")
MsgBox "MyRootFolder = " & MyRootFolder
Set MyJournalFolder = MyRootFolder.Folders
("ReceptionJournal")
MsgBox "MyJOurnalFolder = " & MyJournalFolder
MsgBox "To Address = " & subject & subject
Set MyItem = MyJournalFolder.Items.Add
("IPM.Activity")
MyItem.Subject = subject
MyItem.Type = "E-mail Message"
MsgBox "MyCurrentContact.FullName = " &
MyCurrentContact.FullName
'MyItem.Contacts = MyCurrentContact.FullName
MyItem.ContactNames = "Rubbish;"
MsgBox "MyItem.ContactNames = " &
MyItem.ContactNames
Set MyRecipient = MyItem.Recipients
' MyRecipient.Type = 1
' MsgBox "MyRecipient,Type = " & MyRecipient.Type
' Test value to see if that works!
MyRecipient.Add("Rubbish")
MyItem.Display