[Mono-dev] problem every 8k with using Microsoft Exchange Web Services Managed API

Belis, Joeri j.belis at be.pgz.eu
Tue May 15 13:35:00 UTC 2012

Doing some more investigation i found that the soap messages contains a base64 encoded string which is the attachment .

When i decode it manualy from the soap messages , i get the correct file.

Is there a base64 decode problem with mono?

Van: mono-devel-list-bounces at lists.ximian.com [mailto:mono-devel-list-bounces at lists.ximian.com] Namens Belis, Joeri
Verzonden: maandag 14 mei 2012 17:04
Aan: mono-devel-list at lists.ximian.com
Onderwerp: [Mono-dev] problem every 8k with using Microsoft Exchange Web Services Managed API

Using the Microsoft Exchange Web Services Managed API on linux with mono te extract attachments from exchange server gives an error in the extracted attachment every 8K
At byte 8192 and 16384 ( and i guess after every 8k block ) it is loosing data.

I got only my code working in linux/mono because the TimeZoneInfo did not work on windows/mono

Example code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Exchange.WebServices.Data;
using System.Net;

namespace Exchange_SDP_Attachment_Extracter
    public class PgzExchangeService
        public void Extract()
            ExchangeService service = new ExchangeService  (ExchangeVersion.Exchange2007_SP1,TimeZoneInfo.CreateCustomTimeZone("Central Standard Time",new TimeSpan(-6, 0, 0),"(GMT-06:00) Central Time (US & Canada)","Central Standard Time"));
            service.Credentials = new NetworkCredential("user", "pass", "domain");
            service.Url = new Uri("https://xx.xx.xx.xx/EWS/Exchange.asmx");
            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

            FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, new ItemView(10));
            foreach (Item item in findResults.Items)
                EmailMessage e = EmailMessage.Bind
                                   new PropertySet(BasePropertySet.IdOnly, ItemSchema.Attachments));
                foreach ( Attachment att in e.Attachments )

                    if (att is FileAttachment)
                        FileAttachment fileAttachment = (FileAttachment)att;
                        fileAttachment.Load(@"/tmp/testsdp/" + fileAttachment.Name);


    class Program
         static void Main(string[] args)
             PgzExchangeService pgz = new PgzExchangeService();

Please consider the environment before printing this e-mail

The information as contained in this communication is confidential and may be legally privileged. It is intended solely for the use of the individual or entity to whom it is addressed and others authorized to receive it. If you are not the intended recipient you are hereby (a): notified that any disclosure, copying, distribution or taking any action with respect to the content of this information is strictly prohibited and may be unlawful, and (b): kindly requested to inform the sender immediately and destroy any copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120515/b2a9284c/attachment.html>

More information about the Mono-devel-list mailing list