Forum Replies Created
-
AuthorReplies
-
I have had a look at the installation guide and have not been able to find any way to specify the applet to run when the user clicks on Formativ Portals in GW. It seems the settings in the config file only specify default folders and not a specific applet.
Can you please tell me how I can specify a particular applet to be used by each user without having to visit each PC.
Thanks,
Stuart
Have just been doing some more testing on this applet and have given it to a few users. They have noticed a problem with it. If they select an external address from their address book it will not run the spell check. I have done some tests and notice that the Groupwise.ItemGetText(“X00”, itfTo) only returns the Address book entry name and not the actual email address. This then causes problems because I am unable to use the test for the ‘@’ symbol to see if it external.
Is there anyway to get the actual email address that it is being sent to rather than the address book entry name?
Hope this makes sense
Stuart
I have just tested the applet out on my PC and it seems to work. Will need to do a bit more testing to make sure of no problems.
I was also thinking, is it possible to set the ‘Check spelling before send’ option from within an applet. If so then I would like to set up the applet so that if it recognises the email as an external mail then it will set this check box before it sends the mail. If it see’s that it is an internal mail it can switch this off before it sends it.
Thanks,
Stuart
Thanks for that. I still have a problem though. I have created the following applet:
Dim Recipient
Sub Main(Client, GWEvent)
Recipient = Groupwise.ItemGetText(“X00”, itfTo)
If (Instr(1, Recipient, “@”, 1) > 0) Then
If (Instr(1, Recipient, “shlegal.com”, 1) = 0) then
dim iReturnVal
call groupwise.throwtoken(“Speller(0)”, iReturnVal)
End If
End If
End SubThis seems to work with checking that the email is for external people, however it brings up the spelcheck and then immediatley sends the email without actually performing the check. Is there anyway to force it to perform the spell check before it sends the mail?
Thanks,
Stuart
Excellent. That seems to work.
I have another question now though. If I were to create a shared folder in each of these peoples mailboxes, is there a way that I am able to move these emails into that folder? Also, is it possible to get a list of users from a GW distribution list? We were thinking that if we could create a distribution list with the users that we need to search then we could read who the members are and then search these mailboxes.
Thanks heaps for the help so far.
Stuart
A little more progress
I have rewritten the SendMail function and am now able to get it to send emails from the specific user. The problem I am now having is actually attaching the emails to this new mail. The new SendMail function is below. The problem lies within the for statement. I am unsure what the command/syntax is to attach the mails to this new email. I have tried both methods which are commented out without success.
Thanks,
Stuart
function SendMail
dim MyArray
dim objMail
dim objNewMail
dim objRecipient
dim objAttachments‘ Create a draft mail message with no user interface
Set objMail = iAccount.MailBox.Messages.Add(“GW.MESSAGE.MAIL”, fgwDraft)
Set objRecipient = objMail.Recipients.Add(MANAGER,,0)
With objMail
.Priority = fgwNormal
.Subject = “Unopened Messages within 2 hour period”
.BodyText.PlainText = HRT&HRT&HRT&”Forwarded Messages from : “&(iAccount.Owner)&HRT&HRT&”The attached messages have not been opened within the 2 hour period”
End With
for x = 0 to (StringList.Count -1)
MyArray = Split(StringList.Strings(x), ” !! “, -1, 1)
‘call objMail.Attachment.Add(MyArray(3)) ‘
‘call objMail.AttachmentAddEncapsulatedItem(MyArray(3))
next
Set objNewMail = objMail.Send
Set objRecipient = Nothing
Set objMail = Nothingend function
I am still having a few problems with getting the applet to use the trusted application to send the emails using the account I have connected to. The code I am using is below. I am able to search through the various mailboxes and find the relevant emails. When I then create a new mail message and attach these emails, it works on my account but not on the others. I believe it works for me because I am running the applet from within my GW account. I need to know how to send an email from an account I am connected to and then attach messages to these.
const CMDLINE_PARAMS = “”
‘This is the domain we want to look for
const DOMAIN = “hotmail.com”
‘This is who we want to forward the emails to
const MANAGER = “manager@test.com”dim Msg
dim StringList
dim UserList
dim MailFound
dim iAccount
dim ItemtypeCount
dim iCount
dim HRT”””””””””””””””””””””””””””””””””””””””’
‘ Connects to the accounts specified in UserList and searches for emails
”””””””””””””””””””””””””””””””””””””””’
Sub Main(Client, GWEvent)HRT = Chr(13) & Chr(10)
Set UserList = Utilities.StringList
UserList.Add(“account1”)
UserList.Add(“crosss”)
UserList.Add(“account2”)
UserList.Add(“account3”)
MailFound = 0
‘ Apply the trusted application credentials
call GroupWise.Session.SetTrustedApplicationCredentials(“TrustedApp”, “1234”)
itemtypeCount = 0
Do While ItemtypeCount <> UserList.Count
Set StringList = Utilities.StringList
iSearch = UserList.Strings(ItemtypeCount)
‘ Use the Multilogin method to access the account
on error resume next
set iAccount = GroupWise.Session.Multilogin(iSearch, CMDLINE_PARAMS, null, egwPromptNever, null)
‘ Check if we were able to log into this users account
if iAccount is nothing then
MsgBox “Login Failed – Check the Trusted Application credentials and the command line paramters: ” & iSearch, 0, IDS_CAPTION
else
iFilter = (“(MAIL) AND (NOT OPENED)”)
set iMessages = iAccount.AllMessages.find(iFilter)
iCount = iMessages.Count
if iCount > 0 then
‘ set each message object
for x = 1 to iCount
set Msg = iMessages.Item(x)
Checkmail
next
end if
‘ Remember to clean up this message collection
set iMessages = nothing
end if
‘ Release the account object we obtainedItemTypeCount = ItemTypeCount + 1
if MailFound > 0 then
SendMail
end if
MailFound = 0
set iAccount = nothing
Loop
‘ SetTrustedApplicationCredentials with empty strings to remove the credentials
‘ from the current session. If we don’t do this, we will be able to multi-login
‘ to any account for the remainder of this GroupWise session. This may or may not
‘ be the desired effect…
call GroupWise.Session.SetTrustedApplicationCredentials(“”,””)end Sub
”””””””””””””””””””””””””””””””””””””””’
‘ Check the Domain email is from and compare the time it was delivered with the current time
”””””””””””””””””””””””””””””””””””””””’
function CheckMail
dim sDate
dim sTime
dim sCurDate
dim sCurTimeif (Instr(1, LCase(Msg.Sender.EmailAddress), LCase(DOMAIN))) <> 0 then
sDate=Utilities.DatetoISO(Msg.DeliveredDate)
If (Instr(1, sDate, “T”,1) <> 0) then
sArray = Split(sDate, “T”, -1, 1)
sDate = sArray(0)
sTime = sArray(1)
End If
sCurDate=Utilities.DatetoISO(Date+Time)
If (Instr(1, sCurDate, “T”,1) <> 0) then
sArray = Split(sCurDate, “T”, -1, 1)
sCurDate = sArray(0)
sCurTime = sArray(1)
End If
if sCurdate > sDate then
StringList.Add(Msg.Sender.DisplayName&” !! “&Msg.Subject&” !! “&Msg.CreationDate&” !! “&Msg.MessageID)
else
if sCurDate = sDate then
‘if sCurTime-sTime > 20000 then
if sCurTime-sTime > 1 then
StringList.Add(Msg.Sender.DisplayName&” !! “&Msg.Subject&” !! “&Msg.CreationDate&” !! “&Msg.MessageID)
End if
End if
End if
CheckMail = TRUE
MailFound = MailFound + 1
exit function
end ifend function
‘——————————————————————————-
‘ Forward Emails to Manager
‘——————————————————————————-
function SendMaildim MyArray
Groupwise.NewMail
Set NewMsg = GroupWise.ComposingItem
NewMsg.To_ = MANAGER
NewMsg.Subject = “Unopened Messages within 2 hour period”
NewMsg.BodyText = HRT&HRT&HRT&”Forwarded Messages from : “&(iAccount.Owner)&HRT&HRT&”The attached messages have not been opened within the 2 hour period”
for x = 0 to (StringList.Count -1)
MyArray = Split(StringList.Strings(x), ” !! “, -1, 1)
call GroupWise.ItemAttachmentAdd(“X00″,115,MyArray(3),”Test”)
set NewMsg = nothing
set Msg = nothing
next
GroupWise.ItemSend(0)
end functionI have made some progress today with this applet. I have added some other accounts for it to search and have also improved the searching mechanism. The ultimate aim, though, is to find the relvant emails (which I can now do) and then once these have been found to forward them on to a manager. Is it possible to use this trusted application to then attach these emails to and email and send it to the manager?
If you need I can provide the applet that I am using.
Thanks,
Stuart
I have received the tesst application that you sent and have given it a go. This all works properly so I know the Trusted App’s are working. Thanks for that.
I then thought I would try removing the trusted app and start again. I tried running the applet to remove the trusted app and this failed. This got me thinking. The credentials that I am providing as App name and Key must be wrong. I have since found out that a colleague had run the Trusted App creation on his PC before I did it on mine. As a result I beleive the credentials I was using were incorrect. I have since manually removed the app through C1 and have recreated and then used the app above and it all works.
Thanks for the assistance.
Stuart
I have downloaded and installed this file. Unfortunately I am coming up with the same result.
Is there any way to test that the SetTrustedApplicationCredentials is working properly? I was wondering if there was anyway to make sure that the trusted application is working properly.
Regards,
Stuart
I have tried running the applet again and have had the same results. The message I get is “Login Failed – Check the Trusted Application credentials and the command line paramters:crosss”. This is the error that is displayed when iAccount is set to nothing as a result it seems that the multilogin is not working with the Trusted Application.
The config of the machine I am using:
[This message was edited by Support 1 on April 14, 2004 at 04:20 PM.]
How would I go about creating the applet to check through the mailbox for items from a particular domain (eg hotmail) that have been unopened within 2 hours. I am trying to create a filter at the moment just to display the relevant messages. I have managed to narrow it down to unopened items from hotmail.com using a filter (“(MAIL) AND (NOT OPENED)”) but I need it to only include those that have not been opened within 2 hours of reciept.
Thanks for the info. Unfortunately we will be rolling this applet across the organisation and as such it is not feasible to manually change the fodlers it selects. I would be very interested in hearing what you find out about the API.
Thanks,
Stuart
Thanks again.
I see what you mean that it searches the Mailbox, however on my system this causes it to search the entire mailbox. I would like to be able to just search the Mailbox folder and not my Cabinet or any other folders. Does this make sense?
Thanks,
Stuart
This is great. Is there anywhere that I can get documentation on all these expressions etc. I would like the folder to only search the Mailbox. Is there any way of doing this? Also is it possible to force the display to be sortd on date in descending order?
Thanks,
Stuart
-
AuthorReplies