BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 12-14-2007, 05:12 AM   #1 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default How to get an email attachment?

Please Login to Remove!

I've been trying for days to get an email attachment.

My main problem is that the second part of my multipart, the attachment, is always of the type UnsupportedAttachment.

I retrieve the mail using a folderlistener.
on the message i use the following code:

Code:
Object c = message.getContent();
if (c instanceof Multipart) {
	Multipart m = (Multipart)c;				
	if (m.getCount()>0){
		BodyPart bp = m.getBodyPart(1);
		System.out.println("bp class: "+bp.getClass());
		if (bp instanceof UnsupportedAttachmentPart){
		 UnsupportedAttachmentPart s = (UnsupportedAttachmentPart) m.getBodyPart(1);
		 System.out.println("name: "+s.getName()+" size: "+s.getSize());
		}
	}				
}
as output i get:
Code:
bp class: class net.rim.blackberry.api.mail.UnsupportedAttachmentPart
name: ess.png size: 0
taking a look at UnsupportedAttachment that is not surprising as getSize() always returns 0.

Question is: How do i get an attachment then? Any way for my second bodypart not being of the UnsupportedAttachment-type?
I tested this on the real device, not only the simulator. Even attachments i can view are considered Unsupported in my code.
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 12-14-2007, 10:00 AM   #2 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

seems solved.

i had to add an attachmenthandler for the kind of attachment as well as prefixing the file with x-rimdevice. wow, good end of the week!
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 12-14-2007, 11:33 AM   #3 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

not so good.

SupportedAttachment.getContent().getClass() returns [B
byte[] b = SupportedAttachment.getContent();
b.length is 0...

SupportedAttachment.writeTo() does not work either
__________________
java developer, Devinto, hamburg/germany
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

SMPTE Output Studio 16 Extras The Complete SMPTE Generator For Your Amiga
$14.99
SMPTE Output Studio 16 Extras The Complete SMPTE Generator For Your Amiga pictureGenuine Noches Latinas UR3 Amiga Parala La Palma Vagina Mastrubator + Cream Gift
$28.74
Genuine Noches Latinas UR3 Amiga Parala La Palma Vagina Mastrubator + Cream Gift pictureGenuine Noches Latinas UR3 Amiga Para La Palma Culo Mastrubator + Cream Gift
$28.74
Genuine Noches Latinas UR3 Amiga Para La Palma Culo Mastrubator + Cream Gift pictureSaronix 33Mhz Crystal Oscillator 33.3000 Mhz Half Can NEW Amiga Apple PC NOS
$2.75
Saronix 33Mhz Crystal Oscillator 33.3000 Mhz Half Can NEW Amiga Apple PC NOS pictureLIA3420, This IC is found on Commodore Amiga board at U800, used
$11.45
LIA3420, This IC is found on Commodore Amiga board at U800, used  picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.