Our vBulletin migration is complete.
Welcome vBulletin users! All content and user information from the Micro Focus Forums (vBulletin) site has been migrated to this site. READ MORE.
Anonymous_User Absent Member.
Absent Member.
1517 views

Get Attachments

Does anyone have some sample vb/c#.net code to retrieve attachments for
an account? I have the SDK/google, not finding much help.

Many thanks-

--

Labels (1)
0 Likes
1 Reply
Anonymous_User Absent Member.
Absent Member.

Re: Get Attachments

I haven't done anything with this for awhile, so it might need some tweeks.
The code drops in with m_mail != null.

private void btnAddress_Click( object sender, EventArgs e )
{
int i;
if ( null != m_mail )
{
WebReference.AttachmentItemInfo info;
for ( i = 0; i < m_mail.attachments.Length; i++ )
{
info =
(WebReference.AttachmentItemInfo)m_mail.attachments.GetValue( i );
if ( null == info || info.id.itemReference )
{
continue;
}
exportData( info );
}
}
else
{
... // removed
}
}

private void exportData( WebReference.AttachmentItemInfo info )
{
int offset = 0;
WebReference.getAttachmentRequest req;
WebReference.getAttachmentResponse resp;

String path = "c:\\temp\\" + info.name;
System.IO.FileStream fs = new System.IO.FileStream( path,
System.IO.FileMode.Create );
System.IO.BinaryWriter fw = new System.IO.BinaryWriter( fs );

for ( ;; )
{
req = new WebReference.getAttachmentRequest();
req.id = info.id.Value;
req.length = 6144;
req.offset = offset;
resp = m_ws.getAttachmentRequestMessage( req );
if ( 0 != resp.status.code )
{
break;
}
fw.Write( resp.part.Value );
offset = resp.part.offset;
if ( 0 == offset )
{
break;
}
}
fs.Close();
}

Preston

>>> On Wednesday, January 30, 2008 at 10:10 AM,

jr<jriggs.removeme@escortinc.com>
wrote:
> Does anyone have some sample vb/c#.net code to retrieve attachments for
> an account? I have the SDK/google, not finding much help.
>
> Many thanks-
>
> --

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.