| Author |  | 
      
        | XAvinashX Newbie
 
  
 
 Joined: 17 April 2007
 Location: United States
 Online Status: Offline
 Posts: 7
 | 
          Can someone guide me how to list new messages first. And also change the date format in mm/dd/yy in ASP.
           | Posted: 17 April 2007 at 9:01pm | IP Logged |   |  
           | 
 |  
 It will be of big help, i have gone over my head trying to figure this 2 things.
 
 I would greatly appreciate an sample asp script for both problems.
 
 Thanx
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Andrew AfterLogic Support
 
  
 
 Joined: 28 April 2006
 Location: United States
 Online Status: Offline
 Posts: 1189
 | 
          You can retrieve all messages via IMAP4.RetrieveEnvelopes method and then resort messages in your application according to Envelope.Flags property. In contrast to new messages, old ones have Seen flag set.
           | Posted: 18 April 2007 at 3:47am | IP Logged |   |  
           | 
 |  
 Another way is to retrieve new messages (which haven't Seen flag set) and then old ones. This described in "Search for new messages" sample of MailBee Objects documentation.
 
 You can change date format to US as follows:
 
 
| Code: 
 
    
    | 
      
       | SetLocale("en-us") 
 Dim myDate, myString
 
 myDate = Now
 
 myString = FormatDateTime(myDate, 2)
 |  |  |  
 
 Best regards,
 Andrew
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | XAvinashX Newbie
 
  
 
 Joined: 17 April 2007
 Location: United States
 Online Status: Offline
 Posts: 7
 | 
          SetLocale("en-us")
           | Posted: 18 April 2007 at 9:12pm | IP Logged |   |  
           | 
 |  
 Dim myDate, myString
 
 myDate = objEnvelopes(I).Date
 
 myString = FormatDateTime(myDate, 2)
 
 <%= myString %>
 
 I am trying this but its not working ????
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Andrew AfterLogic Support
 
  
 
 Joined: 28 April 2006
 Location: United States
 Online Status: Offline
 Posts: 1189
 | 
          FormatDateTime function requires the first parameter to be of Date type, but objEnvelopes(I).Date is of String type. To convert a string which contains a date to Date type, you should use Message.GetDateFromString method as follows:
           | Posted: 19 April 2007 at 3:14am | IP Logged |   |  
           | 
 |  
 
 
| Code: 
 
    
    | 
      
       | SetLocale("en-us") 
 Dim myDate, myString, msg
 
 Set Msg = CreateObject("MailBee.Message")
 
 myDate = msg.GetDateFromString(objEnvelopes(I).Date, False)
 
 myString = FormatDateTime(myDate, 2)
 
 <%= myString %>
 |  |  |  
 
 
 Best regards,
 Andrew
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | XAvinashX Newbie
 
  
 
 Joined: 17 April 2007
 Location: United States
 Online Status: Offline
 Posts: 7
 | 
          Thank you soooo muchhhh, it works it works finally the date function is resolved!!! I am still working on the search part and the list new messages first part.
           | Posted: 20 April 2007 at 7:31am | IP Logged |   |  
           | 
 |  
 thank you sir
 | 
       
        | Back to Top |     | 
       
       
        |  |