Alberto
Alberto

Reputation: 21

Export Lotus Notes attachments from .net applications using odbc and NotesSQL

I tried to export attachments using interop.domino.dll but it seems this dll does not support 64-bit operating systems: https://www-304.ibm.com/support/docview.wss?uid=swg21454291 This is the code:

    public void GetAttachments()
    {
        NotesSession session = new NotesSession();
        session.InitializeUsingNotesUserName("user", "password");

        NotesDbDirectory DbDirectory = session.GetDbDirectory("server");
        NotesDatabase NotesDB = DbDirectory.OpenMailDatabase();
        NotesDocumentCollection documents = NotesDB.UnprocessedDocuments;
        NotesDocument currentDocument = documents.GetFirstDocument();

        do
        {
            if (currentDocument.HasEmbedded  && currentDocument.IsValid && !currentDocument.IsDeleted)
            {
                List<NotesEmbeddedObject> items = currentDocument.EmbeddedObjects;

                items.ForEach(item => item.ExtractFile("C:\\attachments\\"));
            }

            currentDocument = documents.GetNextDocument(currentDocument);
        } while (currentDocument != null);
    }

So now I am trying to do this task through NotesSQL. is this possible?

Upvotes: 0

Views: 804

Answers (2)

Richard Schwartz
Richard Schwartz

Reputation: 14628

No, I don't believe you can get at attachments via NotesSQL.

The Domino COM classes, however, can be used on 64 bit operating systems, but they must be called from 32 bit code so you will have to set your options correctly in your Visual Studio project to build a 32 bit application.

You are correct that the classes are officially unsupported on 64 bits. That's something that I had been complaining about to IBM for quite a few years, however I can tell you that people do use them and they mostly do work. There are just a few known problems - specifically the methods that return lists of design elements (e.g. forms, views, etc.) are known to have problems. Also, depending on what has been installed on the machine and in what order, you may find that you have to manually register nlsxbe.dll before you can use the classes. Of course, if you find any other problems, you're on your own. IBM won't help you. Well, the community - here on StackOverflow, on IBM's DeveloperWorks forums for Notes and Domino, on OpenNTF, and various other places will do their best to help, of course. But the lack of official support is something you do need to think about.

An alternative that you can consider is the Domino Data Service, which is a REST API for Domino, but you're Domino server will need to be a fairly recent version in order to use that. See here.

Upvotes: 1

Murugavel Elumalai
Murugavel Elumalai

Reputation: 66

Why not just create a Lotusscript agent to export all attachments to a Folder in the drive and just copy/move that folder to a different machine you want? Interested in knowing the reason for not doing this.

Or

You could create a simple view with attachmet url's in a column and use "view?readviewentries" to load the list of attachment url in your .NET application and download the attachments.

you can use Count and Start arguments in the url to read next list of attachments.

for this to work, http task needs to be running and database ACL for Anonymous needs to be minimum reader access.

Upvotes: 0

Related Questions