public static void Run()
        {
            try
            {

                // ExStart:ListMessagesByID
                // Create instance of ExchangeClient class by giving credentials
                ExchangeClient client = new ExchangeClient("https://MachineName/exchange/Username", "username", "password", "domain");

                // Call ListMessages method to list messages info from Inbox
                ExchangeMessageInfoCollection msgCollection = client.ListMessagesById(client.MailboxInfo.InboxUri, "*****@*****.**");

                // Loop through the collection to display the basic information
                foreach (ExchangeMessageInfo msgInfo in msgCollection)
                {
                    Console.WriteLine("Subject: " + msgInfo.Subject);
                    Console.WriteLine("From: " + msgInfo.From.ToString());
                    Console.WriteLine("To: " + msgInfo.To.ToString());
                    Console.WriteLine("Message ID: " + msgInfo.MessageId);
                    Console.WriteLine("Unique URI: " + msgInfo.UniqueUri);
                    Console.WriteLine("==================================");
                }
                // ExEnd:ListMessagesByID
            }
            catch (Exception ex)
            {

                Console.Write(ex.Message);
            }
        }
        public static void Run()
        {
            // ExStart:MoveMessageFromOneFolderToAnotherUsingExchangeClient
            string mailboxURI = "https://Ex2003/exchange/administrator"; // WebDAV

            string username = "******";
            string password = "******";
            string domain = "domain.local";

            Console.WriteLine("Connecting to Exchange Server....");
            NetworkCredential credential = new NetworkCredential(username, password, domain);
            ExchangeClient client = new ExchangeClient(mailboxURI, credential);

            ExchangeMailboxInfo mailboxInfo = client.GetMailboxInfo();

            // List all messages from Inbox folder
            Console.WriteLine("Listing all messages from Inbox....");
            ExchangeMessageInfoCollection msgInfoColl = client.ListMessages(mailboxInfo.InboxUri);
            foreach (ExchangeMessageInfo msgInfo in msgInfoColl)
            {
                // Nove message to "Processed" folder, after processing certain messages based on some criteria
                if (msgInfo.Subject != null &&
                    msgInfo.Subject.ToLower().Contains("process this message") == true)
                {                    
                    client.MoveItems(msgInfo.UniqueUri, client.MailboxInfo.RootUri + "/Processed/" + msgInfo.Subject);
                    Console.WriteLine("Message moved...." + msgInfo.Subject);
                }
                else
                {
                    // Do something else
                }
            }
            // ExEnd:MoveMessageFromOneFolderToAnotherUsingExchangeClient
        }
        public EmployeeMasterCard()
        {
            _exchangeClient = new ExchangeClient();
            _exchangeClient.EMP_DATA_ACK += new _IExchangeClientEvents_EMP_DATA_ACKEventHandler(_exchangeClient_EMP_DATA_ACK);
            _exchangeClient.InitialiseExchange(0);

            if (_requestCollection == null)
                _requestCollection = new SortedDictionary<int, EmployeeMasterCardThreadData>();

            if (_emppollingCollection == null)
                _emppollingCollection = new List<Employeecarddata>();


            _thRequest = new Thread(new ThreadStart(ProcessRequest));
            _thRequest.Start();


            _thAckResponse = new ThreadDispatcher<EmployeeMasterCardThreadDataResponse>(1, "_thAckResponse_EmployeeMasterCard");
            _thAckResponse.AddProcessThreadData(new ProcessThreadDataHandler<EmployeeMasterCardThreadDataResponse>(this.ProcessResponse));
            _thAckResponse.Initialize();

            _iExchangeAdmin = (IExchangeAdmin)_exchangeClient;
            ObjectStateNotifier.AddObserver(this);

        }
        public static void Run()
        {
            try
            {
                // ExStart:ListMessagesFromDifferentFolders
                // Create instance of ExchangeClient class by giving credentials
                ExchangeClient client = new ExchangeClient("https://MachineName/exchange/Username", "username", "password", "domain");

                // Get folder URI
                string strFolderURI = string.Empty;
                strFolderURI = client.MailboxInfo.InboxUri;
                strFolderURI = client.MailboxInfo.DeletedItemsUri;
                strFolderURI = client.MailboxInfo.DraftsUri;
                strFolderURI = client.MailboxInfo.SentItemsUri;

                // get list of messages from the specified folder
                ExchangeMessageInfoCollection msgCollection = client.ListMessages(strFolderURI);
                // ExEnd:ListMessagesFromDifferentFolders
            }
            catch (Exception ex)
            {

                Console.Write(ex.Message);
            }
        }
        public static void Run()
        {
            try
            {
                // ExStart:SaveMessagesToMemoryStream
                string dataDir = RunExamples.GetDataDir_Exchange();
                // Create instance of ExchangeClient class by giving credentials
                ExchangeClient client = new ExchangeClient("https://Ex07sp1/exchange/Administrator", "user", "pwd",
                    "domain");

                // Call ListMessages method to list messages info from Inbox
                ExchangeMessageInfoCollection msgCollection = client.ListMessages(client.MailboxInfo.InboxUri);

                // Loop through the collection to get Message URI
                foreach (ExchangeMessageInfo msgInfo in msgCollection)
                {
                    string strMessageURI = msgInfo.UniqueUri;

                    // Now save the message in memory stream
                    MemoryStream stream = new MemoryStream();
                    client.SaveMessage(strMessageURI, dataDir + stream);
                }
                // ExEnd:SaveMessagesToMemoryStream
            }
            catch (Exception ex)
            {

                Console.Write(ex.Message);
            }
        }
        public static void Run()
        {
            // ExStart:DeleteMessagesFromExchangeServer
            // Create instance of IEWSClient class by giving credentials
            string mailboxURI = "https://Ex2003/exchange/administrator"; // WebDAV

            string username = "******";
            string password = "******";
            string domain = "domain.local";

            Console.WriteLine("Connecting to Exchange Server....");
            NetworkCredential credential = new NetworkCredential(username, password, domain);
            ExchangeClient client = new ExchangeClient(mailboxURI, credential);

            ExchangeMailboxInfo mailboxInfo = client.GetMailboxInfo();

            // List all messages from Inbox folder
            Console.WriteLine("Listing all messages from Inbox....");
            ExchangeMessageInfoCollection msgInfoColl = client.ListMessages(mailboxInfo.InboxUri);
            foreach (ExchangeMessageInfo msgInfo in msgInfoColl)
            {
                // Delete message based on some criteria
                if (msgInfo.Subject != null &&
                    msgInfo.Subject.ToLower().Contains("delete") == true)
                {
                    client.DeleteMessage(msgInfo.UniqueUri);
                    Console.WriteLine("Message deleted...." + msgInfo.Subject);
                }
                else
                {
                    // Do something else
                }
            }
            // ExEnd:DeleteMessagesFromExchangeServer
        }
        public static void Run()
        {
            try
            {
                // ExStart:SendEmailMessagesUsingExchangeServer
                // Create instance of ExchangeClient class by giving credentials
                ExchangeClient client = new ExchangeClient("https://MachineName/exchange/username", "username", "password", "domain");

                // Create instance of type MailMessage
                MailMessage msg = new MailMessage();
                msg.From = "*****@*****.**";
                msg.To = "recipient@ domain.com ";
                msg.Subject = "Sending message from exchange server";
                msg.HtmlBody = "<h3>sending message from exchange server</h3>";

                // Send the message
                client.Send(msg);
                // ExEnd:SendEmailMessagesUsingExchangeServer
            }
            catch (Exception ex)
            {

                Console.Write(ex.Message);
            }

        }
        public static void Run()
        {
          
            try
            {
                // ExStart:ListExchangeServerMessages
                // Create instance of ExchangeClient class by giving credentials
                ExchangeClient client = new ExchangeClient("https://MachineName/exchange/Username", "username", "password", "domain");

                // Call ListMessages method to list messages info from Inbox
                ExchangeMessageInfoCollection msgCollection = client.ListMessages(client.MailboxInfo.InboxUri);

                // Loop through the collection to display the basic information
                foreach (ExchangeMessageInfo msgInfo in msgCollection)
                {
                    Console.WriteLine("Subject: " + msgInfo.Subject);
                    Console.WriteLine("From: " + msgInfo.From.ToString());
                    Console.WriteLine("To: " + msgInfo.To.ToString());
                    Console.WriteLine("Sent Date: " + msgInfo.Date.ToString());
                    Console.WriteLine("Read?: " + msgInfo.IsRead.ToString());
                    Console.WriteLine("Message ID: " + msgInfo.MessageId);
                    Console.WriteLine("Unique URI: " + msgInfo.UniqueUri);                    
                }
                // ExEnd:ListExchangeServerMessages
            }
            catch (Exception ex)
            {

                Console.Write(ex.Message);
            }

          
        }
        public static void Run()
        {
            try
            {
                // ExStart:EnumeratMessagesWithPaginginEWS
                string dataDir = RunExamples.GetDataDir_Exchange();
                // Create instance of ExchangeClient class by giving credentials
                ExchangeClient client = new ExchangeClient("http://Servername/exchange/username", "username", "password", "domain");

                // Call ListMessages method to list messages info from Inbox
                ExchangeMessageInfoCollection msgCollection = client.ListMessages(client.MailboxInfo.InboxUri);

                // Loop through the collection to get Message URI
                foreach (ExchangeMessageInfo msgInfo in msgCollection)
                {
                    string strMessageURI = msgInfo.UniqueUri;

                    // Now save the message in disk
                    client.SaveMessage(strMessageURI, dataDir + msgInfo.MessageId + "_out.eml");
                }
                // ExEnd:EnumeratMessagesWithPaginginEWS
            }
            catch (Exception ex)
            {

                Console.Write(ex.Message);
            }
        }
        public static void Run()
        {
            // ExStart:AccessAnotherMailboxUsingExchangeClient
            // Create instance of ExchangeClient class by giving credentials
            ExchangeClient client = new ExchangeClient("http://MachineName/exchange/Username","Username", "password", "domain");

            // Get Exchange mailbox info of other email account
            ExchangeMailboxInfo mailboxInfo = client.GetMailboxInfo("*****@*****.**");
            // ExEnd:AccessAnotherMailboxUsingExchangeClient
        }
        public async Task<ExchangeClient> EnsureExchangeClient()
        {
            if (_exchangeClient != null)
                return _exchangeClient;

            var authenticator = new Authenticator();
            _authenticationInfo = await authenticator.AuthenticateAsync(ExchangeResourceId);

            _exchangeClient = new ExchangeClient(new Uri(ExchangeServiceRoot), _authenticationInfo.GetAccessToken);
            _isAuthenticated = true;
            return _exchangeClient;
        }
 public static async Task EnsureClientCreated(Context context) {
   
   Authenticator authenticator = new Authenticator(context);
   var authInfo = await authenticator.AuthenticateAsync(ExchangeResourceId);
   
   _strUserId = authInfo.IdToken.UPN;
   _exchangeClient = new ExchangeClient(new Uri(ExchangeServiceRoot), authInfo.GetAccessToken);
   
   var adAuthInfo = await authInfo.ReauthenticateAsync(AdServiceResourceId);
   _adClient = new AadGraphClient(new Uri("https://graph.windows.net/" + authInfo.IdToken.TenantId), 
                                  adAuthInfo.GetAccessToken);
 }
        public InstantPeriodicIntervalHandler()
        {
            _exchangeClient = new ExchangeClient();
            _exchangeClient.InitialiseExchange(0);

            _tmrRequest = new System.Timers.Timer(Int32.Parse(ConfigManager.Read("InstantPeriodicInterval")) * 1000);
            _tmrRequest.Elapsed += new ElapsedEventHandler(ProcessRequest);

            _iExchangeAdmin = (IExchangeAdmin)_exchangeClient;
            ObjectStateNotifier.AddObserver(this);

            _tmrRequest.Start();
        }
        public MachineManagerInterface()
        {
            _exchangeClient = new ExchangeClient();

            _exchangeClient.ExchangeSectorUpdate += ExchangeClientExchangeSectorUpdate;
            _exchangeClient.ACK += ExchangeClientAck;
            _exchangeClient.UDPUpdate += ExchangeClientUDPUpdate;
            _exchangeClient.ServerUpdate += ExchangeClientServerUpdate;

            _exchangeClient.InitialiseExchange(0);
            //RefreshActiveServer();
            _iExchangeAdmin = (IExchangeAdmin)_exchangeClient;
        }
Ejemplo n.º 15
0
        static void Main(string[] args)
        {
            string MailBoxURI = "http://MachineName/exchange/Username";
            string UserName = "******";
            string Password = "******";
            string Domain = "domain";

            // Create instance of ExchangeClient class by giving credentials
            ExchangeClient client = new ExchangeClient(MailBoxURI,UserName, Password, Domain);
            // Call ListMessages method to list messages info from Inbox
            ExchangeMessageInfoCollection msgCollection = client.ListMessages(client.MailboxInfo.InboxUri);

            int i = msgCollection.Count;
            Console.WriteLine("Message count: " + i);
        }
Ejemplo n.º 16
0
        public TITO()
        {
            _exchangeClientSiteCode = new ExchangeClient();
            _exchangeClientSiteCode.OPT_PARAM_ACK += ExchangeClientSiteCodeAck;
            _exchangeClientSiteCode.InitialiseExchange(0);

            _exchangeClientTITOEnDis = new ExchangeClient();
            _exchangeClientTITOEnDis.TITO_ENDIS_ACK += ExchangeClientTITOAck;
            _exchangeClientTITOEnDis.InitialiseExchange(0);

            _exchangeClientTITOEXP = new ExchangeClient();
            _exchangeClientTITOEXP.TITO_PARAM_ACK += ExchangeClientVoucherAck;
            _exchangeClientTITOEXP.InitialiseExchange(0);

            if (dTITORequest == null)
                dTITORequest = new SortedDictionary<int, TITOThreadDataRequest>();

            if (dTicketExpireRequest == null)
                dTicketExpireRequest = new SortedDictionary<int, int>();

            if (dSiteCodeRequest == null)
                dSiteCodeRequest = new SortedDictionary<int, int>();

            _tmrRequest = new System.Timers.Timer(Int32.Parse(ConfigManager.Read("TITOConfigInterval")) * 1000);
            _tmrRequest.Elapsed += new ElapsedEventHandler(ProcessRequest);

            _thAckResponse = new ThreadDispatcher<TITOThreadDataResponse>(1, "_thTITOAckResponse");
            _thAckResponse.AddProcessThreadData(new ProcessThreadDataHandler<TITOThreadDataResponse>(this.TITOProcessResponse));
            _thAckResponse.Initialize();

            _thTicketExpireAckResponse = new ThreadDispatcher<TITOThreadDataResponse>(1, "_thTicketExpireAckResponse");
            _thTicketExpireAckResponse.AddProcessThreadData(new ProcessThreadDataHandler<TITOThreadDataResponse>(this.TicketExpireProcessResponse));
            _thTicketExpireAckResponse.Initialize();

            _thSiteCodeAckResponse = new ThreadDispatcher<TITOThreadDataResponse>(1, "_thSiteCodeAckResponse");
            _thSiteCodeAckResponse.AddProcessThreadData(new ProcessThreadDataHandler<TITOThreadDataResponse>(this.SiteCodeProcessResponse));
            _thSiteCodeAckResponse.Initialize();

            _iExchangeAdminSiteCode = (IExchangeAdmin)_exchangeClientSiteCode;
            _iExchangeAdminTITOEnDis = (IExchangeAdmin)_exchangeClientTITOEnDis;
            _iExchangeAdminTITOEXP = (IExchangeAdmin)_exchangeClientTITOEXP;

            ObjectStateNotifier.AddObserver(this);

            _tmrRequest.Start();
        }
Ejemplo n.º 17
0
        static void Main(string[] args)
        {
            string MailBoxURI = "http://MachineName/exchange/Username";
            string UserName = "******";
            string Password = "******";
            string Domain = "domain";

            // Create instance of ExchangeClient class by giving credentials
            ExchangeClient client = new ExchangeClient(MailBoxURI, UserName, Password, Domain);
            // Call ListMessages method to list messages info from Inbox
            ExchangeMessageInfoCollection msgCollection = client.ListMessages(client.MailboxInfo.InboxUri);

            // Get URI of Message to Delete
            string MessageURI= msgCollection[0].UniqueUri;

            // Delete the message
            client.DeleteMessage(MessageURI);
        }
        public static void Initialize()
        {
            if (!_bInitialized)
            {
                _bRunThread = true;
                _prcoessEvent = new ManualResetEventSlim(true);
                _waitTime = Convert.ToInt32(ConfigurationManager.AppSettings["WaitTime"].ToString());
                iMaxRows = Convert.ToInt32(ConfigurationManager.AppSettings["MaxRows"].ToString());

                _exchangeClient = new ExchangeClient();
                _exchangeClient.InitialiseExchange(0);
                m_SectorData = new Sector203Data();

                objResponseBusiness = DMResponseBusiness.ResponseBusinessInstance;
                _processThread = new Thread(ProcessMessages);
                _processThread.Start();
            }
        }
Ejemplo n.º 19
0
        static void Main(string[] args)
        {
            // Create instance of ExchangeClient class by giving credentials
            ExchangeClient client = new ExchangeClient("http://MachineName/exchange/Username",
                            "username", "password", "domain");
            // Call ListMessages method to list messages info from Inbox
            ExchangeMessageInfoCollection msgCollection = client.ListMessages(client.MailboxInfo.InboxUri);

            // Loop through the collection to display the basic information
            foreach (ExchangeMessageInfo msgInfo in msgCollection)
            {
                Console.WriteLine("Subject: " + msgInfo.Subject);
                Console.WriteLine("From: " + msgInfo.From.ToString());
                Console.WriteLine("To: " + msgInfo.To.ToString());
                Console.WriteLine("Message ID: " + msgInfo.MessageId);
                Console.WriteLine("Unique URI: " + msgInfo.UniqueUri);
                Console.WriteLine("==================================");
            }
        }
Ejemplo n.º 20
0
        public EnableDisable()
        {
            _exchangeClient = new ExchangeClient();
            _exchangeClient.MACEnDisAck += ExchangeClientAck;
            _exchangeClient.InitialiseExchange(0);

            if (dEnableDisableRequest == null)
                dEnableDisableRequest = new SortedDictionary<int, EnableDisableThreadData>();

            _tmrRequest = new System.Timers.Timer(Int32.Parse(ConfigManager.Read("MachineConfigInterval")) * 1000);
            _tmrRequest.Elapsed += new ElapsedEventHandler(ProcessRequest);

            _thAckResponse = new ThreadDispatcher<EnableDisableThreadDataResponse>(1, "_thAckResponse");
            _thAckResponse.AddProcessThreadData(new ProcessThreadDataHandler<EnableDisableThreadDataResponse>(this.ProcessResponse));
            _thAckResponse.Initialize();

            _iExchangeAdmin = (IExchangeAdmin)_exchangeClient;
            ObjectStateNotifier.AddObserver(this);

            _tmrRequest.Start();
        }
        public EmployeeMasterCard()
        {
            _exchangeClient = new ExchangeClient();
            _exchangeClient.EMP_DATA_ACK += new _IExchangeClientEvents_EMP_DATA_ACKEventHandler(_exchangeClient_EMP_DATA_ACK);
            _exchangeClient.InitialiseExchange(0);

            if (_requestCollection == null)
                _requestCollection = new SortedDictionary<int, EmployeeMasterCardThreadData>();

            _tmrRequest = new System.Timers.Timer(Int32.Parse(ConfigManager.Read("EmployeecardTimeInterval")) * 1000);
            _tmrRequest.Elapsed += new ElapsedEventHandler(ProcessRequest);

            _thAckResponse = new ThreadDispatcher<EmployeeMasterCardThreadDataResponse>(1, "_thAckResponse_EmployeeMasterCard");
            _thAckResponse.AddProcessThreadData(new ProcessThreadDataHandler<EmployeeMasterCardThreadDataResponse>(this.ProcessResponse));
            _thAckResponse.Initialize();

            _iExchangeAdmin = (IExchangeAdmin)_exchangeClient;
            ObjectStateNotifier.AddObserver(this);

            _tmrRequest.Start();
        }
        public AutoEnableDisable()
        {
            _exchangeClient = new ExchangeClient();

            _exchangeClient.ExchangeSectorUpdate += ExchangeClientExchangeSectorUpdate;
            _exchangeClient.ACK += ExchangeClientAck;
            _exchangeClient.UDPUpdate += ExchangeClientUDPUpdate;
            _exchangeClient.ServerUpdate += ExchangeClientServerUpdate;

            _exchangeClient.InitialiseExchange(0);
            lock (HoldingObject)
            {
                if (MessageStore == null)
                    MessageStore = new List<MessageStore>();

                if (AFTMessages == null)
                    AFTMessages = new List<AFTMessages>();
            }
            _iExchangeAdmin = (IExchangeAdmin)_exchangeClient;
            ObjectStateNotifier.AddObserver(this);
        }
Ejemplo n.º 23
0
        public static void Run()
        {
            try
            {
                ExchangeClient client = new ExchangeClient("http://ex07sp1/exchange/Administrator", "user", "pwd", "domain");

                // ExStart:CaseSensitiveEmailsFilteringUsingExchangeClient
                // Set conditions
                ExchangeQueryBuilder builder = new ExchangeQueryBuilder();
                builder.Subject.Contains("Newsletter", true);
                builder.InternalDate.On(DateTime.Now);
                MailQuery query = builder.GetQuery();
                // ExEnd:CaseSensitiveEmailsFilteringUsingExchangeClient

                ExchangeMessageInfoCollection messages = client.ListMessages(client.MailboxInfo.InboxUri, query, false);
                Console.WriteLine("Exchange: " + messages.Count + " message(s) found.");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        public static void Run()
        {
            // ExStart:SendMeetingRequestsUsingExchangeServer
            try
            {
                string mailboxUri = @"https://ex07sp1/exchange/administrator"; // WebDAV
                string domain     = @"litwareinc.com";
                string username   = @"administrator";
                string password   = @"Evaluation1";

                NetworkCredential credential = new NetworkCredential(username, password, domain);
                Console.WriteLine("Connecting to Exchange server.....");
                // Connect to Exchange Server
                ExchangeClient client = new ExchangeClient(mailboxUri, credential); // WebDAV

                // Create the meeting request
                Appointment app = new Appointment("meeting request", DateTime.Now.AddHours(1), DateTime.Now.AddHours(1.5), "administrator@" + domain, "bob@" + domain);
                app.Summary     = "meeting request summary";
                app.Description = "description";

                // Create the message and set the meeting request
                MailMessage msg = new MailMessage();
                msg.From       = "administrator@" + domain;
                msg.To         = "bob@" + domain;
                msg.IsBodyHtml = true;
                msg.HtmlBody   = "<h3>HTML Heading</h3><p>Email Message detail</p>";
                msg.Subject    = "meeting request";
                msg.AddAlternateView(app.RequestApointment(0));

                // Send the appointment
                client.Send(msg);
                Console.WriteLine("Appointment request sent");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            // ExEnd:SendMeetingRequestsUsingExchangeServer
        }
        public static void Run()
        {
            // ExStart:SendMeetingRequestsUsingExchangeServer
            try
            {
                string mailboxUri = @"https://ex07sp1/exchange/administrator"; // WebDAV
                string domain = @"litwareinc.com";
                string username = @"administrator";
                string password = @"Evaluation1";

                NetworkCredential credential = new NetworkCredential(username, password, domain);
                Console.WriteLine("Connecting to Exchange server.....");
                // Connect to Exchange Server
                ExchangeClient client = new ExchangeClient(mailboxUri, credential); // WebDAV

                // Create the meeting request
                Appointment app = new Appointment("meeting request", DateTime.Now.AddHours(1), DateTime.Now.AddHours(1.5), "administrator@" + domain, "bob@" + domain);
                app.Summary = "meeting request summary";
                app.Description = "description";

                // Create the message and set the meeting request
                MailMessage msg = new MailMessage();
                msg.From = "administrator@" + domain;
                msg.To = "bob@" + domain;
                msg.IsBodyHtml = true;
                msg.HtmlBody = "<h3>HTML Heading</h3><p>Email Message detail</p>";
                msg.Subject = "meeting request";
                msg.AddAlternateView(app.RequestApointment(0));

                // Send the appointment
                client.Send(msg);
                Console.WriteLine("Appointment request sent");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            // ExEnd:SendMeetingRequestsUsingExchangeServer
        }        
Ejemplo n.º 26
0
        public void TestCoinbase()
        {
            CoinbaseClientConfig config = CoinbaseClientConfig.Authenticated(
                Environment.GetEnvironmentVariable("COINBASE_API_KEY"),
                Environment.GetEnvironmentVariable("COINBASE_API_SECRET"),
                Environment.GetEnvironmentVariable("COINBASE_PASSPHRASE"),
                true
                );

            var client = new ExchangeClient(config);

            TestContext.Progress.WriteLine("Orderbook " + client.Orderbook("ETH-BTC"));
            TestContext.Progress.WriteLine("ReceivePairs " + client.ReceivePairs());
            TestContext.Progress.WriteLine("GetAccountBalances " + client.GetAccountBalances());
            TestContext.Progress.WriteLine("GetOrderHistory ETH-BTC: " + client.GetOrderHistory(new GetOrderHistoryRequest("ETH-BTC")));
            client.CancelAllOrders("ETH-BTC");
            TestContext.Progress.WriteLine("Limit sell: " + client.LimitSell(LimitOrderRequest.goodTillCancelled("0.001", "1", "ETH-BTC")));
            TestContext.Progress.WriteLine("Limit buy: " + client.LimitBuy(LimitOrderRequest.goodTillCancelled("0.001", "1", "ETH-BTC")));
            // TestContext.Progress.WriteLine("Limit buy fok: " + client.LimitSell(LimitOrderRequest.fillOrKill("0.001", "1", "ETH-BTC")));
            TestContext.Progress.WriteLine("Limit buy ioc: " + client.LimitSell(LimitOrderRequest.immediateOrCancel("0.001", "1", "ETH-BTC")));
            client.CancelAllOrders("ETH-BTC");
        }
Ejemplo n.º 27
0
        private void readInbox(ExchangeClient client)
        {
            Dictionary <string, clsFileList> convertFiles = new Dictionary <string, clsFileList>();


            try
            {
                //query mailbox
                ExchangeMailboxInfo mailbox = client.GetMailboxInfo();
                //list messages in the Inbox
                ExchangeMessageInfoCollection messages = client.ListMessages(mailbox.InboxUri, false);

                foreach (ExchangeMessageInfo info in messages)
                {
                    //save the message locally
                    //client.SaveMessage(info.UniqueUri, info.Subject + ".eml");
                    // create object of type MailMessage
                    MailMessage msg;

                    msg = client.FetchMessage(info.UniqueUri);


                    foreach (Attachment attachedFile in msg.Attachments)
                    {
                        extractAttachment(convertFiles, attachedFile);
                    }



                    // Can't see a 'readed' flag on messages, info or msg
                    // so we'll have to delete emails after we have read them
                    //client.DeleteMessage(info.UniqueUri);
                }
            }
            catch (ExchangeException ex)
            {
                // Console.WriteLine(ex.ToString());
            }
        }
Ejemplo n.º 28
0
        private void Init()
        {
            if (!inited)
            {
                if (dispatcher == null)
                {
                    dispatcher = new EventDispatcher(this);
                }
                client         = new ExchangeClient(this);
                client.Logger  = log;
                client.Handler = new DefaultHandler(client);

                client.AddEventListener(ClientEvent.CONNECT, new EventListenerDelegate <MyEvent>(OnChannelConnect));
                client.AddEventListener(ClientEvent.DISCONNECT, new EventListenerDelegate <MyEvent>(this.OnChnnelDisconnect));
                client.AddEventListener(ClientEvent.DATA_ERROR, new EventListenerDelegate <MyEvent>(this.OnChnnelDataError));
                client.AddEventListener(ClientEvent.IO_ERROR, new EventListenerDelegate <MyEvent>(this.OnChnnelIOError));
                client.AddEventListener(ClientEvent.RECONNECTION_TRY, new EventListenerDelegate <MyEvent>(this.OnChannelReconnectionTry));
                client.AddEventListener(ClientEvent.KICK_CLIENT, new EventListenerDelegate <MyEvent>(this.HandleKickClient));
                AddEventListener(UnityClientEvent.HANDSHAKE, new EventListenerDelegate <MyEvent>(this.HandlHandSnake));
                this.inited = true;
            }
        }
        public static void Run()
        {
            try
            {
                // ExStart:GetMailboxInformationFromExchangeServer
                // Create instance of ExchangeClient class by giving credentials
                ExchangeClient client = new ExchangeClient("https://MachineName/exchange/Username", "Username", "password", "domain");

                // Get mailbox size, exchange mailbox info, Mailbox, Inbox folder, Sent Items folder URI , Drafts folder URI
                Console.WriteLine("Mailbox size: " + client.GetMailboxSize() + " bytes");
                ExchangeMailboxInfo mailboxInfo = client.GetMailboxInfo();
                Console.WriteLine("Mailbox URI: " + mailboxInfo.MailboxUri);
                Console.WriteLine("Inbox folder URI: " + mailboxInfo.InboxUri);
                Console.WriteLine("Sent Items URI: " + mailboxInfo.SentItemsUri);
                Console.WriteLine("Drafts folder URI: " + mailboxInfo.DraftsUri);
                // ExEnd:GetMailboxInformationFromExchangeServer
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
        }
        public static void Run()
        {
            try
            {
                // ExStart:GetMailboxInformationFromExchangeServer 
                // Create instance of ExchangeClient class by giving credentials
                ExchangeClient client = new ExchangeClient("https://MachineName/exchange/Username", "Username", "password", "domain");
                // Get mailbox size, exchange mailbox info, Mailbox, Inbox folder, Sent Items folder URI , Drafts folder URI
                Console.WriteLine("Mailbox size: " + client.GetMailboxSize() + " bytes");
                ExchangeMailboxInfo mailboxInfo = client.GetMailboxInfo();
                Console.WriteLine("Mailbox URI: " + mailboxInfo.MailboxUri);
                Console.WriteLine("Inbox folder URI: " + mailboxInfo.InboxUri);
                Console.WriteLine("Sent Items URI: " + mailboxInfo.SentItemsUri);
                Console.WriteLine("Drafts folder URI: " + mailboxInfo.DraftsUri);
                // ExEnd:GetMailboxInformationFromExchangeServer
            }
            catch (Exception ex)
            {

                Console.Write(ex.Message);
            }
        }
Ejemplo n.º 31
0
        static public void Main(string[] args)
        {
            Console.WriteLine("Init");
            NashClientConfig config = NashClientConfig.Unauthenticated(0, NashEnvironment.Production, 1000);
            var client = new ExchangeClient(config);

            client.SubscribeToDisconnect(() => {
                Console.WriteLine("Disconnected");
            });
            foreach (var market in client.ReceivePairs())
            {
                client.SubscribeToOrderbook(market.symbol, PrintBook);
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();

            // Noia markets only available in NashEnvironment.Production
            // Console.WriteLine("Listening to the noia markets");
            // client.SubscribeToOrderbook("noia_usdc", PrintBook);
            // client.SubscribeToOrderbook("noia_btc", PrintBook);
        }
        private async void btnGetMyMails_Click(object sender, RoutedEventArgs e)
        {
            setLoadingString("Loading..");
            clearAllLists();
            if (AppCapabilities == null)
            {
                await getAppCapabilities();
            }

            var mailClient = ExchangeClient.ensureOutlookClientCreated(AppCapabilities, "Mail");
            await MailOperations.sendMail(mailClient, FileParse.readMails());

            var myMails = await MailOperations.getMails(mailClient);

            foreach (var myMail in myMails)
            {
                Mails.Add(new MyMail {
                    Subject = myMail.Subject
                });
            }

            setLoadingString("");
        }
Ejemplo n.º 33
0
        public EmployeeMasterCard()
        {
            _exchangeClient = new ExchangeClient();
            _exchangeClient.EMP_DATA_ACK += new _IExchangeClientEvents_EMP_DATA_ACKEventHandler(_exchangeClient_EMP_DATA_ACK);
            _exchangeClient.InitialiseExchange(0);

            if (_requestCollection == null)
            {
                _requestCollection = new SortedDictionary <int, EmployeeMasterCardThreadData>();
            }

            _tmrRequest          = new System.Timers.Timer(Int32.Parse(ConfigManager.Read("EmployeecardTimeInterval")) * 1000);
            _tmrRequest.Elapsed += new ElapsedEventHandler(ProcessRequest);

            _thAckResponse = new ThreadDispatcher <EmployeeMasterCardThreadDataResponse>(1, "_thAckResponse_EmployeeMasterCard");
            _thAckResponse.AddProcessThreadData(new ProcessThreadDataHandler <EmployeeMasterCardThreadDataResponse>(this.ProcessResponse));
            _thAckResponse.Initialize();

            _iExchangeAdmin = (IExchangeAdmin)_exchangeClient;
            ObjectStateNotifier.AddObserver(this);

            _tmrRequest.Start();
        }
Ejemplo n.º 34
0
        public EnableDisable()
        {
            _exchangeClient              = new ExchangeClient();
            _exchangeClient.MACEnDisAck += ExchangeClientAck;
            _exchangeClient.InitialiseExchange(0);

            if (dEnableDisableRequest == null)
            {
                dEnableDisableRequest = new SortedDictionary <int, EnableDisableThreadData>();
            }

            _tmrRequest          = new System.Timers.Timer(Int32.Parse(ConfigManager.Read("MachineConfigInterval")) * 1000);
            _tmrRequest.Elapsed += new ElapsedEventHandler(ProcessRequest);

            _thAckResponse = new ThreadDispatcher <EnableDisableThreadDataResponse>(1, "_thAckResponse");
            _thAckResponse.AddProcessThreadData(new ProcessThreadDataHandler <EnableDisableThreadDataResponse>(this.ProcessResponse));
            _thAckResponse.Initialize();

            _iExchangeAdmin = (IExchangeAdmin)_exchangeClient;
            ObjectStateNotifier.AddObserver(this);

            _tmrRequest.Start();
        }
        public static void Run()
        {
            // ExStart:ListExchangeServerMessages
            // Create instance of ExchangeClient class by giving credentials
            ExchangeClient client = new ExchangeClient("https://MachineName/exchange/Username", "username", "password", "domain");

            // Call ListMessages method to list messages info from Inbox
            ExchangeMessageInfoCollection msgCollection = client.ListMessages(client.MailboxInfo.InboxUri);

            // Loop through the collection to display the basic information
            foreach (ExchangeMessageInfo msgInfo in msgCollection)
            {
                Console.WriteLine("Subject: " + msgInfo.Subject);
                Console.WriteLine("From: " + msgInfo.From.ToString());
                Console.WriteLine("To: " + msgInfo.To.ToString());
                Console.WriteLine("Sent Date: " + msgInfo.Date.ToString());
                Console.WriteLine("Read?: " + msgInfo.IsRead.ToString());
                Console.WriteLine("Message ID: " + msgInfo.MessageId);
                Console.WriteLine("Unique URI: " + msgInfo.UniqueUri);
                Console.WriteLine("==================================");
            }
            // ExEnd:ListExchangeServerMessages
        }
Ejemplo n.º 36
0
        public async Task InitializeAsync()
        {
            var mockDbOptions = new Mock <IOptionsMonitor <DbOptions> >();

            mockDbOptions.Setup(x => x.CurrentValue).Returns(new DbOptions
            {
                ConnectionString         = AppTestSettings.Instance.TestDBConnectionString,
                DefaultBulkCopyBatchSize = AppTestSettings.Instance.DefaultBulkCopyBatchSize
            });

            var nasdaqLogger         = new Mock <ILogger <NasdaqParser> >();
            var exchangeClientLogger = new Mock <ILogger <ExchangeClient> >();

            // Setup dependencies
            ExchangeSyncRepo = new ExchangeSyncRepository(mockDbOptions.Object);

            string nasdaqDownloadUrl = (await ExchangeSyncRepo.GetSyncSettings()).Url;

            // Stub FTP so we use downloaded file from disk instead of every test run
            var stubFTPClient = new CachedNasdaqClient(nasdaqDownloadUrl);

            var exchangeClient = new ExchangeClient(
                ftpClient: stubFTPClient,
                parser: new NasdaqParser(nasdaqLogger.Object),
                logger: exchangeClientLogger.Object);

            var changesetFactory = new ExchangeSyncChangesetsFactory();

            ExchangeSync = new ExchangeSync(exchangeClient, ExchangeSyncRepo, changesetFactory, new Mock <ILogger <ExchangeSync> >().Object);
            SymbolRepo   = new SymbolRepository(mockDbOptions.Object);

            await ToggleSyncThreshold(false);

            await ExchangeSync.Sync();

            await ToggleSyncThreshold(true);
        }
        public RleaseGameCap()
        {
            _exchangeClient              = new ExchangeClient();
            _exchangeClient.MACEnDisAck += new _IExchangeClientEvents_MACEnDisAckEventHandler(_exchangeClient_MacEnable_DATA_ACK);
            _exchangeClient.InitialiseExchange(0);

            if (_requestCollection == null)
            {
                _requestCollection = new SortedDictionary <int, EnableMachineThreadData>();
            }

            if (m_SectorData == null)
            {
                m_SectorData = new Sector203Data();
            }

            if (oGameCappingBiz == null)
            {
                oGameCappingBiz = new GameCappingBiz();
            }

            if (_lstGameCapDetails == null)
            {
                _lstGameCapDetails = new List <GameCapDetails>();
            }

            _thRequest = new Thread(new ThreadStart(ProcessRequest));

            _thAckResponse = new ThreadDispatcher <EnableMachineThreadDataResponse>(1, "_thAckResponse_EnableMachine");
            _thAckResponse.AddProcessThreadData(new ProcessThreadDataHandler <EnableMachineThreadDataResponse>(this.ProcessResponse));
            _thAckResponse.Initialize();

            _iExchangeAdmin = (IExchangeAdmin)_exchangeClient;
            ObjectStateNotifier.AddObserver(this);

            _thRequest.Start();
        }
        private async Task <ExchangeClient> EnsureClientCreated()
        {
            // get or create DiscoveryContext
            DiscoveryContext disco = GetFromCache("DiscoveryContext") as DiscoveryContext;

            if (disco == null)
            {
                disco = await DiscoveryContext.CreateAsync();

                SaveInCache("DiscoveryContext", disco);
            }

            // obtain ResourceDiscoveryResult for Exchange
            string ServiceResourceId    = "https://outlook.office365.com";
            ResourceDiscoveryResult dcr = await disco.DiscoverResourceAsync(ServiceResourceId);

            SaveInCache("LastLoggedInUser", dcr.UserId);
            string clientId           = disco.AppIdentity.ClientId;
            string clientSecret       = disco.AppIdentity.ClientSecret;
            Uri    ServiceEndpointUri = new Uri("https://outlook.office365.com/ews/odata");

            // create ExchangeClient object with callback function for obtaining access token
            ExchangeClient exchangeClient = new ExchangeClient(ServiceEndpointUri, async() => {
                AuthenticationContext authContext = disco.AuthenticationContext;
                ClientCredential creds            = new ClientCredential(clientId, clientSecret);
                UserIdentifier userId             = new UserIdentifier(dcr.UserId, UserIdentifierType.UniqueId);
                // execute call across network to acquire access token
                AuthenticationResult authResult =
                    await authContext.AcquireTokenSilentAsync(ServiceResourceId, creds, userId);
                // return access token to caller as string value
                return(authResult.AccessToken);
            });

            // return new ExchangeClient to caller
            return(exchangeClient);
        }
Ejemplo n.º 39
0
        public static void Run()
        {
            try
            {
                // ExStart:SendEmailMessagesUsingExchangeServer
                // Create instance of ExchangeClient class by giving credentials
                ExchangeClient client = new ExchangeClient("https://MachineName/exchange/username", "username", "password", "domain");

                // Create instance of type MailMessage
                MailMessage msg = new MailMessage();
                msg.From     = "*****@*****.**";
                msg.To       = "recipient@ domain.com ";
                msg.Subject  = "Sending message from exchange server";
                msg.HtmlBody = "<h3>sending message from exchange server</h3>";

                // Send the message
                client.Send(msg);
                // ExEnd:SendEmailMessagesUsingExchangeServer
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
        }
        public static void Run()
        {
            try
            {
                // ExStart:ListMessagesFromDifferentFolders
                // Create instance of ExchangeClient class by giving credentials
                ExchangeClient client = new ExchangeClient("https://MachineName/exchange/Username", "username", "password", "domain");

                // Get folder URI
                string strFolderURI = string.Empty;
                strFolderURI = client.MailboxInfo.InboxUri;
                strFolderURI = client.MailboxInfo.DeletedItemsUri;
                strFolderURI = client.MailboxInfo.DraftsUri;
                strFolderURI = client.MailboxInfo.SentItemsUri;

                // get list of messages from the specified folder
                ExchangeMessageInfoCollection msgCollection = client.ListMessages(strFolderURI);
                // ExEnd:ListMessagesFromDifferentFolders
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
        }
Ejemplo n.º 41
0
        public static void Run()
        {
            // ExStart:DeleteMessagesFromExchangeServer
            // Create instance of IEWSClient class by giving credentials
            string mailboxURI = "https://Ex2003/exchange/administrator"; // WebDAV

            string username = "******";
            string password = "******";
            string domain   = "domain.local";

            Console.WriteLine("Connecting to Exchange Server....");
            NetworkCredential credential = new NetworkCredential(username, password, domain);
            ExchangeClient    client     = new ExchangeClient(mailboxURI, credential);

            ExchangeMailboxInfo mailboxInfo = client.GetMailboxInfo();

            // List all messages from Inbox folder
            Console.WriteLine("Listing all messages from Inbox....");
            ExchangeMessageInfoCollection msgInfoColl = client.ListMessages(mailboxInfo.InboxUri);

            foreach (ExchangeMessageInfo msgInfo in msgInfoColl)
            {
                // Delete message based on some criteria
                if (msgInfo.Subject != null &&
                    msgInfo.Subject.ToLower().Contains("delete") == true)
                {
                    client.DeleteMessage(msgInfo.UniqueUri);
                    Console.WriteLine("Message deleted...." + msgInfo.Subject);
                }
                else
                {
                    // Do something else
                }
            }
            // ExEnd:DeleteMessagesFromExchangeServer
        }
        private async Task <ExchangeClient> EnsureClientCreated()
        {
            DiscoveryContext disco = GetFromCache("DiscoveryContext") as DiscoveryContext;

            if (disco == null)
            {
                disco = await DiscoveryContext.CreateAsync();

                SaveInCache("DiscoveryContext", disco);
            }

            string ServiceResourceId  = "https://outlook.office365.com";
            Uri    ServiceEndpointUri = new Uri("https://outlook.office365.com/ews/odata");


            var dcr = await disco.DiscoverResourceAsync(ServiceResourceId);

            string clientId     = disco.AppIdentity.ClientId;
            string clientSecret = disco.AppIdentity.ClientSecret;

            SaveInCache("LastLoggedInUser", dcr.UserId);


            ExchangeClient exClient = new ExchangeClient(ServiceEndpointUri, async() => {
                // set it up
                ClientCredential creds            = new ClientCredential(clientId, clientSecret);
                UserIdentifier userId             = new UserIdentifier(dcr.UserId, UserIdentifierType.UniqueId);
                AuthenticationContext authContext = disco.AuthenticationContext;
                // call across network
                AuthenticationResult authResult = await authContext.AcquireTokenSilentAsync(ServiceResourceId, creds, userId);
                // return access token
                return(authResult.AccessToken);
            });

            return(exClient);
        }
        public void Dispose()
        {
            if (_disposed)
            {
                return;
            }
            ObjectStateNotifier.RemoveObserver(this);

            try
            {
                var i = Marshal.ReleaseComObject(_exchangeClient);
                Thread.Sleep(10);

                while (i > 0)
                {
                    LogManager.WriteLog("Number of objects in _exchangeClient = " + i, LogManager.enumLogLevel.Info);
                    i = Marshal.ReleaseComObject(_exchangeClient);
                }
                LogManager.WriteLog("|=> _exchangeClient was released successfully.", LogManager.enumLogLevel.Info);

                i = Marshal.ReleaseComObject(_iExchangeAdmin);
                Thread.Sleep(10);
                while (i > 0)
                {
                    LogManager.WriteLog("Number of objects in _iExchangeAdmin = " + i, LogManager.enumLogLevel.Info);
                    i = Marshal.ReleaseComObject(_iExchangeAdmin);
                }
                LogManager.WriteLog("|=> _iExchangeAdmin was released successfully.", LogManager.enumLogLevel.Info);
            }
            catch
            { }

            _iExchangeAdmin = null;
            _exchangeClient = null;
            GC.SuppressFinalize(this);
        }
Ejemplo n.º 44
0
        public static void Run()
        {
            try
            {
                // Create instance of ExchangeClient class by giving credentials
                ExchangeClient   client  = new ExchangeClient("http://ex07sp1/exchange/Administrator", "user", "pwd", "domain");
                MailQueryBuilder builder = new MailQueryBuilder();

                // ExStart:CombineQueriesWithAND
                // Emails from specific host, get all emails that arrived before today and all emails that arrived since 7 days ago
                builder.From.Contains("SpecificHost.com");
                builder.InternalDate.Before(DateTime.Now);
                builder.InternalDate.Since(DateTime.Now.AddDays(-7));
                // ExEnd:CombineQueriesWithAND

                MailQuery query = builder.GetQuery();
                ExchangeMessageInfoCollection messages = client.ListMessages(client.MailboxInfo.InboxUri, query, false);
                Console.WriteLine("Exchange: " + messages.Count + " message(s) found.");

                builder = new MailQueryBuilder();

                // ExStart:CombiningQueriesWithOR
                // Specify OR condition
                builder.Or(builder.Subject.Contains("test"), builder.From.Contains("*****@*****.**"));
                // ExEnd:CombiningQueriesWithOR

                // Build the query and Get list of messages
                query    = builder.GetQuery();
                messages = client.ListMessages(client.MailboxInfo.InboxUri, query, false);
                Console.WriteLine("Exchange: " + messages.Count + " message(s) found.");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 45
0
 public void OrderCancelAsync(Order order)
 {
     ExchangeClient.OrderCancelAsync(order);
 }
Ejemplo n.º 46
0
        public void ExchangeTest()
        {
            /*
             * string serverAddress = "HY1MAAEX001.HE1.LOCAL";
             * string title = "Test";
             * string emailAccount = "WindMIData";
             * string destinationFolder = @"C:\PipelineData\0.EmailFolder";
             */
            //string emailPassword = "";
            string emailServerType = "EXCHANGE";

            //SSL = "Yes";
            //port = 993;


            ExchangeClient client = null;

            if (emailServerType.ToUpper() == "EXCHANGE")
            {
                //client = new ExchangeClient("http://hy1maaex001.he1.local/owa/winmi0", "winmi0", emailPassword, "HE1");
                //client = new ExchangeClient("http://hy1maaex001.he1.local/exchange/goldt1", "goldt1", "Hannah321", "HE1");
                //client = new ExchangeClient("http://hy1maaex001.he1.local/owa/goldt1", "goldt1", "Hannah321", "HE1");
                //https://imail.bpglobal.com/exchange/europeasiarawindata/inbox/
//                client = new ExchangeClient("https://imail.bpglobal.com/exchange/europeasiarawindata/inbox", "sheam6", "p", "BP1");


                // start
                String strServerName = "imail.bpglobal.com";
                String strDomain     = "bp1";
                String strUserID     = "sheam6";
                String strPassword   = "******";
                //String strUserName = "******";
                String strUserName = "******";
                String term        = "BP";

                /*
                 * Console.Write("Server (eg imail.bpglobal.com):");
                 * strServerName = Console.ReadLine();
                 *
                 * Console.Write("Domain (eg bp1):");
                 * strDomain = Console.ReadLine();
                 *
                 * Console.Write("UserID (eg sheam6):");
                 * strUserID = Console.ReadLine();
                 *
                 * Console.Write("Password:"******"Mailbox (eg mike.sheard or europeasiarawindata):");
                 * strUserName = Console.ReadLine();
                 *
                 */
                // Create our destination URL.
                String strURL = "https://" + strServerName + "/exchange/" + strUserName + "/InBox"; // was WindData

                //strURL = "https://imail.bpglobal.com/exchange/europeasiarawindata/InBox/";


                // find unread emails

                string QUERY = "<?xml version=\"1.0\"?>"
                               + "<g:searchrequest xmlns:g=\"DAV:\">"
                               + "<g:sql>SELECT \"urn:schemas:httpmail:subject\", "
                               + "\"urn:schemas:httpmail:from\", \"DAV:displayname\", "
                               + "\"urn:schemas:httpmail:textdescription\" "
                               + "FROM SCOPE('deep traversal of \"" + strURL + "\"') "
                               + "WHERE \"DAV:ishidden\" = False AND \"DAV:isfolder\" = False "
                               + "AND \"urn:schemas:httpmail:read\" = False "
                               //+ "AND \"urn:schemas:httpmail:hasattachment\" = False "
                               //+ "\"DAV:hasattachment\"=True "
                               //////////+ "AND \"urn:schemas:httpmail:subject\" LIKE '%" + term + "%' "
                               + "ORDER BY \"urn:schemas:httpmail:date\" DESC"
                               + "</g:sql></g:searchrequest>";

                System.Net.HttpWebResponse Response = null;
                System.IO.Stream           RequestStream;
                System.IO.Stream           ResponseStream;
                System.Xml.XmlDocument     ResponseXmlDoc;
                System.Xml.XmlNodeList     SubjectNodeList;
                System.Xml.XmlNodeList     SenderNodeList;
                System.Xml.XmlNodeList     BodyNodeList;
                System.Xml.XmlNodeList     URLNodeList;

                Console.WriteLine("Mailbox URL: " + strURL);

                HttpWebRequest Request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(strURL);
                Request.CookieContainer = new CookieContainer();

                Request.CookieContainer.Add(AuthenticateSecureOWA(strServerName, strDomain, strUserID, strPassword));

                // Ori
                //Request.Credentials = new System.Net.NetworkCredential( strUserName, strPassword, strDomain);
                Request.Credentials = new System.Net.NetworkCredential(strUserID, strPassword, strDomain);

                //Console.WriteLine(String.Format("Got cookies for: {0}\\{1}", strDomain, strUserName));
                Console.WriteLine(String.Format("Got cookies for: {0}\\{1}", strDomain, strUserID));

                Request.Method            = "SEARCH";
                Request.ContentType       = "text/xml";
                Request.KeepAlive         = true;
                Request.AllowAutoRedirect = false;

                Byte[] bytes = System.Text.Encoding.UTF8.GetBytes(QUERY);
                Request.Timeout       = 30000;
                Request.ContentLength = bytes.Length;
                RequestStream         = Request.GetRequestStream();
                RequestStream.Write(bytes, 0, bytes.Length);
                RequestStream.Close();
                Request.Headers.Add("Translate", "F");
                try
                {
                    Response       = (System.Net.HttpWebResponse)Request.GetResponse();
                    ResponseStream = Response.GetResponseStream();
                    //' Create the XmlDocument object from the XML response stream.
                    ResponseXmlDoc = new System.Xml.XmlDocument();
                    ResponseXmlDoc.Load(ResponseStream);
                    SubjectNodeList = ResponseXmlDoc.GetElementsByTagName("d:subject");
                    SenderNodeList  = ResponseXmlDoc.GetElementsByTagName("d:from");
                    URLNodeList     = ResponseXmlDoc.GetElementsByTagName("a:href");
                    BodyNodeList    = ResponseXmlDoc.GetElementsByTagName("d:textdescription");

                    int i = 1;
                    foreach (XmlElement subject in SubjectNodeList)
                    {
                        Console.WriteLine("WebDav result - Subject: " + subject.InnerText);
                        if (i++ >= 3)
                        {
                            break; // proved our point
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }

                // read attachment
                enumAttachments("https://imail.bpglobal.com/exchange/mike.sheard/Inbox/FW:%20Emailing:%20Release.zip.EML", strUserName, strPassword, strDomain);


                // end

                // try to read a list of attachments
                // Working on this bit: GetAttachmentsListXML(strServerName, "https://imail.bpglobal.com/exchange/mike.sheard/WindData/Fuxin%20Data-32.EML", "sheam6", "p", "bp1");


                Console.WriteLine("\n\nAspose Test\n\nUsing URL:" + strURL);

                //client = new ExchangeClient(strURL, strUserName, strPassword, strDomain);
                // new code goes here
                client = new ExchangeClient(strURL, strUserID, strPassword, strDomain);

                client.CookieContainer = new CookieContainer();
                client.CookieContainer.Add(AuthenticateSecureOWA(strServerName, strDomain, strUserID, strPassword));

                // Aspose client now
                //client = new ExchangeClient("https://imail.bpglobal.com/exchange/mike.sheard/inbox/", "sheam6", "p", "BP1");


                //client = new ExchangeClient("https://imail.bpglobal.com/exchange/mike.sheard/inbox/", Request.Credentials);
            }

            try
            {
                //query mailbox
                ExchangeMailboxInfo mailbox = client.GetMailboxInfo();
                //list messages in the Inbox
                ExchangeMessageInfoCollection messages = client.ListMessages(mailbox.InboxUri, false);

                int i = 1;
                foreach (ExchangeMessageInfo info in messages)
                {
                    //save the message locally
                    //client.SaveMessage(info.UniqueUri, info.Subject + ".eml");
                    Console.WriteLine("Aspose result - subject: " + info.Subject);
                    if (i++ >= 10)
                    {
                        break; // proved our point
                    }
                }
            }
            catch (ExchangeException ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
                Console.ReadLine();
            }
        }
        private async void btnGetMyContacts_Click(object sender, RoutedEventArgs e)
        {
            setLoadingString("Loading....");
            clearAllLists();
            if (AppCapabilities == null)
            {
                await getAppCapabilities();
            }
            var    contactsClient = ExchangeClient.ensureOutlookClientCreated(AppCapabilities, "Contacts");
            string fileAction     = FileParse.readFileAction(SettingsHelper.ContactsFilePath);

            if (fileAction == "ADD")
            {
                setLoadingString("Adding Contacts....");
                await ContactsOperations.addContacts(contactsClient, FileParse.readContact());

                var myContacts = await ContactsOperations.getContacts(contactsClient);

                foreach (var myContact in myContacts)
                {
                    Contacts.Add(new MyContact {
                        Name = myContact.DisplayName
                    });
                }
            }
            else if (fileAction == "UPDATE")
            {
                setLoadingString("Updating Contacts....");
                var fileContacts = FileParse.readContact();
                foreach (var fileContact in fileContacts)
                {
                    var contact = await ContactsOperations.getContactByGivenNameAndSurname(contactsClient, fileContact);

                    await ContactsOperations.updateContact(contactsClient, contact.Id, fileContact);
                }
                var myContacts = await ContactsOperations.getContacts(contactsClient);

                foreach (var myContact in myContacts)
                {
                    Contacts.Add(new MyContact {
                        Name = myContact.DisplayName
                    });
                }
            }
            else if (fileAction == "DELETE")
            {
                setLoadingString("Deleting Contacts....");
                var fileContacts = FileParse.readContact();
                foreach (var fileContact in fileContacts)
                {
                    var contact = await ContactsOperations.getContactByGivenNameAndSurname(contactsClient, fileContact);

                    await ContactsOperations.deleteContact(contactsClient, contact.Id);
                }
                var myContacts = await ContactsOperations.getContacts(contactsClient);

                foreach (var myContact in myContacts)
                {
                    Contacts.Add(new MyContact {
                        Name = myContact.DisplayName
                    });
                }
            }
            setLoadingString("");
        }
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            if (_disposed) return;

            try
            {
                Marshal.ReleaseComObject(_exchangeClient);
                Marshal.ReleaseComObject(_iExchangeAdmin);
            }
            catch
            { }

            _iExchangeAdmin = null;
            _exchangeClient = null;
            GC.SuppressFinalize(this);
        }
        public void Dispose()
        {
            if (_disposed) return;
            ObjectStateNotifier.RemoveObserver(this);

            try
            {
                var i = Marshal.ReleaseComObject(_exchangeClient);
                Thread.Sleep(10);
                while (i > 0)
                {
                    LogManager.WriteLog("Number of objects in _exchangeClient = " + i, LogManager.enumLogLevel.Info);
                    i = Marshal.ReleaseComObject(_exchangeClient);
                }
                LogManager.WriteLog("|=> _exchangeClient was released successfully.", LogManager.enumLogLevel.Info);

                i = Marshal.ReleaseComObject(_iExchangeAdmin);
                Thread.Sleep(10);
                while (i > 0)
                {
                    LogManager.WriteLog("Number of objects in _iExchangeAdmin = " + i, LogManager.enumLogLevel.Info);
                    i = Marshal.ReleaseComObject(_iExchangeAdmin);
                }
                LogManager.WriteLog("|=> _iExchangeAdmin was released successfully.", LogManager.enumLogLevel.Info);
            }
            catch
            { }

            _iExchangeAdmin = null;
            _exchangeClient = null;
            GC.SuppressFinalize(this);
        }
        private async void btnGetMyEvents_Click(object sender, RoutedEventArgs e)
        {
            setLoadingString("Loading....");
            clearAllLists();
            if (AppCapabilities == null)
            {
                await getAppCapabilities();
            }
            var    calendarClient = ExchangeClient.ensureOutlookClientCreated(AppCapabilities, "Calendar");
            string fileAction     = FileParse.readFileAction(SettingsHelper.EventsFilePath);

            if (fileAction == "ADD")
            {
                setLoadingString("Adding Events....");
                await CalendarOperations.addEvents(calendarClient, FileParse.readEvents());

                var myEvents = await CalendarOperations.getEvents(calendarClient);

                foreach (var myEvent in myEvents)
                {
                    Events.Add(new MyEvent {
                        Subject = myEvent.Subject
                    });
                }
            }
            else if (fileAction == "UPDATE")
            {
                setLoadingString("Updating Events....");
                var fileEvents = FileParse.readEvents();
                foreach (var fileEvent in fileEvents)
                {
                    var evnt = await CalendarOperations.getEventBySubject(calendarClient, fileEvent);

                    await CalendarOperations.updateEvent(calendarClient, evnt.Id, fileEvent);
                }
                var myEvents = await CalendarOperations.getEvents(calendarClient);

                foreach (var myEvent in myEvents)
                {
                    Events.Add(new MyEvent {
                        Subject = myEvent.Subject
                    });
                }
            }
            else if (fileAction == "DELETE")
            {
                setLoadingString("Deleting Events....");
                var fileEvents = FileParse.readEvents();
                foreach (var fileEvent in fileEvents)
                {
                    var evnt = await CalendarOperations.getEventBySubject(calendarClient, fileEvent);

                    await CalendarOperations.deleteEvent(calendarClient, evnt.Id);
                }
                var myEvents = await CalendarOperations.getEvents(calendarClient);

                foreach (var myEvent in myEvents)
                {
                    Events.Add(new MyEvent {
                        Subject = myEvent.Subject
                    });
                }
            }
            setLoadingString("");
        }
Ejemplo n.º 51
0
        public void Dispose()
        {
            if (_disposed) return;
            ObjectStateNotifier.RemoveObserver(this);

            try
            {
                Releaseobject(_exchangeClientSiteCode, "_exchangeClientSiteCode");
                Releaseobject(_exchangeClientTITOEnDis, "_exchangeClientTITOEnDis");
                Releaseobject(_exchangeClientTITOEXP, "_exchangeClientTITOEXP");

                Releaseobject(_iExchangeAdminSiteCode, "_iExchangeAdminSiteCode");
                Releaseobject(_iExchangeAdminTITOEnDis, "_iExchangeAdminTITOEnDis");
                Releaseobject(_iExchangeAdminTITOEXP, "_iExchangeAdminTITOEXP");

                LogManager.WriteLog("Dispose | All Objects were released successfully.", LogManager.enumLogLevel.Info);
            }
            catch
            { }

            _exchangeClientSiteCode = null;
            _exchangeClientTITOEnDis = null;
            _exchangeClientTITOEXP = null;

            _iExchangeAdminSiteCode = null;
            _iExchangeAdminTITOEnDis = null;
            _iExchangeAdminTITOEXP = null;

            GC.SuppressFinalize(this);
        }
        public RleaseGameCap()
        {
            _exchangeClient = new ExchangeClient();
            _exchangeClient.MACEnDisAck += new _IExchangeClientEvents_MACEnDisAckEventHandler(_exchangeClient_MacEnable_DATA_ACK);
            _exchangeClient.InitialiseExchange(0);

            if (_requestCollection == null)
                _requestCollection = new SortedDictionary<int, EnableMachineThreadData>();

            if (m_SectorData == null)
                m_SectorData = new Sector203Data();
            
            if(oGameCappingBiz == null)
                oGameCappingBiz= new GameCappingBiz();
            
            if (_lstGameCapDetails == null)
                _lstGameCapDetails = new List<GameCapDetails>();
            
            _thRequest = new Thread(new ThreadStart(ProcessRequest));

            _thAckResponse = new ThreadDispatcher<EnableMachineThreadDataResponse>(1, "_thAckResponse_EnableMachine");
            _thAckResponse.AddProcessThreadData(new ProcessThreadDataHandler<EnableMachineThreadDataResponse>(this.ProcessResponse));
            _thAckResponse.Initialize();

            _iExchangeAdmin = (IExchangeAdmin)_exchangeClient;
            ObjectStateNotifier.AddObserver(this);

            _thRequest.Start();
        }
        //
        public int EnableMachineFromUI(int installationNo)
        {
#if DEBUG
            //System.Diagnostics.Stopwatch watchobj = new System.Diagnostics.Stopwatch();
            //watchobj.Start();
            //LogManager.WriteLog("EnableMachineFromUI | " + "ExchangeClient Started at : " + DateTime.Now.ToString() + " for Installation- " + installationNo.ToString(), LogManager.enumLogLevel.Info);
#endif
            ExchangeClient _ExchangeClient_EnableMachineFromUI = new ExchangeClient();
#if DEBUG

            //watchobj.Stop();
            //LogManager.WriteLog("EnableMachineFromUI | " + "ExchangeClient Ended at : " + DateTime.Now.ToString() + " for Installation- " + installationNo.ToString(), LogManager.enumLogLevel.Info);
            //LogManager.WriteLog("EnableMachineFromUI | " + "ExchangeClient Time Taken : " + watchobj.Elapsed.ToString() + " for Installation- " + installationNo.ToString(), LogManager.enumLogLevel.Info);
#endif
            try
            {
#if DEBUG
                //System.Diagnostics.Stopwatch watchinit = new System.Diagnostics.Stopwatch();
                //watchinit.Start();
                LogManager.WriteLog("EnableMachineFromUI | " + "InitialiseExchange Started at : " + DateTime.Now.ToString() + " for Installation- " + installationNo.ToString(), LogManager.enumLogLevel.Info);
#endif
                _ExchangeClient_EnableMachineFromUI.InitialiseExchange(0);
#if DEBUG

                //watchinit.Stop();
                LogManager.WriteLog("EnableMachineFromUI | " + "InitialiseExchange Ended at : " + DateTime.Now.ToString() + " for Installation- " + installationNo.ToString(), LogManager.enumLogLevel.Info);
                //LogManager.WriteLog("EnableMachineFromUI | " + "InitialiseExchange Time Taken : " + watchobj.Elapsed.ToString() + " for Installation- " + installationNo.ToString(), LogManager.enumLogLevel.Info);
#endif

#if DEBUG
                //System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
                //watch.Start();
                LogManager.WriteLog("EnableMachineFromUI | " + "EnableDisableMachine Started at : " + DateTime.Now.ToString() + " for Installation- " + installationNo.ToString(), LogManager.enumLogLevel.Info);
#endif
                int nReturn = -5;
                nReturn = _ExchangeClient_EnableMachineFromUI.EnableDisableMachine(2, installationNo);
#if DEBUG

                //watch.Stop();
                LogManager.WriteLog("EnableMachineFromUI | " + "EnableDisableMachine Ended at : " + DateTime.Now.ToString() + " for Installation- " + installationNo.ToString(), LogManager.enumLogLevel.Info);
                //LogManager.WriteLog("EnableMachineFromUI | " + "EnableDisableMachine Time Taken : " + watch.Elapsed.ToString() + " for Installation- " + installationNo.ToString(), LogManager.enumLogLevel.Info);
#endif
                return nReturn;
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("EnableMachineFromUI Failed for Installation:" + installationNo.ToString(), LogManager.enumLogLevel.Info);
                ExceptionManager.Publish(ex);
                return -1;
            }
            finally
            {
                var i = Marshal.ReleaseComObject(_ExchangeClient_EnableMachineFromUI);
                while (i > 0)
                {
                    LogManager.WriteLog("[EnableMachineFromUI]Number of objects in _exchangeClient = " + i, LogManager.enumLogLevel.Info);
                    i = Marshal.ReleaseComObject(_ExchangeClient_EnableMachineFromUI);
                }
                LogManager.WriteLog("|=>[EnableMachineFromUI] _exchangeClient was released successfully for Installation: " + installationNo.ToString(), LogManager.enumLogLevel.Info);
            }
        }
Ejemplo n.º 54
0
        public static void Run()
        {
            try
            {
                // Create instance of ExchangeClient class by giving credentials
                ExchangeClient client = new ExchangeClient("http://ex07sp1/exchange/Administrator", "user", "pwd", "domain");

                // ExStart:GetEmailsWithTodayDate
                // Emails that arrived today
                MailQueryBuilder builder = new MailQueryBuilder();
                builder.InternalDate.On(DateTime.Now);
                // ExEnd:GetEmailsWithTodayDate

                // Build the query and Get list of messages
                MailQuery query = builder.GetQuery();
                ExchangeMessageInfoCollection messages = client.ListMessages(client.MailboxInfo.InboxUri, query, false);
                Console.WriteLine("Exchange: " + messages.Count + " message(s) found.");

                builder = new MailQueryBuilder();

                // ExStart:GetEmailsOverDateRange
                // Emails that arrived in last 7 days
                builder.InternalDate.Before(DateTime.Now);
                builder.InternalDate.Since(DateTime.Now.AddDays(-7));
                // ExEnd:GetEmailsOverDateRange

                // Build the query and Get list of messages
                query    = builder.GetQuery();
                messages = client.ListMessages(client.MailboxInfo.InboxUri, query, false);
                Console.WriteLine("Exchange: " + messages.Count + " message(s) found.");

                builder = new MailQueryBuilder();

                // ExStart:GetSpecificSenderEmails
                // Get emails from specific sender
                builder.From.Contains("[email protected]");
                // ExEnd:GetSpecificSenderEmails

                // Build the query and Get list of messages
                query    = builder.GetQuery();
                messages = client.ListMessages(client.MailboxInfo.InboxUri, query, false);
                Console.WriteLine("Exchange: " + messages.Count + " message(s) found.");

                builder = new MailQueryBuilder();

                // ExStart:GetSpecificDomainEmails
                // Get emails from specific domain
                builder.From.Contains("SpecificHost.com");
                // ExEnd:GetSpecificDomainEmails

                // Build the query and Get list of messages
                query    = builder.GetQuery();
                messages = client.ListMessages(client.MailboxInfo.InboxUri, query, false);
                Console.WriteLine("Exchange: " + messages.Count + " message(s) found.");

                builder = new MailQueryBuilder();

                // ExStart:GetSpecificRecipientEmails
                // Get emails sent to specific recipient
                builder.To.Contains("recipient");
                // ExEnd:GetSpecificRecipientEmails

                // Build the query and Get list of messages
                query    = builder.GetQuery();
                messages = client.ListMessages(client.MailboxInfo.InboxUri, query, false);
                Console.WriteLine("Exchange: " + messages.Count + " message(s) found.");

                // ExStart:GetSpecificMessageIdEmail
                // Get email with specific MessageId
                ExchangeQueryBuilder builder1 = new ExchangeQueryBuilder();
                builder1.MessageId.Equals("MessageID");
                // ExEnd:GetSpecificMessageIdEmail

                // Build the query and Get list of messages
                query    = builder1.GetQuery();
                messages = client.ListMessages(client.MailboxInfo.InboxUri, query, false);
                Console.WriteLine("Exchange: " + messages.Count + " message(s) found.");

                // ExStart:GetMailDeliveryNotifications
                // Get Mail Delivery Notifications
                builder1 = new ExchangeQueryBuilder();
                builder1.ContentClass.Equals(ContentClassType.MDN.ToString());
                // ExEnd:GetMailDeliveryNotifications

                // Build the query and Get list of messages
                query    = builder1.GetQuery();
                messages = client.ListMessages(client.MailboxInfo.InboxUri, query, false);
                Console.WriteLine("Exchange: " + messages.Count + " message(s) found.");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 55
0
 public DefaultHandler(ExchangeClient client)
     : base(client)
 {
 }
Ejemplo n.º 56
0
        private void HandlerKickClient(KickClient kickClient)
        {
            ExchangeClient client = endpoint as ExchangeClient;

            client.Kick(kickClient.Reason);
        }
Ejemplo n.º 57
0
        private void HandlerHandSnakeResp(HandSnakeResp resp)
        {
            ExchangeClient client = endpoint as ExchangeClient;

            client.HandlerHandSnake(resp);
        }
Ejemplo n.º 58
0
 public static async Task EnsureClientCreated(Context context) {
   Authenticator authenticator = new Authenticator(context);
   var authInfo = await authenticator.AuthenticateAsync(ExchangeResourceId);
   userId = authInfo.IdToken.UPN;
   exchangeClient = new ExchangeClient(new Uri(ExchangeServiceRoot), authInfo.GetAccessToken);
 }
Ejemplo n.º 59
0
        public void GetEmail()
        {
            bool connected = false;

            Utils.WriteToLogStart(processName);

            if (Utils.GetKeyFromConfig("SkipSharepoint") != "True")
            {
                DocLibHelper dlh = new DocLibHelper();

                Utils.WriteToLog(Utils.LogSeverity.Info, processName, "About to get sharepoint list");

                System.Xml.XmlNode emailDetails = dlh.GetList(Utils.GetKeyFromConfig("ApplicationConfigurationSite"), Utils.GetKeyFromConfig("EmailReaderList"));

                Utils.WriteToLog(Utils.LogSeverity.Info, processName, "Finished getting sharepoint list");

                // null return means we had a problem contacting sharepoint
                if (emailDetails != null)
                {
                    Utils.WriteToLog(Utils.LogSeverity.Info, processName, "About to read sharepoint list");

                    // copy the xml structure to a dataset
                    DataSet       objDataSet    = new DataSet();
                    XmlNodeReader ObjXmlreadrer = new XmlNodeReader(emailDetails);
                    objDataSet.ReadXml(ObjXmlreadrer);

                    foreach (DataRow row in objDataSet.Tables[1].Rows)
                    {
                        #region assign dataset to vars
                        title             = row["ows_Title"].ToString();
                        emailServerType   = row["ows_EmailServerType"].ToString();
                        serverAddress     = row["ows_ServerAddress"].ToString();
                        emailAccount      = row["ows_EmailAccount"].ToString();
                        emailPassword     = row["ows_EmailPassword"].ToString();
                        destinationFolder = row["ows_DestinationFolder"].ToString();
                        SSL = row["ows_SSL"].ToString();
                        if (row["ows_Port"].ToString() != "")
                        {
                            port = int.Parse(row["ows_Port"].ToString());
                        }
                        immediateExcelExtract = row["ows_ImmediateExcelExtract"].ToString();
                        enabled = row["ows_Enabled"].ToString();
                        domain  = row["ows_Domain"].ToString();
                        #endregion


                        if (int.Parse(enabled) == 1)
                        {
                            Utils.WriteToLog(Utils.LogSeverity.Info, processName, "Init Exchange mailbox");

                            // Argh, the class ExchangeClient does not extend ProtocolClient, like the others...
                            // So have to deal with with this type separately
                            if (emailServerType.ToUpper() == "EXCHANGE")
                            {
                                ExchangeClient exchangeClient = null;

                                exchangeClient = new ExchangeClient(serverAddress, emailAccount, emailPassword, "HE1");
                                readInbox(exchangeClient);
                            }
                            else
                            {
                                ProtocolClient client = null;

                                if (emailServerType.ToUpper() == "POP3")
                                {
                                    Utils.WriteToLog(Utils.LogSeverity.Info, processName, "Init POP3 mailbox");
                                    client = new Pop3Client();
                                }
                                else if (emailServerType.ToUpper() == "IMAP")
                                {
                                    Utils.WriteToLog(Utils.LogSeverity.Info, processName, "Init IMAP mailbox");
                                    client = new ImapClient();
                                }

                                Utils.WriteToLog(Utils.LogSeverity.Info, processName, "Connecting...");

                                connected = connect(client);

                                Utils.WriteToLog(Utils.LogSeverity.Info, processName, "Connected");

                                if (connected)
                                {
                                    Utils.WriteToLog(Utils.LogSeverity.Info, processName, "Reading mailbox...");

                                    readInbox(client);

                                    Utils.WriteToLog(Utils.LogSeverity.Info, processName, "Finished reading mailbox");
                                }
                            }
                        }
                    }
                }
                else
                {
                    Utils.WriteToLog(Utils.LogSeverity.Warning, processName, "Problem accessing SharePoint list");
                }
            }
            else
            {
                title             = "Test";
                emailServerType   = "IMAP";
                serverAddress     = "imap.gmail.com";
                emailAccount      = "*****@*****.**";
                emailPassword     = "******";
                destinationFolder = @"C:\PipelineData\0.EmailFolder";
                SSL  = "Yes";
                port = 993;

                ProtocolClient client = null;

                if (emailServerType.ToUpper() == "POP3")
                {
                    client = new Pop3Client();
                }
                else if (emailServerType.ToUpper() == "IMAP")
                {
                    client = new ImapClient();
                }

                connected = connect(client);

                if (connected)
                {
                    readInbox(client);
                }
            }

            Utils.WriteToLogFinish(processName);
        }