I've been staring at that code for hours. I got too close to it and just didn't see the simple mistake I knew it was.
Thanks José I've been pulling my hair out on that one.
And the working code is...
Code:
FUNCTION AttachPST( strPSTPath AS STRING ) AS LONG LOCAL objOutlookApp AS Int__Application LOCAL objNameSpace AS Int__NameSpace FUNCTION = %FALSE ' does the PST exist? IF ISFILE( strPSTPath ) THEN ' Instantiate Outlook SET objOutlookApp = NEWCOM $PROGID_Outlook_Application ' Do we have the Outlook object? IF ISOBJECT( objOutlookApp ) THEN ' Get the MAPI namespace objNameSpace = objOutlookApp.GetNamespace( UCODE$( "MAPI" )) ' Do we have a namespace? IF ISOBJECT( objNameSpace ) THEN ' Add the PST to the list of stores objNameSpace.AddStore strPSTPath 'Clean up objNameSpace = NOTHING FUNCTION = %TRUE END IF 'Clean up objOutlookApp = NOTHING END IF END IF END FUNCTION
Leave a comment: