From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.NET POP3Message Attachment

I am trying to access an email attachment using .NET in LabVIEW.  I've been able to get as far as receiving the emails as type Pop3Message, but I can't figure out how to access the attachments within the messages.  There is a GetAttachedContents method that can be invoked to pull the contents (and attachments) from the email, but I can't figure out to invoke it.  I have the inContents parameter, but I can't figure out what to do with the inPredicate parameter.  (see example VI).  If anyone can offer some assistance I'd be grateful!

 

This is the code I need to implement: 

 

public static List<Pop3Content> GetAttachedContents(List<Pop3Content> inContents, Predicate<Pop3Content> inPredicate)

Pop3Message mg = ....;//get Pop3Message object with Pop3Client class

List<Pop3Content> contentList = Pop3Message.GetAttachedContents(mg.Contents, c => c.IsAttachment == true);

Int32 AttachmentCount = contentList.Count;

for (int i=0; i<contentList.Count; i++)
{

    contentList[i].DecodeData("your file path");

}

0 Kudos
Message 1 of 7
(2,771 Views)

You appear to be using a private assembly. The GetAttachedContents method is a static method. As such you would not wire in a class to the Invoke node. You can wire in an error cluster, but the "reference" input should be left disconnected. Other than that I can't really provide any more information since you are using a private assembly, and have provided no documentation.

0 Kudos
Message 2 of 7
(2,760 Views)

Hi smercurio,

 

I think I'm close - it's all part of the higuchi.mail library.  What I can't figure out is how to create the predicate object necessary to pass into the GetContents method.

0 Kudos
Message 3 of 7
(2,755 Views)

This is what I have so far.  The only thing I don't understand is what should be wired into the InPredicate input.

0 Kudos
Message 4 of 7
(2,753 Views)

Hello.

Any luck in finding a solution for your problem?

I have a similar situation and need to retrieve an attachement as well from the email.

No documentation on the dll website is provided for that case..

0 Kudos
Message 5 of 7
(2,731 Views)

Ammouri,

 

I'm not sure this will help, but here is some information on the inPredicate function microsoft calls.

 

http://msdn.microsoft.com/en-us/library/dd174479.aspx

 

Daniel

Applications Engineer
National Instruments
0 Kudos
Message 6 of 7
(2,710 Views)

Thank you Daniel for you effort but this is not what I wanted. rwyost was trying to figure out what the inPredicate does and I have no clue on how to use the .Net classes.

I was trying to see whether he was able to get the attachement from the email or not. Sorry for that man, I should have mentioned that I am a newbie when it somes to .Net.

0 Kudos
Message 7 of 7
(2,703 Views)