LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lotus Notes Database Help

Solved!
Go to solution

Hello List,

 

I have a Lotus Notes Database. In the database are documents, and in the documents are attachemnts.

 

I have already figured out how to get the DocumentID by the document name (see attached code)

 

What I'm trying to figure out what "method" to use to get a list of the filenames of the attachments in the document (by pointing to with the DocumentID?), so I can detach and saves the ones I want.

 

Thanks in advance,

Mike

 

Using Labview 8.2

0 Kudos
Message 1 of 11
(3,416 Views)

If using ActiveX, wouldn't the filenames of the attachments be a property of the document?

 

0 Kudos
Message 2 of 11
(3,407 Views)

NYC,

 

Thanks for the responce.

 

That's what I thought - but when I hang a property node off of the "GetFirstDocument" method, the only property that looks like it could be is "Items" and it is a variant type. If I probe it's output, the probe indicates "Value ->Array(Non Displayable)"

 

I attached an ActiveX "Variant to Data", and set the DataType to Array, and it returns a list of what look like headers or descriptors for the document. One type of descriptor is "$File", and I notice the number of "$File" entries in the array matches the number of attachments in the document.

 

Another property node is "ImbeddedObjects", which is also a variant. An indicator on it's output displays nothing, and I can't find a datatype to use with "Variant to Data" that doesn't return an "Type Mismatch" error.

 

I know I'm missing something simple here...just don't know what it is.

 

Latest code is attached....

 

Thanks,

Mike

 

 

0 Kudos
Message 3 of 11
(3,395 Views)

Hi Mike,

 

What do you currently see when you run this and look in the EmbeddedObjects output, and turn it into Variant Data?

Ravi A.
National Instruments | Applications Engineer
0 Kudos
Message 4 of 11
(3,358 Views)

Wee-Bey,

 

Thank you for the response.

 

I should start by explaining that I am not a database or Lotus Notes expert, so any help you could provide would be greatly appreciated.

 

I have added the "EmbeddedObjects" property.  It's output is a Variant and and I have converted it to a text string.  After running the code, that sting seams to be empty.

 

After running the code I did a "Make Current Value Default" on all of the indicators.  That code is attached so you can see what my results are.

 

My goal was to be able to just save off the document attachments that I want to my local hard drive.  If I have to save them all off and then grab only the ones I need, I can live with that.

 

Thanks again,

Mike

 

0 Kudos
Message 5 of 11
(3,350 Views)

Mike,

 

So I started playing with the ActiveX properties hooking it up to our own LotusNotes database, and I got the list of attachments for a particular email, and with a while loop, I was able to download each of them. I then looked at what you had posted, and lo and behold, we were both approaching it the same way. Like you said above, the "pName" of "$File" sent into GetItemValue returns a list of all the attachments. From there you can auto-index all these names into a loop, and using GetAttachment and ExtractFile, save all the attachments.

 

I understand that your barrier now is being able to choose which attachments you save? This would be more of a LabVIEW interfacing issue. Perhaps right before you send the attachment list into the loop, you can have controls where you select which attachments to send in.

 

Do you need some help putting together the first loop to save all attachments?

Ravi A.
National Instruments | Applications Engineer
0 Kudos
Message 6 of 11
(3,337 Views)

Wee-Bey,

 

Thank you for the reply.

 

I have attached my code after setting my indicators to "Make Current Values default" so you can see what I get when I run it.

 

I do get a variant from the "Items" method, which converts for a list of Item Types (in my example there are 35 "$File" types, representing the 35 attachments in the document).

 

The "GetItemValue" method also returns a variant which converts to a list, but that list has a length of "1" and only contains the filename of one attachment. Also, I don't know how it picks that particular attachment, because it is not the first alphabetically or earliest date.

 

So that is where I'm at.

 

Again, any help would be appreciated.

 

Mike

0 Kudos
Message 7 of 11
(3,325 Views)

Hi Mike,

 

So I now see what the issue is. If you have multiple attachments, all of their "Item Names" are "$FILE," which means with the GetAttachment function, you can only get to one single attachment. How do you get to the others? Well, I worked with the nodes and came up with a roundabout solution that might work. I've attached it. Basically, I created a temporary document, copied all the items over, then in a loop I extracted one and deleted it, so the next time it would look at the next file.

 

1) Get the original document (retrieved by search). We will call this Original Document. This can be an email or some other kind of Lotus document.

2) Make a Temporary Document. Copy all the item from Original Document to Temporary Document.

3) Make a For Loop that runs once for each attachment.

4) Each time through the For Loop, get an attachment from the Temporary Document, extract it, and then delete it.

5) Now, the Temporary Document should have no attachments. Delete it.

 

It's a bit roundabout, but if using the ActiveX calls LotusNotes has, our goal can be reached somehow.

Let me know if this is what you're looking for.

 

P.S. I had to use my own Lotus database for testing, so some of your database setups might be messed up. I tried to put yours back, but check on that. 

Ravi A.
National Instruments | Applications Engineer
0 Kudos
Message 8 of 11
(3,317 Views)
Solution
Accepted by topic author wd8ivl

Woops! You're using LabVIEW 8.2. I've attached a version compatible with that.

Ravi A.
National Instruments | Applications Engineer
Message 9 of 11
(3,309 Views)

Ravi,

 

Brilliant! An interesting way to solve the problem. Like you say, a bit of a roundabout way of doing it...but you have to solve the problem with the tools you are given.

 

Thank you!

Mike

0 Kudos
Message 10 of 11
(3,304 Views)