| Visual Basic (Declaration) | |
|---|---|
Public Function Refresh() As ImapResponse | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As Mailbox Dim value As ImapResponse value = instance.Refresh() | |
| C# | |
|---|---|
public ImapResponse Refresh() | |
| Managed Extensions for C++ | |
|---|---|
public: ImapResponse* Refresh(); | |
| C++/CLI | |
|---|---|
public: ImapResponse^ Refresh(); | |
Return Value
An ImapResponse object encapsulating the response from the server.| Exception | Description |
|---|---|
| Dart.PowerTCP.Mail.ProtocolException | Bad IMAP protocol response received from server. |
| System.Net.Sockets.SocketException | The requested address is not valid in its context. |
| Visual Basic | Copy Code |
|---|---|
Private Sub MailboxCollectionTest() ' Login Imap1.Login(Server, User, Pass) ' Create a new mailbox. Imap1.Mailboxes.Add("MyNewBox") ' Get the Mailbox in a short variable name to reduce typing. Dim Box As New Mailbox = Imap1.Mailboxes("MyNewBox") ' APPEND some test messages Dim i As Integer For i = 0 To 5 ' Dynamically create a new message Dim Msg As New MessageStream() Msg.To.Add(New MailAddress("me@test.com")) Msg.From = New MailAddress("you@test.com") Msg.Subject = "test # " + i Msg.Text = "Hello, how are you?" ' Append the message Box.Messages.Add(msg) Next ' Refresh the mail box so new messages will be included Box.Refresh() ' Display a list of the message identifiers. Debug.WriteLine(Box.Messages.ToString()) ' Clear all messages Box.Messages.Clear() ' Logout Imap1.Logout() End Sub | |
| C# | Copy Code |
|---|---|
private void MailboxCollectionTest() { // Login imap1.Login(Server, User, Pass); // Create a new mailbox. imap1.Mailboxes.Add("MyNewBox"); // Get the Mailbox in a short variable name to reduce typing. Mailbox box = imap1.Mailboxes["MyNewBox"]; // APPEND some test messages for(int i=0; i < 5; i++) { // Dynamically create a new message MessageStream msg = new MessageStream(); msg.To.Add(new MailAddress("me@test.com")); msg.From = new MailAddress("you@test.com"); msg.Subject = "test # " + i; msg.Text = "Hello, how are you?"; // Append the message box.Messages.Add(msg); } // Refresh the mail box so new messages will be included box.Refresh(); // Display a list of the message identifiers. Debug.WriteLine(box.Messages.ToString()); // Clear all messages box.Messages.Clear(); // Logout imap1.Logout(); } | |
Any time a method is called to add/delete/modify a mailbox, the command is sent to the server to update the server mailbox and the appropriate modifications are made to the local Mailbox object representing the server mailbox. The Mailbox.Refresh method updates all the Mailbox properties to reflect the server version. This method uses the IMAP EXAMINE or REFRESH commands to retrieve the current settings of the mailbox, so calling this method is equivalent to setting the mailbox equal to the current mailbox (i.e. this Mailbox object will be the Imap.CurrentMailbox property after calling this method). In addition, this will get information about any new mailbox updates that may have occurred due to another user being logged into the account.
Target Platforms: Microsoft .NET Framework 2.0