none
Outlook / security / Lotus Notes COM error ? RRS feed

  • Question

  • I'm working on an Outlook add-in which makes it possible to archive Outlook mails in Lotus Notes based CRM system.

    I'm using C# and Lotus Notes COM API - When I call a function NotesDatabase.ftsearch an exception is raised if called from Outlook. The problem appears to me related to Outlook and not Lotus Notes, because when this function is called from Word or a standalone application everything works.

    It sounds like a security issue  - any ideas ?

    Wednesday, August 29, 2012 9:07 AM

Answers

  • You really need to talk to IBM about this one...

    I remember working with Lotus Notes about 10 years ago and experiencing similar problems with paths (hence my suggestion). Can't believe all these problems are still there...


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Friday, August 31, 2012 8:56 PM

All replies

  • maybe some details about that exception? hresult or message maybe?
    Wednesday, August 29, 2012 9:11 AM
  • Run-time error: '-2147217499 (80040fa5)':  Notes error: File does not exist

    This test function works in Word, but not in Outlook

    Sub IsFTIndexed()
        Dim session As NotesSession
        Set session = New NotesSession
        session.Initialize
       
        Dim database As NotesDatabase
        Set database = session.GetDatabase("MyNotesServer", "DatabaseFilePath")
       
        If (database.IsOpen) Then
            MsgBox database.IsFTIndexed, , "IsFTIndexed"
            
            Dim col As NotesDocumentCollection
            Set col = database.FTSearch("[CompanyName]=MyCompany", 2)
       
            MsgBox col.Count, , "count"
       
        End If
    End Sub

    Wednesday, August 29, 2012 9:27 AM
  • I know next to nothing about Lotus Notes COM API, but it sure sounds that you are passing a relative path and Lotus cannot find the requested file.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Wednesday, August 29, 2012 4:21 PM
  • I don't believe this is a Lotus Notes COM API error, because I can run the exact same code in Word or

    Path in Lotus Notes are always relative to Lotus Notes data directory, but I don't believe this is the problem here, because I use the same server and path in my test code. In the linie where I get the error message I am already connected the the database.

    It is the exact same I run it from Outlook or Word, but the result is not the same it fails in Outlook and not in Word.

    If the write a similar test function in C# and run it as an add-in in Word, Outlook or as a standalone application - it still fails in Outlook, but it works in Word and standalone.

    I have an idea that Outlook contains an additional security layer or is running in some kind of sandbox that causes some Lotus Notes COM API functions to fail.

    So my question is how differs Outlooks runtime from eg Word ?

    What can I do to get the same runtime?

    Thursday, August 30, 2012 6:02 AM
  • There is no sand box or extra security level of any kind.

    The error comes from the Lutus Notes object, not Outlook, the only thing different is the environment. I can only think of the current directory (most likely) and the way the COM system is initialized (apartment vs free threaded).

    What happens if you specify the absolute path?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Thursday, August 30, 2012 6:09 AM
  • When accessing a Lotus Notes database on a server you never use absolute path, so this is not an option. I can read data from the database when running from both Word and Outlook - it is simply the method FTSearch that fails when running from Outlook. When running my tests from both Word and Outlook the code is the same and my procedure is the same.

    1) Open Visual Basic Editor

    2) Tools -> Add reference for Lotus Domino objects

    3) Copy/paste my test function

    4) Run Test

    Where do I change how the COM system is initialized (apartment vs free threaded) ?? If there is no extra security this could what differs..

    Thursday, August 30, 2012 8:14 AM
  • I have just tested it from Excel and it is also working here..

    I moved the code to vbs file and ran it using c:\Windows\SysWOW64\wscript.exe - that works as well.

    I'm running Windows 7 Professional (64bit), Office 2010 (32bit) and Lotus Notes 8.5.3 (32 bit)

    The only place where it doesn't work is when ran it from Outlook - is it a threading issue, 32/64bit issue and any ideas ?

    Thursday, August 30, 2012 9:16 AM
  • in both outlook and word (so where it works and doesn't work) just before calling lotus funciton which fails, please print CurrentDirecory value
    Friday, August 31, 2012 4:19 AM
  • Try a bit different code:

    Dim col As NotesDocumentCollection

    col = database.AllDocuments

    col = database.FTSearch("[CompanyName]=MyCompany", 2)

    Michael

    Friday, August 31, 2012 6:01 AM
  • oops, correction:

    Call FTSearch on returned collection object instead of database.

    col.FTSearch("[CompanyName]=MyCompany", 2)

    Michael

    Friday, August 31, 2012 6:17 AM
  • My test code:

            Dim col As NotesDocumentCollection
            Set col = database.AllDocuments
            Call col.FTSearch("[CompanyName]=MyCompany", 2)

    Same result it's the function FTSearch it fails on database.FTSearch, view.FTSearch and col.FTSearch when called from Outlook.

    As the rest of my tests it works in Word and Excel

    Friday, August 31, 2012 7:27 AM
  • Code fails when called from Outlook

    Code works in Word, Excel, standalone application or called using wscript.exe

    If you by CurrentDirectory mean CurDir in VB the value is same in both Word and Outlook.

    The value is the same as "%userprofile%\documents".

    Friday, August 31, 2012 7:46 AM
  • open up process monitor http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

    filter by outlook and lotus notes processes and repeat error from outlook. check if there are some errors from that time looking for file on disk.

    have you looked at http://www.ibm.com/support/docview.wss?uid=swg21304092 ?

    Friday, August 31, 2012 12:38 PM
  • I have tried to use process monitor and I can see that there is a difference.

    I have shared the my test results here:

    https://docs.google.com/spreadsheet/ccc?key=0Anvav2KIzhGedG1BX1hwRlA0ZDNjX1V6Y1RvNnBjN3c

    It appears that Word & Outlook is working/searching in different directories.

    Word finds this "C:\Program Files (x86)\IBM\Lotus\Notes\gtr40nts.dll", but Outlook doesn't.

    Any idea about why there is a difference?  and perhaps a solution?

    Friday, August 31, 2012 7:43 PM
  • You really need to talk to IBM about this one...

    I remember working with Lotus Notes about 10 years ago and experiencing similar problems with paths (hence my suggestion). Can't believe all these problems are still there...


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Friday, August 31, 2012 8:56 PM
  • it is good to know that there is some stability in this world and not just new stuff every year like some other companies ;-)
    Saturday, September 1, 2012 5:03 AM
  • I know that you may get some PATH issues if you're working with Lotus Notes c-api, because your application must be able to find the dll's and the solution is simply to add Lotus Notes program path to the pc environment PATH. Just to be sure I have added Notes to evironment PATH - this is not the case here.

    I'm have big difficulties seeing how this can be an Notes issue when it works except in Outlook - I view this as an Outlook problem not a Notes problem.

    Outlook is doing something different than eg. Word... It's working in different folder - searching for files differently.

    Monday, September 3, 2012 10:10 AM
  • No, if you call your program/api/whatever and it does not work from inside outlook process, then it is not outlook's fault. Anyway, either try to determine (for example by printing Env variables) what is different in outlook or try to work around it, there are plethora of options, for example spawning different process and do interprocess communication, either using pipes, remoting, etc.
    Monday, September 3, 2012 11:06 AM
  • We can argue all we want about whether it is Outlook or Notes fault, but practically IBM is the only one who can fix the problem. MS would have no clue what to fix since they do not know what goes wrong in the Lotus Notes code even if you convince MS that it is their fault.

    And once IBM figures out what is wrong, they can fix it without any changes in Outlook.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Monday, September 3, 2012 7:37 PM
  • Good news.. today I managed to get it something working - part of the workaround is to add the path as mentioned above, but I need to investigate what else I have changed.

    Today I found a couple of PC's with Outlook running and without Notes in the path and it worked here - that's interesting.

    I agree that IBM has some problem, but Outlook is doing something wierd that triggers this defect. I need to gather some more information, so that I can go to IBM and ask them to fix this. I can't go to IBM and expect them to do anything when their API work with any other than Outlook.

    Thanks for all your advice and comments

    Tuesday, September 4, 2012 7:35 AM