Click or drag to resize

MessageControllerGetMailBoxMessages Method

Get the messages in the specified mailbox. The logged in user must have access to the mailbox.

Namespace:  MedTunnelMsg.Controllers
Assembly:  MedTunnelMsg (in MedTunnelMsg.dll) Version: (
public Result GetMailBoxMessages(
	int MailBoxId,
	bool OnlyMessagesWithAttachments = false,
	int StartRow = 0,
	int RowCount = 50,
	int LastMessageId = 0,
	bool IncludeAllMailBoxes = false,
	bool UnReadOnly = false,
	bool LoadAllIfNew = false,
	string ExcludeMailboxes = ""


Type: SystemInt32
Internal Mailbox Id
OnlyMessagesWithAttachments (Optional)
Type: SystemBoolean
Get only messages with attachments? Default is false.
StartRow (Optional)
Type: SystemInt32
Starting row for messages to retrieve. Default is 0.
RowCount (Optional)
Type: SystemInt32
Number of rows to retrieve. Default is 50.
LastMessageId (Optional)
Type: SystemInt32
The last message retrieved. Default is 0.
IncludeAllMailBoxes (Optional)
Type: SystemBoolean
Return messages for all mailboxes the user has access to? Default is false.
UnReadOnly (Optional)
Type: SystemBoolean
Get unread messages only? Default is false
LoadAllIfNew (Optional)
Type: SystemBoolean
If there are new messages (MessageId > LastMessageId) then retrieve all messages? Default is false
ExcludeMailboxes (Optional)
Type: SystemString
Comma separated list if mailboxes to exclude from retrieval. Example: user1@acct1,user4@acct1

Return Value

Type: Result
Result.Data contains a list of Message objects. Result.ReturnCode values:
  • 0 = An unknown error occurred
  • 1 = Success
  • 3 = Mailbox not found
//namespaces to include
//using System;
//using System.Collections.Generic;
//using System.Net;
//using System.Web.Script.Serialization;
//using System.IO;
//using System.Net.Http;
//using System.Net.Http.Headers;

string authKey = "";
string url;
string downloadString;
string dataToSend;
MedTunnelMsg.Models.Result webResult;
JavaScriptSerializer serializer = new JavaScriptSerializer();

//if the session has expired then re-login
if (!SessionStillActive())
    authKey = Login();

List<MedTunnelMsg.Models.Message> messages = new List<MedTunnelMsg.Models.Message>();

using (var client = new WebClient())
    wc.Headers["Authorization"] = authKey;
    wc.Headers[HttpRequestHeader.ContentType] = "application/json";

    url =    "";

    downloadString = client.DownloadString(url);

    webResult = serializer.Deserialize<MedTunnelMsg.Models.Result>(downloadString);

    if (webResult.ReturnCode == 1)
        messages = (List<MedTunnelMsg.Models.Message>)serializer.Deserialize<List<MedTunnelMsg.Models.Message>>(webResult.Data.ToString());
        throw new Exception("Failed: " + webResult.ReturnCode.toString());
curl -X GET -k 
        -H "Authorization:PutAuthorizationTokenHere"
See Also