none
i sent a message with attachment (size 5M) .response error RRS feed

  • Question

  • i sent a message with attachment (size 5M) .response error

    following is my code:

     EmailMessage emMessage = new EmailMessage(service);
        emMessage.setSubject("Attached Message");
        emMessage.getToRecipients().add("mail@.com");
        String fileName = "D:\\upload\\120411\\160779\\1334085639000\\b.doc";
        FileInputStream stream = new FileInputStream(fileName);
        if(stream!=null){
           int len=stream.available();
    byte[] xml=new byte[len];
    stream.read(xml);
        ExtendedPropertyDefinition sfSentFlag = new ExtendedPropertyDefinition(3591, MapiPropertyType.Integer);
        emMessage.setExtendedProperty(sfSentFlag,"1"); 
        emMessage.getAttachments().addFileAttachment("b.doc",xml);
        emMessage.sendAndSaveCopy(WellKnownFolderName.Inbox);
        }

    response :

    Internal Server Error 500

    Thursday, April 12, 2012 6:15 AM

All replies

  • I'd suggest you look at little more closely at the exception your getting espeically the inner exception also you shouldn't be setting the SentFlag flag on a message your sending it will be set by itself.

    Cheers
    Glen

    Friday, April 13, 2012 5:34 AM
  • i have remove the sendflag flag  on message. but still response internal server error 500.

    when i send mail with less 3 m . it is ok!

    Wednesday, August 1, 2012 1:27 AM
  • How long is the uploaded taking ? maybe your firewall is closing the connection or timing out the Port if its taking a long time over a slow connection. (that's why you need to look more closely at the exception). If your using Exchange 2010 check the EWS log on the CAS server for more information as well.

    The other thing to check would be the Messages Size Send Limits does the user your trying to send as have any Message Size limits eg try to do the same thing in OWA to test.

    Cheers
    Glen 

    Wednesday, August 1, 2012 5:53 AM
  • the send time is very slow.and response following this

         Server was unable to process request.   Object reference not set to an instance of an object.  error code is: 500i

    i just do a test on owa. the owa send  a 10 m file is ok.  

    i also using exchange 2007. and i using ewsjava to develop......

    looking forward your replay.... 

    Wednesday, August 1, 2012 7:15 AM
  • Glen  

      can you help me ?


    Thursday, August 2, 2012 6:11 AM
  •  >> Server was unable to process request.   Object reference not set to an instance of an object.  error code is: 500i

     The Object reference not set to an instance of an object sounds like a bug in Java Managed API

     One problem I've seen with the regular Managed API over slow links with hosted services is the connection being lost because of the way it chunks (or the lack off) the uploads. The only workaround I had for this was not to use the Managed API and use a manually built SOAP request and the HttpWebRequest object as per http://support.microsoft.com/kb/908573.

    Cheers
    Glen

    Thursday, August 2, 2012 6:57 AM