-
Topic
-
I have been provided with 2 example applets for trusted applications. The first one creates the Trusted application. This one seems to work without any problems. I can see the application in my Trusted Applications list in C1. The second applet is supposed to use this trusted application and then seacrh through all mailboxes for a certain string. I have adapted this applet for testing so that it will only connect to my account and search for message with test in the subject or message body. It seems to be able to to pick up the correct Application name and Key however it is unable to use the Multilogin to access my account. If I enter the password of my account as one of the parameters then it will work. This would indicate to me that the Trusted Application part is probably not working. Is there any way I can test the MultiLogin with the Trusted Application?
The applet that I am using is below.
‘ This is the text we want to search for
const SEARCHTEXT = “test”
const CMDLINE_PARAMS = “”
const IDS_CAPTION = “DHO331 – Developing GroupWise® solutions with Advansys® Formativâ„¢”‘
‘ Read the trusted applet name and key from the registry. Use multilogon to
‘ login to each account and perform a search for the text defined in the
‘ constant SEARCHTEXT (see above).
‘
Sub Main(Client, GWEvent)dim TheName
dim TheKey
dim iAccount
dim iTest
dim iBooks
dim iSearchRes
dim iSearch‘ Read the registry to object the name and key of the trusted application
if not GetTrustedAppDetails(TheName, TheKey) then
MsgBox “Could not determine the application name and/or key. Run ‘z Trusted Applet – Install’ and try again”, 0, IDS_CAPTION
elseiSearch = “crosss”
‘ Apply the trusted application credentials
call GroupWise.Session.SetTrustedApplicationCredentials(“”+TheName+””, “”+TheKey+””)‘ 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
MsgBox(“IAccount OK”)
‘ OK – we have FULL ACCESS to the users account. Perform a find
‘ in an attempt to locate any references to the text in the constant
‘ SEARCHTEXT. We use a filter to do this.
iFilter = “(SUBJECT CONTAINS “”” & SEARCHTEXT & “””) OR (MESSAGE CONTAINS “”” & SEARCHTEXT & “””)”
set iMessages = iAccount.AllMessages.find(iFilter)
‘ Update the discover results
if iMessages.Count > 0 then
iSearchRes = iSearchRes & iSearch & “: “& vbTab & vbTab &iMessages.Count &” References to ‘” & SEARCHTEXT & “‘ were detected! <
” & vbCrLf
else
iSearchRes = iSearchRes & iSearch & “: ” & vbTab & vbTab &”No references detected.” & vbCrLf
end if
‘ Remember to clean up this message collection
set iMessages = nothing
end if
‘ Release the account object we obtained
set iAccount = nothing‘ 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(“”,””)‘ Display the results in a message box.
MsgBox iSearchRes, 0, “Research Process Complete”end if
end Sub
‘
‘ Obtain the trusted application details from the registry
‘
function GetTrustedAppDetails(ByRef AppName, ByRef AppKey)dim iRegistry
GetTrustedAppDetails = False
AppName = “”
AppKey = “”set iRegistry = Utilities.Registry
iRegistry.RootKey = fHKEY_CURRENT_USER
if iRegistry.OpenKey(“SoftwareAdvansys CorporationDH0331 Trusted Applet”, True) then
if iRegistry.ValueExists(“Name”) then
AppName = iRegistry.ReadString(“Name”)
end if
if iRegistry.ValueExists(“Key”) then
AppKey = iRegistry.ReadString(“Key”)
end if
iRegistry.CloseKey
end if
set iRegistry = nothingGetTrustedAppDetails = ((Len(AppName) > 0) and (Len(AppKey) > 0))
end function
Thanks,
Stuart
- You must be logged in to reply to this topic.