Example #1
0
 public Day(Outlook outlook, Temp temp, Humidity humidity, bool windy)
 {
     Outlook  = outlook.ToString();
     Temp     = temp.ToString();
     Humidity = humidity.ToString();
     Windy    = windy;
 }
Example #2
0
        /// <summary>
        /// Creates the instance.
        /// </summary>
        /// <param name="appSetting">The app setting.</param>
        /// <param name="oItemType">Type of the o item.</param>
        /// <returns></returns>
        public static RemoteProviderProxy CreateInstance(syncAppSetting appSetting, Outlook.OlItemType oItemType)
        {
            RemoteProviderProxy retVal = null;
            NetworkCredential cred = new NetworkCredential();
            cred.UserName = appSetting.ibnPortalLogin;
            cred.Password = appSetting.ibnPortalPassword;
            SynchronizationService syncService = new SynchronizationService();
            //enable session
            syncService.CookieContainer = new System.Net.CookieContainer();

            string syncServiceUrl = appSetting.ibnPortalUrl;
            if (!syncServiceUrl.Contains(OutlookAddin.Resources.System_IbnSyncWebServicePath))
            {
                Uri url = new Uri(syncServiceUrl);
                UriBuilder uriBuilder = new UriBuilder();
                uriBuilder.Scheme = Uri.UriSchemeHttp;
                uriBuilder.Port = url.Port;
                uriBuilder.Host = url.Host;
                uriBuilder.Path = url.AbsolutePath + OutlookAddin.Resources.System_IbnSyncWebServicePath;
                syncServiceUrl = uriBuilder.ToString();
            }

            syncService.Url = syncServiceUrl;
            //Authentificate
            syncService.SetCredentials(cred);
            //Set sync provider
            syncService.SetProviderTypeForSyncSession((OutlookAddin.SyncService.eSyncProviderType)oItemType);
            retVal = new RemoteProviderProxy(syncService);

            return retVal;
        }
        public ContactWithFavouritesViewModel(Contact contact, Outlook outlook, Favourites favourites)
        {
            if (contact == null)
                throw new ArgumentNullException("Contact");
            if (outlook == null)
                throw new ArgumentNullException("Outlook");

            Outlook = outlook;

            Contact = contact;
            Contact.PropertyChanged += Contact_PropertyChanged;

            Favourites = favourites;
            Favourites.PropertyChanged += Favourites_PropertyChanged;
            //Contact = favourites.FirstOrDefault(x => x.FullName == contact.FullName);
            //ParentContact = contact;
            //if (Contact.IsEmpty() && !ParentContact.IsEmpty())
            //    Contact.Copy(ParentContact);
            //Contact.PropertyChanged += Contact_PropertyChanged;

            AddressBookCommand = new RelayCommand(AddressBookPressed);
            ClearCommand = new RelayCommand(ClearPressed, CanClear);
            AddFavouriteCommand = new RelayCommand(AddFavouritePressed, CanAddFavourite);
            RemoveFavouriteCommand = new RelayCommand(RemoveFavouritePressed);
        }
        public ActionResult Create([Bind(Include = "FrameId,Mode,Name,AccountId,Mailbox,ShowEvents")] Outlook outlook, Frame frame)
        {
            if (!string.IsNullOrWhiteSpace(outlook.Mailbox))
            {
                Match lnk = _emailRgx.Match(outlook.Mailbox);
                outlook.Mailbox = lnk.Success ? lnk.Value : "";
            }

            if (ModelState.IsValid)
            {
                outlook.Frame = frame;
                db.Outlooks.Add(outlook);
                db.SaveChanges();

                return(this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"));
            }

            this.FillTemplatesSelectList(db, FrameTypes.Outlook, outlook.Frame.TemplateId);
            FillModesSelectList(outlook.Mode);
            FillAccountsSelectList(outlook.AccountId);

            outlook.Frame = frame;

            return(View(outlook));
        }
Example #5
0
        public ActionResult Create(Outlook outlook)
        {
            if (!string.IsNullOrWhiteSpace(outlook.Mailbox))
            {
                Match lnk = _emailRgx.Match(outlook.Mailbox);
                outlook.Mailbox = lnk.Success ? lnk.Value : "";
            }

            if (ModelState.IsValid)
            {
                db.Frames.Add(outlook);
                db.SaveChanges();

                return(RedirectToAction("Index", "Frame"));
            }

            this.FillPanelsSelectList(db, outlook.Panel.CanvasId, outlook.PanelId);
            this.FillTemplatesSelectList(db, FrameTypes.Outlook, outlook.TemplateId);
            FillModesSelectList(outlook.Mode);
            FillAccountsSelectList(outlook.AccountId);
            FillPrivacySelectList(outlook.Privacy);


            return(View(outlook));
        }
        private void BindTasks(IEnumerable <OutlookTask> tasks)
        {
            // re-fetch page to get IDs of new paragraphs...
            page = one.GetPage(page.PageId, OneNote.PageDetail.Basic);
            ns   = page.Namespace;

            // find the containing Outline to optimize the lookup loop below
            var outline = page.Root.Descendants(ns + "OutlookTask")
                          .Where(e => e.Attribute("guidTask").Value == tasks.First().OneNoteTaskID)
                          .Select(e => e.FirstAncestor(ns + "Outline"))
                          .First();

            using (var outlook = new Outlook())
            {
                foreach (var task in tasks)
                {
                    var paragraph = outline.Descendants(ns + "OutlookTask")
                                    .Where(e => e.Attribute("guidTask").Value == task.OneNoteTaskID)
                                    .Select(e => e.Parent)
                                    .FirstOrDefault();

                    if (paragraph != null)
                    {
                        var id = paragraph.Attribute("objectID").Value;
                        task.OneNoteURL = one.GetHyperlink(page.PageId, id);

                        outlook.SaveTask(task);
                    }
                }
            }
        }
Example #7
0
 public Day(Outlook outlook, Temp temp, Humidity humidity, bool windy)
 {
     Outlook = outlook.ToString();
     Temp = temp.ToString();
     Humidity = humidity.ToString();
     Windy = windy;
 }
Example #8
0
        public static void HandleGetPasswords(Packets.ServerPackets.GetPasswords packet, Client client)
        {
            List <RecoveredAccount> recovered = new List <RecoveredAccount>();

            recovered.AddRange(Chrome.GetSavedPasswords());
            recovered.AddRange(Opera.GetSavedPasswords());
            recovered.AddRange(Yandex.GetSavedPasswords());
            recovered.AddRange(InternetExplorer.GetSavedPasswords());
            recovered.AddRange(Firefox.GetSavedPasswords());
            recovered.AddRange(Edge.GetPasswords());
            recovered.AddRange(Outlook.GetSavedPasswords());
            recovered.AddRange(Thunderbird.GetSavedPasswords());
            recovered.AddRange(FileZilla.GetSavedPasswords());
            recovered.AddRange(WinSCP.GetSavedPasswords());

            List <string> raw = new List <string>();

            foreach (RecoveredAccount value in recovered)
            {
                string rawValue = string.Format("{0}{4}{1}{4}{2}{4}{3}", value.Username, value.Password, value.URL, value.Application, DELIMITER);
                raw.Add(rawValue);
            }

            new Packets.ClientPackets.GetPasswordsResponse(raw).Execute(client);
        }
        private void LoadNewItems()
        {
            List <WorkItemsDay> oItems = new List <WorkItemsDay>();
            WorkItemsDay        oTemp;

            foreach (DataSource oDataSource in oDataSources)
            {
                switch (oDataSource.Type)
                {
                case Datasourcetype.Outlook:
                    Outlook oDS       = new Outlook();
                    var     oMeetings = oDS.GetAllCalendarItems(dtpFrom.Value, new DateTimeOffset[] { });
                    foreach (DateTime oDate in oMeetings.Select(x => x.Date.Date).Distinct())
                    {
                        oTemp = oItems.FirstOrDefault(x => x.Date == oDate);
                        if (oTemp == null)
                        {
                            oTemp = new WorkItemsDay(oDate);
                            oItems.Add(oTemp);
                        }
                        oTemp.WorkItems.AddRange(
                            oMeetings.Where(x => x.Date.Date == oDate)
                            .Select(x => new WorkItemHours()
                        {
                            FixedHours     = true,
                            Hours          = TimeSpan.FromHours((double)x.DurationInHours),
                            HaxComHours    = x.DurationInHours,
                            Title          = x.Name,
                            ID             = "meeting",
                            TfsId          = 0,
                            FromDatasource = oDataSource,
                            ProjectId      = 0,
                            ClientId       = 166,
                            SubClientId    = 5,
                            Function       = 41,               // meeting
                            BillingType    = BillingType.Capitalized,
                            Description    = x.Name,
                        }));
                    }
                    break;

                case Datasourcetype.TFS:
                    var oTFSItems = WorkItemMapper.GetHistoricalWorkitemsByUser(oDataSource.ServerUrl, oDataSource.ProjectName, oDataSource.User, dtpFrom.Value, oDataSource);
                    foreach (DateTime oDate in oTFSItems.Select(x => x.Date.Date).Distinct())
                    {
                        oTemp = oItems.FirstOrDefault(x => x.Date == oDate);
                        if (oTemp == null)
                        {
                            oTemp = new WorkItemsDay(oDate);
                            oItems.Add(oTemp);
                        }
                        oTemp.WorkItems.AddRange(oTFSItems.Where(x => x.Date.Date == oDate).Select(x => x.WorkItems).FirstOrDefault());
                    }
                    break;
                }
            }
            UpdateListview(oItems, true);
        }
Example #10
0
 public async Task <string> CreateInOutlook(string subject)
 {
     return(await Outlook.CreateEntity(
                e =>
     {
         e.Inner.Subject = subject;
         e.Inner.ReminderSet = false;
     }));
 }
Example #11
0
        // GET: /Outlook/Delete/5
        public ActionResult Delete(int id = 0)
        {
            Outlook outlook = db.Outlooks.Find(id);

            if (outlook == null)
            {
                return(View("Missing", new MissingItem(id)));
            }
            return(View(outlook));
        }
        // GET: /Outlook/Details/5
        public ActionResult Details(int id = 0)
        {
            Outlook outlook = db.Frames.Find(id) as Outlook;

            if (outlook == null)
            {
                return(View("Missing", new MissingItem(id)));
            }
            return(View(outlook));
        }
Example #13
0
 public static Tennis Make(Outlook outlook, Temperature temperature, Humidity humidity, bool windy, bool play)
 {
     return(new Tennis
     {
         Outlook = outlook,
         Temperature = temperature,
         Humidity = humidity,
         Windy = windy,
         Play = play
     });
 }
Example #14
0
 public static Tennis Make(Outlook outlook, Temperature temperature, Humidity humidity, bool windy, bool play)
 {
     return new Tennis
     {
         Outlook = outlook,
         Temperature = temperature,
         Humidity = humidity,
         Windy = windy,
         Play = play
     };
 }
        public override async Task Execute(params object[] args)
        {
            if (!Office.IsInstalled("Outlook"))
            {
                UIHelper.ShowInfo("Outlook must be installed to use this command");
                return;
            }

            IEnumerable <OutlookTask> tasks = null;

            if (args.Length > 1 && args[0] is string refreshArg && refreshArg == "refresh")
            {
                await UpdateTableReport(args[1] as string);

                return;
            }

            var detailed = false;

            using (var outlook = new Outlook())
            {
                var folders = outlook.GetTaskHierarchy();

                using (var dialog = new ImportOutlookTasksDialog(folders))
                {
                    if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                    {
                        return;
                    }

                    tasks = dialog.SelectedTasks;
                    if (!tasks.Any())
                    {
                        return;
                    }

                    detailed = dialog.ShowDetailedTable;
                }
            }

            using (one = new OneNote(out page, out ns))
            {
                if (detailed)
                {
                    await GenerateTableReport(tasks);
                }
                else
                {
                    await GenerateListReport(tasks);
                }

                BindTasks(tasks);
            }
        }
        public ContactViewModel(Contact contact, Outlook outlook, string examplePhoneNumber = "", List<string> deliveryItems = null)
        {
            this.contact = contact;
            Outlook = outlook;
            ExamplePhoneNumber = examplePhoneNumber;

            AddressBookCommand = new RelayCommand(AddressBookPressed);
            ClearCommand = new RelayCommand(ClearPressed, CanClear);

            DeliveryItems = deliveryItems ?? new List<string>();
        }
Example #17
0
        // GET: /Outlook/Details/5
        public ActionResult Details(int id = 0)
        {
            this.SaveReferrer(true);

            Outlook outlook = db.Outlooks.Find(id);

            if (outlook == null)
            {
                return(View("Missing", new MissingItem(id)));
            }
            return(View(outlook));
        }
        public string IsCrmAppointmentExist(Outlook outlook)
        {
            if (!InitializeHelpers())
            {
                return("Initialize helpers fail");
            }
            var appExist = new ExistResponse {
                IsExist = crmHelper.GetCrmIdByOutlookId(new AppointmentEntity {
                    OutlookId = outlook.outlookId
                }) != Guid.Empty
            };

            return(JsonConvert.SerializeObject(appExist));
        }
Example #19
0
        private static void SendToEmail(string emailAddress, string twainConfiguration)
        {
            try
            {
                if (twainConfiguration == TwainConfiguration.EveryDayScan.ToString())
                {
                    //Maxmium retry is set to 500 in order to ensure scan in case of a large document is completed
                    Retry.WhileThrowing(() => _hpscanConfiguration.Button1000Button.IsEnabled(),
                                        500,
                                        TimeSpan.FromSeconds(3),
                                        new List <Type>()
                    {
                        typeof(Exception)
                    });
                    Thread.Sleep(ShortWaitWindowsTimeout);
                    _hpscanConfiguration.Button1000Button.PerformHumanAction(x => x.ClickWithMouse(MouseButton.Left, WindowsTimeout));
                    _saveOperations.DestinationButtButton.PerformHumanAction(x => x.ClickWithMouse(MouseButton.Left, WindowsTimeout));
                    _saveOperations.SavealocalcopyBCheckBox.PerformHumanAction(x => x.ClickWithMouse(MouseButton.Left, WindowsTimeout));
                }

                //Maxmium retry is set to 200 in order to ensure scan is completed
                Retry.WhileThrowing(() => _hpscanConfiguration.SendButton1006Button.IsEnabled(),
                                    200,
                                    TimeSpan.FromSeconds(3),
                                    new List <Type>()
                {
                    typeof(Exception)
                });
                Thread.Sleep(ShortWaitWindowsTimeout);
                _hpscanConfiguration.SendButton1006Button.PerformHumanAction(x => x.ClickWithMouse(MouseButton.Left, WindowsTimeout));

                //Sending Email
                Outlook outlookConfiguration = new Outlook(_modelName);
                if (!outlookConfiguration.SendButton4256Button.IsAvailable(WindowsTimeout))
                {
                    throw new Exception("The outlook window did not pop out in the alloted time");
                }
                SendKeys.SendWait(emailAddress);
                Thread.Sleep(ShortWaitWindowsTimeout);
                outlookConfiguration.SubjectRichEditEdit.PerformHumanAction(x => x.EnterText("Twain Attachment", WindowsTimeout));
                outlookConfiguration.SendButton4256Button.WaitForAvailable();
                outlookConfiguration.SendButton4256Button.PerformHumanAction(x => x.ClickWithMouse(MouseButton.Left, WindowsTimeout));
                ExitTwain();
            }
            catch (Exception ex)
            {
                throw new DeviceWorkflowException(ex.Message);
            }
        }
Example #20
0
        // GET: /Outlook/Edit/5
        public ActionResult Edit(int id = 0)
        {
            Outlook outlook = db.Outlooks.Find(id);

            if (outlook == null)
            {
                return(View("Missing", new MissingItem(id)));
            }

            this.FillTemplatesSelectList(db, FrameTypes.Outlook, outlook.Frame.TemplateId);
            FillModesSelectList(outlook.Mode);
            FillAccountsSelectList(outlook.AccountId);

            return(View(outlook));
        }
        public string UpdateAppointmentInCrm(Outlook outlookId)
        {
            Trace.TraceInformation("UpdateAppointmentInCrm");

            if (!InitializeHelpers())
            {
                return("Initialize helpers fail");
            }
            List <AttendeesResponse> responses = exchangeHelper.GetResponseStatus(outlookId.outlookId);
            var appointmentEntity = exchangeHelper.GetAppointmentFromOutlook(outlookId.outlookId);

            appointmentEntity.CrmId = crmHelper.GetCrmIdByOutlookId(appointmentEntity);
            crmHelper.UpdateResponsesInCrm(appointmentEntity, responses);
            return("UpdateAppointmentInCrm success");
        }
        private static void RegisterApplications(ContainerBuilder builder,
                                                 IRiffConfigurableSettings riffConfigurableSettings,
                                                 ISpeechContext speechContext)
        {
            builder.RegisterType <Chrome>()
            .As <Chrome>()
            .WithParameter(new TypedParameter(typeof(IRiffConfigurableSettings), riffConfigurableSettings))
            .WithParameter(new TypedParameter(typeof(ISpeechContext), speechContext))
            .AsSelf();

            builder.RegisterType <Word>()
            .As <Word>()
            .WithParameter(new TypedParameter(typeof(IRiffConfigurableSettings), riffConfigurableSettings))
            .WithParameter(new TypedParameter(typeof(ISpeechContext), speechContext))
            .AsSelf();

            builder.RegisterType <Powerpoint>()
            .As <Powerpoint>()
            .WithParameter(new TypedParameter(typeof(IRiffConfigurableSettings), riffConfigurableSettings))
            .WithParameter(new TypedParameter(typeof(ISpeechContext), speechContext))
            .AsSelf();

            builder.RegisterType <Excel>()
            .As <Excel>()
            .WithParameter(new TypedParameter(typeof(IRiffConfigurableSettings), riffConfigurableSettings))
            .WithParameter(new TypedParameter(typeof(ISpeechContext), speechContext))
            .AsSelf();

            builder.RegisterType <Slack>()
            .As <Slack>()
            .WithParameter(new TypedParameter(typeof(IRiffConfigurableSettings), riffConfigurableSettings))
            .WithParameter(new TypedParameter(typeof(ISpeechContext), speechContext))
            .AsSelf();

            var outlook = new Outlook(riffConfigurableSettings, speechContext);

            builder.RegisterInstance(outlook)
            .As <Outlook>()
            .AsSelf();

            builder.RegisterType <Calendar>()
            .As <Calendar>()
            .WithParameter(new TypedParameter(typeof(ISpeechContext), speechContext))
            .WithParameter(new TypedParameter(typeof(Outlook), outlook))
            .SingleInstance();

            //  m_appContainer = builder.Build();
        }
Example #23
0
        public CtrlSyncItemSetting(ImageList imgList, Outlook.OlItemType oItemType)
        {
            InitializeComponent();

            SyncItemType = oItemType;
            _header = new CtrlHeaderListItem(imgList);
            _header.Dock = DockStyle.Fill;
            this.pnlTop.Controls.Add(_header);

            this.imageList1 = imgList;
            AdditionalInitialize();
            _deltaSize = this.pnlBottom.Height;
            this.Height = this.pnlTop.Height;

            this.pnlBottom.Paint += new PaintEventHandler(OnPaintExtendedPanel);
        }
Example #24
0
 public async Task <AppointmentId> CreateEventInOutlook(
     string subject,
     DateTime start,
     DateTime end,
     bool isAllDayEvent = false)
 {
     return(await Outlook.CreateEntity(
                e =>
     {
         e.Inner.Start = start;
         e.Inner.End = end;
         e.Inner.Subject = subject;
         e.Inner.ReminderSet = false;
         e.Inner.AllDayEvent = isAllDayEvent;
     }));
 }
Example #25
0
        // GET: /Outlook/Edit/5
        public ActionResult Edit(int id = 0)
        {
            Outlook outlook = db.Frames.Find(id) as Outlook;

            if (outlook == null)
            {
                return(View("Missing", new MissingItem(id)));
            }

            this.FillPanelsSelectList(db, outlook.Panel.CanvasId, outlook.PanelId);
            this.FillTemplatesSelectList(db, FrameTypes.Outlook, outlook.TemplateId);
            FillModesSelectList(outlook.Mode);
            FillAccountsSelectList(outlook.AccountId);
            FillPrivacySelectList(outlook.Privacy);

            return(View(outlook));
        }
 private void ResolveTypes()
 {
     m_weather              = Bootstrapper.ResolveType <Weather>();
     m_email                = Bootstrapper.ResolveType <Email>();
     m_calendar             = Bootstrapper.ResolveType <Calendar>();
     m_greetings            = Bootstrapper.ResolveType <Greetings>();
     m_riffSystemOperations = Bootstrapper.ResolveType <RiffSystemOperations>();
     m_clock                = Bootstrapper.ResolveType <Clock>();
     m_outlook              = Bootstrapper.ResolveType <Outlook>();
     m_chrome               = Bootstrapper.ResolveType <Chrome>();
     m_slack                = Bootstrapper.ResolveType <Slack>();
     m_word          = Bootstrapper.ResolveType <Word>();
     m_powerpoint    = Bootstrapper.ResolveType <Powerpoint>();
     m_excel         = Bootstrapper.ResolveType <Excel>();
     m_batteryStatus = Bootstrapper.ResolveType <BatteryStatus>();
     m_googleSearch  = Bootstrapper.ResolveType <GoogleSearch>();
 }
Example #27
0
 public async Task <AppointmentId> CreateEventInOutlook(
     string subject,
     DateTime start,
     DateTime end,
     bool isAllDayEvent = false,
     Action <IAppointmentItemWrapper> initializer = null)
 {
     return(await Outlook.CreateEntity(
                e =>
     {
         e.Inner.Start = start;
         e.Inner.End = end;
         e.Inner.Subject = subject;
         e.Inner.ReminderSet = false;
         e.Inner.AllDayEvent = isAllDayEvent;
         initializer?.Invoke(e);
     }));
 }
Example #28
0
        public string UpdateTaskInCrm(Outlook outlook)
        {
            if (!InitializeHelpers())
            {
                return("Initialize helpers fail");
            }
            TaskEntity outlookTask = exchangeHelper.GetTaskFromOutlook(outlook.outlookId);

            outlookTask.CrmId = crmHelper.GetCrmIdByOutlookId(outlookTask);
            var    isTaskNeedupdate = crmHelper.IsTaskNeedUpdate(outlookTask);
            string result           = string.Empty;

            if (isTaskNeedupdate)
            {
                result = crmHelper.UpdateCrmTask(outlookTask);
            }
            return(result);
        }
        // GET: /Outlook/Create
        public ActionResult Create()
        {
            Frame frame = TempData[FrameController.SelectorFrameKey] as Frame;

            if (frame == null || frame.PanelId == 0)
            {
                return(RedirectToAction("Create", "Frame"));
            }

            Outlook outlook = new Outlook(frame, db);

            this.FillTemplatesSelectList(db, FrameTypes.Outlook);
            FillModesSelectList();
            FillAccountsSelectList();
            FillPrivacySelectList();

            return(View(outlook));
        }
Example #30
0
        public override async Task DeleteAllEntites()
        {
            await Outlook.DeleteAllEntities();

            await Server.DeleteAllEntities();

            if (OutlookDistListsOrNull != null)
            {
                await OutlookDistListsOrNull.DeleteAllEntities();
            }
            if (ServerVCardGroupsOrNull != null)
            {
                await ServerVCardGroupsOrNull.DeleteAllEntities();
            }
            if (ServerSogoDistListsOrNull != null)
            {
                await ServerSogoDistListsOrNull.DeleteAllEntities();
            }
        }
Example #31
0
        static void Main()
        {
            var mailServer = new Outlook();

            var dan  = new EmailUser("dan");
            var mike = new EmailUser("mike");

            mailServer.Attach(dan);
            mailServer.Attach(mike);

            mailServer.CheckForEmail();
            mailServer.CheckForEmail();

            mailServer.Detach(dan);

            mailServer.CheckForEmail();

            Console.ReadLine();
        }
Example #32
0
        public CtrlSyncItem(Outlook.OlItemType itemType)
        {
            this.SetStyle(ControlStyles.AllPaintingInWmPaint |
                          ControlStyles.UserPaint |
                          ControlStyles.OptimizedDoubleBuffer , true);

            InitializeComponent();

            this.SyncItemType = itemType;

            this.SuspendLayout();
            _deltaSize = this.panel2.Height;
            this.panel2.Visible = false;
            this.Height = this.panel1.Height;
            this.ResumeLayout(false);

            HookAllEvents(this.panel1, false);
            HookAllEvents(this.panel2, false);
        }
Example #33
0
        public async Task <Dictionary <string, ContactData> > CreateContactsInOutlook(IEnumerable <ContactData> contactDatas)
        {
            var result = new Dictionary <string, ContactData> ();

            foreach (var contactData in contactDatas)
            {
                var id = await Outlook.CreateEntity(
                    contact =>
                {
                    contact.Inner.FirstName     = contactData.FirstName;
                    contact.Inner.LastName      = contactData.LastName;
                    contact.Inner.Email1Address = contactData.EmailAddress;
                    contact.Inner.Categories    = string.Join(CultureInfo.CurrentCulture.TextInfo.ListSeparator, contactData.Groups);
                });

                result.Add(id, contactData);
            }

            return(result);
        }
Example #34
0
        public static void SendOutlookEmail()
        {
            var options = new OutlookOptions
            {
                Recipients = new List <string> {
                    "*****@*****.**"
                },
                Subject = "Test email using C# code",
                Body    = "<quote>This is a quote</quote>"
            };

            //options.Attachments.Add(@"C:\Users\Public\Documents\ViewResultExtension.txt");

            var outlook = new Outlook(options);

            // For logging purpose
            Debug.WriteLine($"Outlook build: {outlook.Version}");

            //outlook.SendMail();
        }
Example #35
0
        public void RunExcelInit(OrdersParser parser, IDataUpdater dataUpdater)
        {
            DataUpdater = dataUpdater;

            OrdersParser._Form = parser;

            Excel.init();
            Outlook.init();

            // create temp results folder
            Utils.createResultsFolder();

            // parse local DB
            Excel.getDetailsFromLocalDb();

            // fetch and save to file the most updated orders excel file
            Outlook.readLastOrdersFile();

            // parse the orders DB
            Excel.getOrderDetails();
        }
        public string CreateAppointmentInCrm(Outlook outlookId)
        {
            Trace.TraceInformation("CreateAppointmentInCrm");

            if (!InitializeHelpers())
            {
                return("Initialize helpers fail");
            }
            if (crmHelper.GetCrmIdByOutlookId(new AppointmentEntity {
                OutlookId = outlookId.outlookId
            }) != Guid.Empty)
            {
                Trace.TraceInformation("CreateAppointmentInCrm: appointmtnt exist");

                return("Appointment is exist");
            }
            AppointmentEntity outlookAppointment = exchangeHelper.GetAppointmentFromOutlook(outlookId.outlookId);
            Guid result = crmHelper.CreateCrmAppointment(outlookAppointment);

            return(result.ToString());
        }
        /// <summary>
        /// Do the <see cref="SimpleNumlWorkflow" /> using a <c>DecisionTree</c> generator/model.
        /// </summary>
        static void DoSimple_DecisionTree(Outlook outlook = Outlook.Sunny, double tempF = 15.0d, bool windy = true,
            int depth = 5, int width = 2, int repeat = 5000)
        {
            SimpleNumlWorkflow.SimpleNumlWorkflowImpl(
                getData: () => SampleData_ComplexType.GetTennisData_ComplexType(predetermined: false),

                getDescriptor: () => Descriptor.Create<Tennis_Complex>(),

                getGenerator: (descriptor) =>
                {
                    var generator = new DecisionTreeGenerator(descriptor)
                    {
                        Depth = depth,
                        Width = width
                    };
                    generator.SetHint(false);
                    return generator;
                },

                getToPredict: () =>
                {
                    return new Tennis_Complex()
                    {
                        WeatherConditions = new WeatherConditions()
                        {
                            Outlook = outlook,
                            Temperature = tempF,
                            Windy = windy,
                        }
                    };
                },

                getPredictionDesc: (t) => "Play: " + t.Play,

                trainingPercentage: 0.8d,

                repeat: repeat
                );
        }
Example #38
0
        /// <summary>
        /// Picks the outlook folder path.
        /// </summary>
        /// <param name="oApp">The o app.</param>
        /// <param name="oItemType">Type of the o item.</param>
        /// <returns></returns>
        public static string PickOutlookFolderPath(Outlook._Application oApp, Outlook.OlItemType oItemType)
        {
            string retVal = null;
            bool correctFolderSelected = false;
            try
            {
                while (!correctFolderSelected)
                {

                    Outlook.NameSpace oNameSpace = oApp.GetNamespace("MAPI");
                    Outlook.MAPIFolder oMapiFolder = oNameSpace.PickFolder();
                    if (oMapiFolder.DefaultItemType != oItemType)
                    {
                        DebugAssistant.Log(DebugSeverity.Error | DebugSeverity.MessageBox,
                                           Resources.ERR_OUTLOOK_BAD_FOLDER_TYPE, oItemType);
                        continue;
                    }

                    correctFolderSelected = true;
                    retVal = oMapiFolder.Name;
                    while (oMapiFolder.Parent is Outlook.MAPIFolder)
                    {
                        oMapiFolder = (Outlook.MAPIFolder)oMapiFolder.Parent;
                        retVal = string.Format("{0}/", oMapiFolder.Name) + retVal;
                    }
                    retVal = "//" + retVal;
                }

            }
            catch (Exception e)
            {

                DebugAssistant.Log(DebugSeverity.Debug, e.Message);
                DebugAssistant.Log(DebugSeverity.Debug | DebugSeverity.MessageBox, Resources.DBG_OUTLOOK_FOLDER_NOT_SELECTED);
            }

            return retVal;
        }
        public ActionResult Edit(Outlook outlook)
        {
            if (!string.IsNullOrWhiteSpace(outlook.Mailbox))
            {
                Match lnk = _emailRgx.Match(outlook.Mailbox);
                outlook.Mailbox = lnk.Success ? lnk.Value : null;
            }

            if (ModelState.IsValid)
            {
                db.Entry(outlook).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index", "Frame"));
            }

            this.FillTemplatesSelectList(db, FrameTypes.Outlook, outlook.TemplateId);
            FillModesSelectList(outlook.Mode);
            FillAccountsSelectList(outlook.AccountId);
            FillPrivacySelectList(outlook.Privacy);


            return(View(outlook));
        }
Example #40
0
        /// <summary>
        /// Creates the sync menu item.
        /// </summary>
        /// <param name="oItemType">Type of the o item.</param>
        /// <returns></returns>
        private SyncMenuItem CreateSyncMenuItem(Outlook.OlItemType oItemType)
        {
            SyncMenuItem retVal = new SyncMenuItem(_vistaMenuCtrl, this.imageList1);
            switch (oItemType)
            {
                case Outlook.OlItemType.olAppointmentItem:
                    retVal.RegisterStatusImages(eSyncStatus.InProgress, (int)eSyncMenuItem_Icon.Calendar_sync, (int)eSyncMenuItem_Icon.Calendar_sync_1,
                                                                   (int)eSyncMenuItem_Icon.Calendar_sync_2, (int)eSyncMenuItem_Icon.Calendar_sync_3);
                    retVal.RegisterStatusImages(eSyncStatus.Failed, (int)eSyncMenuItem_Icon.Calendar_failed);
                    retVal.RegisterStatusImages(eSyncStatus.Canceled, (int)eSyncMenuItem_Icon.Calendar_canceled);
                    retVal.RegisterStatusImages(eSyncStatus.ReadyProgress, (int)eSyncMenuItem_Icon.Calendar_sync, (int)eSyncMenuItem_Icon.Calendar_sync_1,
                                                                   (int)eSyncMenuItem_Icon.Calendar_sync_2, (int)eSyncMenuItem_Icon.Calendar_sync_3);
                    retVal.RegisterStatusImages(eSyncStatus.Ready, (int)eSyncMenuItem_Icon.Calendar_ready);
                    retVal.RegisterStatusImages(eSyncStatus.Ok, (int)eSyncMenuItem_Icon.Calendar_ok);
                    retVal.RegisterStatusImages(eSyncStatus.Unknow, (int)eSyncMenuItem_Icon.Calendar_unknow);
                    retVal.RegisterStatusImages(eSyncStatus.SkipedChangesDetected, (int)eSyncMenuItem_Icon.Calendar_canceled);
                    retVal.ItemTag = oItemType;
                    retVal.Text = Resources.FormSyncMenuItem_TextCalendar;
                    break;
                case Outlook.OlItemType.olContactItem:
                    retVal.RegisterStatusImages(eSyncStatus.InProgress, (int)eSyncMenuItem_Icon.Contact_sync, (int)eSyncMenuItem_Icon.Contact_sync_1,
                                                               (int)eSyncMenuItem_Icon.Contact_sync_2, (int)eSyncMenuItem_Icon.Contact_sync_3);
                    retVal.RegisterStatusImages(eSyncStatus.Failed, (int)eSyncMenuItem_Icon.Contact_failed);
                    retVal.RegisterStatusImages(eSyncStatus.Canceled, (int)eSyncMenuItem_Icon.Contact_canceled);
                    retVal.RegisterStatusImages(eSyncStatus.ReadyProgress, (int)eSyncMenuItem_Icon.Contact_sync, (int)eSyncMenuItem_Icon.Contact_sync_1,
                                                                   (int)eSyncMenuItem_Icon.Contact_sync_2, (int)eSyncMenuItem_Icon.Contact_sync_3);
                    retVal.RegisterStatusImages(eSyncStatus.Ready, (int)eSyncMenuItem_Icon.Contact_ok);
                    retVal.RegisterStatusImages(eSyncStatus.Unknow, (int)eSyncMenuItem_Icon.Contact_unknow);
                    retVal.ItemTag = oItemType;
                    retVal.Text = Resources.FormSyncMenuItem_TextContact;
                    break;
                case Outlook.OlItemType.olTaskItem:
                    retVal.RegisterStatusImages(eSyncStatus.InProgress, (int)eSyncMenuItem_Icon.Task_sync, (int)eSyncMenuItem_Icon.Task_sync_1,
                                                               (int)eSyncMenuItem_Icon.Task_sync_2, (int)eSyncMenuItem_Icon.Task_sync_3);
                    retVal.RegisterStatusImages(eSyncStatus.Failed, (int)eSyncMenuItem_Icon.Task_failed);
                    retVal.RegisterStatusImages(eSyncStatus.Canceled, (int)eSyncMenuItem_Icon.Task_canceled);
                    retVal.RegisterStatusImages(eSyncStatus.ReadyProgress, (int)eSyncMenuItem_Icon.Task_sync, (int)eSyncMenuItem_Icon.Task_sync_1,
                                                                   (int)eSyncMenuItem_Icon.Task_sync_2, (int)eSyncMenuItem_Icon.Task_sync_3);
                    retVal.RegisterStatusImages(eSyncStatus.Ready, (int)eSyncMenuItem_Icon.Task_ready);
                    retVal.RegisterStatusImages(eSyncStatus.Unknow, (int)eSyncMenuItem_Icon.Task_unknow);
                    retVal.ItemTag = oItemType;
                    retVal.Text = Resources.FormSyncMenuItem_TextTask;
                    break;
                case Outlook.OlItemType.olNoteItem:
                    retVal.RegisterStatusImages(eSyncStatus.InProgress, (int)eSyncMenuItem_Icon.Note_sync, (int)eSyncMenuItem_Icon.Note_sync_1,
                                                               (int)eSyncMenuItem_Icon.Note_sync_2, (int)eSyncMenuItem_Icon.Note_sync_3);
                    retVal.RegisterStatusImages(eSyncStatus.Failed, (int)eSyncMenuItem_Icon.Note_failed);
                    retVal.RegisterStatusImages(eSyncStatus.Canceled, (int)eSyncMenuItem_Icon.Note_canceled);
                    retVal.RegisterStatusImages(eSyncStatus.ReadyProgress, (int)eSyncMenuItem_Icon.Note_sync, (int)eSyncMenuItem_Icon.Note_sync_1,
                                                                   (int)eSyncMenuItem_Icon.Note_sync_2, (int)eSyncMenuItem_Icon.Note_sync_3);
                    retVal.RegisterStatusImages(eSyncStatus.Ready, (int)eSyncMenuItem_Icon.Note_ok);
                    retVal.RegisterStatusImages(eSyncStatus.Unknow, (int)eSyncMenuItem_Icon.Note_unknow);
                    retVal.ItemTag = oItemType;
                    retVal.Text = Resources.FormSyncMenuItem_TextNote;
                    break;
            }

            if (retVal != null)
            {
                retVal.SelectionStartColor = Color.FromArgb(152, 193, 233);
                retVal.SelectionEndColor = Color.FromArgb(134, 186, 237);
                retVal.SelectionStartColorStart = Color.FromArgb(104, 169, 234);
                retVal.SelectionEndColorEnd = Color.FromArgb(169, 232, 255);
                retVal.InnerBorder = Color.FromArgb(254, 254, 254);
                retVal.OuterBorder = Color.FromArgb(231, 231, 231);
                retVal.CaptionFont = new Font("Tahoma", 10, FontStyle.Bold);
                retVal.ContentFont = new Font("Tahoma", 7);
                retVal.CaptionColor = Color.Black;
                retVal.ContentColor = Color.Black;
            }
            return retVal;
        }
Example #41
0
 private SyncMenuItem FindSyncMenuItem(Outlook.OlItemType oItemType)
 {
     return MenuItems.FirstOrDefault(x=>(Outlook.OlItemType)x.ItemTag == oItemType);
 }
Example #42
0
        public static Frame GetNextFrame(int panelId, int displayId, int previousFrameId)
		{
            Frame nci = new Frame()
            {
                PanelId = panelId,
                DisplayId = displayId
            };

            using (SqlCommand cmd = new SqlCommand("sp_GetNextFrame"))
            {
				cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@panelId", SqlDbType.Int).Value = panelId;
                cmd.Parameters.Add("@displayId", SqlDbType.Int).Value = displayId;
                cmd.Parameters.Add("@lastFrameId", SqlDbType.Int).Value = previousFrameId;

                using (DataSet ds = DataAccess.RunSql(cmd))
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        DataRow r = ds.Tables[0].Rows[0];
                        nci._initfromRow(r);
                    }
                }
            }

            if (nci.FrameId > 0)
            {
                switch (nci.FrameType)
                {
                    case FrameTypes.Clock:
                        nci = new Clock(nci);
                        break;

                    case FrameTypes.Html:
                        nci = new Html(nci);
                        break;

                    case FrameTypes.Memo:
                        nci = new Memo(nci);
                        break;

                    //case FrameTypes.News:
                    case FrameTypes.Outlook:
                        nci = new Outlook(nci);
                        break;

                    case FrameTypes.Picture:
                        nci = new Picture(nci);
                        break;

                    case FrameTypes.Report:
                        nci = new Report(nci);
                        break;

                    case FrameTypes.Video:
                        nci = new Video(nci);
                        break;

                    case FrameTypes.Weather:
                        nci = new Weather(nci);
                        break;

                    case FrameTypes.YouTube:
                        nci = new YouTube(nci);
                        break;

                    default:
                        break;
                }
            }

            return nci;
		}
Example #43
0
 private KnowledgeSyncProvider GetRemoteSyncProvidersBySyncType(Outlook.OlItemType oItemType)
 {
     return  RemoteProviderProxy.CreateInstance(_settings.CurrentSyncAppSetting, oItemType);
     //return  ClientOutlook.TestProvider.MyProviderFactory.CreateBProvider() ;
 }
Example #44
0
 private KnowledgeSyncProvider GetLocalSyncProviderBySyncType(Outlook.OlItemType oItemType)
 {
     //return new KnowledgeSyncProvider[] { ClientOutlook.TestProvider.MyProviderFactory.CreateAProvider() };
     KnowledgeSyncProvider retVal = null;
     lock (_lockObject)
     {
         if (!_syncProviderCache.TryGetValue(oItemType, out retVal))
         {
             retVal = AppointmentSyncProvider.CreateInstance(_settings.CurrentSyncAppointentSetting, _outlookApplication);
             _syncProviderCache.Add(oItemType, retVal);
         }
     }
     //TODO: Add other types
     return retVal;
 }
Example #45
0
        /// <summary>
        /// Does the sync. Выполняется в другом потоке отличном от AddinModule
        /// </summary>
        /// <param name="oItemType">Type of the o item.</param>
        private void DoSync(Outlook.OlItemType oItemType)
        {
            //reset last error
            LastSyncErrorDescr = string.Empty;
            LastSyncErrorOccur = false;
            //reset skipped items
            _skippedItems.Clear();

            KnowledgeSyncProvider localProvider = null;
            KnowledgeSyncProvider remoteProvider = null;
            CurrentProcessedSyncType = oItemType;
            try
            {
                remoteProvider = GetRemoteSyncProvidersBySyncType(oItemType);
                localProvider = GetLocalSyncProviderBySyncType(oItemType);

                if (localProvider != null)
                {
                    //Create sync session
                    if (_syncAgent == null)
                    {
                        _syncAgent = new SyncOrchestrator();
                        //Subscribe sync framework events
                        SubscribeEvents(_syncAgent);
                    }

                    //ISyncProviderSetting providerSetting = localProvider.ProviderSetting;
                    ISyncProviderSetting providerSetting = localProvider as ISyncProviderSetting;
                    if (providerSetting != null)
                    {

                        SyncDirectionOrder direction = providerSetting.SyncDirectionOrderSetting;
                        ConflictResolutionPolicy conflictResolution = providerSetting.ConflictResolutionPolicySetting;

                        remoteProvider.Configuration.ConflictResolutionPolicy = conflictResolution;
                        localProvider.Configuration.ConflictResolutionPolicy = conflictResolution;

                        _syncAgent.Direction = direction;
                        _syncAgent.LocalProvider = localProvider;
                        _syncAgent.RemoteProvider = remoteProvider;

                        //Subscribe to knowledege provider events
                        SubscribeEvents(localProvider);
                        SubscribeEvents(remoteProvider);
                        //raise sync process begin event
                        OnSyncProcessBegin(new SyncProcessEventArgs());

                        SyncOperationStatistics syncStats = _syncAgent.Synchronize();
                        CollectStatistics(syncStats);
                    }
                }
            }
            catch (UriFormatException e)
            {
                DebugAssistant.Log(DebugSeverity.Error, e.Message);
                LastSyncErrorOccur = true;
                LastSyncErrorDescr = OutlookAddin.Resources.ERR_SYNC_SERVICE_INVALID_URL;
                //DebugAssistant.Log(DebugSeverity.Error | DebugSeverity.MessageBox,
                //					OutlookAddin.Resources.ERR_SYNC_SERVICE_INVALID_URL);
            }
            catch (SoapException e)
            {
                LastSyncErrorOccur = true;
                SyncronizationServiceError syncError = SoapErrorHandler.HandleError(e);

                string msg = OutlookAddin.Resources.ERR_SYNC_SERVICE_UKNOW;
                if (syncError != null)
                {
                    DebugAssistant.Log(DebugSeverity.Error, syncError.errorType.ToString() + " "
                                        + syncError.message + " " + syncError.stackTrace);

                    switch (syncError.errorType)
                    {
                        case SyncronizationServiceError.eServiceErrorType.AuthFailed:
                            msg = Resources.ERR_SYNC_SERVICE_AUTH_FAILED;
                            break;
                        case SyncronizationServiceError.eServiceErrorType.NotAuthRequest:
                            msg = Resources.ERR_SYNC_SERVICE_NOT_AUTH;
                            break;
                        case SyncronizationServiceError.eServiceErrorType.ProviderNotSpecified:
                            msg = Resources.ERR_SYNC_SERVICE_INVALID_PROVIDER;
                            break;
                        case SyncronizationServiceError.eServiceErrorType.SyncFramework:
                            msg = Resources.ERR_SYNC_SERVICE_FRAMEWORK;
                            break;
                        case SyncronizationServiceError.eServiceErrorType.SyncProvider:
                            msg = Resources.ERR_SYNC_SERVICE_PROVIDER;
                            break;
                        case SyncronizationServiceError.eServiceErrorType.ServerError:
                            msg = Resources.ERR_SYNC_SERVICE_SERVER;
                            break;
                        case SyncronizationServiceError.eServiceErrorType.Undef:
                            msg = Resources.ERR_SYNC_SERVICE_UKNOW;
                            break;
                    }
                }

                LastSyncErrorDescr = msg;

                //DebugAssistant.Log(DebugSeverity.Error | DebugSeverity.MessageBox, msg);
            }
            catch (System.Net.WebException e)
            {
                LastSyncErrorOccur = true;
                LastSyncErrorDescr = Resources.ERR_SYNC_CONNECTION;
                DebugAssistant.Log(DebugSeverity.Error, e.Message);
            }
            catch (Exception e)
            {
                LastSyncErrorOccur = true;
                LastSyncErrorDescr = OutlookAddin.Resources.ERR_ADDIN_UNKNOW;
                DebugAssistant.Log(DebugSeverity.Error, e.Message);
                //DebugAssistant.Log(DebugSeverity.Error | DebugSeverity.MessageBox, OutlookAddin.Resources.ERR_ADDIN_UNKNOW);
            }
            finally
            {
                if (localProvider != null)
                {
                    localProvider.EndSession(null);
                }
                if (remoteProvider != null)
                {
                    remoteProvider.EndSession(null);
                }
                OnSyncProcessEnd(new SyncProcessEventArgs());
                CurrentProcessedSyncType = null;

            }
        }
        public void ImportMail(Outlook.Explorers explorers, ConfigXML configXML)
        {
            ComponentResourceManager resources = new ComponentResourceManager(typeof(OpenKMAddIn));

            int mailCount = 0;
            int mailAttach = 0;

            for (int y = 1; y <= explorers.Count; y++)
            {
                Outlook.Explorer openWindow = explorers.Item(y);
                String token = "";
                OKMAuth authService = new OKMAuth(configXML.getHost());
                OKMFolder folderService = new OKMFolder(configXML.getHost());
                OKMRepository repositoryService = new OKMRepository(configXML.getHost());
                OKMMail mailService = new OKMMail(configXML.getHost());
                OKMDocument documentService = new OKMDocument(configXML.getHost());

                try
                {
                    if (configXML.getUser().Equals("") || configXML.getPassword().Equals("") ||
                        configXML.getHost().Equals(""))
                    {
                        throw new Exception(resources.GetString("error_configuration_empty"));
                    }

                    token = authService.login(configXML.getUser(), configXML.getPassword());

                    for (int i = 1; i<=openWindow.Selection.Count; i++) {
                        Object selObject = openWindow.Selection.Item(i);
                        if (selObject is Outlook.MailItem)
                        {
                            mailCount++;
                            Outlook.MailItem mailItem = (selObject as Outlook.MailItem);
                            DateTime receivedTime = mailItem.ReceivedTime;
                            String user = configXML.getUser();
                            String basePath = "/okm:mail/" + user + "/";
                            String year = "" + receivedTime.Year;
                            String month = "" + receivedTime.Month;
                            String day = "" + receivedTime.Day;

                            // Only creating folders when it's needed
                            if (repositoryService.hasNode(token, basePath + year))
                            {
                                if (repositoryService.hasNode(token, basePath + year + "/" + month))
                                {
                                    if (!repositoryService.hasNode(token, basePath + year + "/" + month + "/" + day))
                                    {
                                        folder dayFolder = new folder();
                                        dayFolder.path = basePath + year + "/" + month + "/" + day;
                                        folderService.create(token, dayFolder);
                                    }
                                }
                                else
                                {
                                    folder monthFolder = new folder();
                                    folder dayFolder = new folder();
                                    monthFolder.path = basePath + year + "/" + month;
                                    dayFolder.path = basePath + year + "/" + month + "/" + day;
                                    folderService.create(token, monthFolder);
                                    folderService.create(token, dayFolder);
                                }
                            }
                            else
                            {
                                folder yearFolder = new folder();
                                folder monthFolder = new folder();
                                folder dayFolder = new folder();
                                yearFolder.path = basePath + year;
                                monthFolder.path = basePath + year + "/" + month;
                                dayFolder.path = basePath + year + "/" + month + "/" + day;
                                folderService.create(token, yearFolder);
                                folderService.create(token, monthFolder);
                                folderService.create(token, dayFolder);
                            }

                            // Adding mail values
                            mail newMail = new mail();
                            newMail.path = basePath + year + "/" + month + "/" + day + "/" + mailItem.Subject;
                            newMail.subject = mailItem.Subject;

                            newMail.from = mailItem.GetType().InvokeMember("SenderEmailAddress", System.Reflection.BindingFlags.GetProperty, null, mailItem, null).ToString();
                            //newMail.from = mailItem.SenderEmailAddress; // SenderEmailAddress was introduced in outlook 2002
                            newMail.sentDate = mailItem.SentOn;
                            newMail.sentDateSpecified = true;
                            newMail.receivedDate = mailItem.ReceivedTime;
                            newMail.receivedDateSpecified = true;

                            // Setting mail context and type

                            BodyFormat format = (BodyFormat) mailItem.GetType().InvokeMember("BodyFormat", System.Reflection.BindingFlags.GetProperty, null, mailItem, null);
                            if (format.Equals(BodyFormat.olFormatPlain))
                            {
                                newMail.mimeType = "text/plain";
                                newMail.content = mailItem.Body;
                            }
                            else
                            {
                                newMail.mimeType = "text/html";
                                newMail.content = mailItem.HTMLBody;
                            }

                            // Initialize count recipient address variables
                            int count = 0;
                            int countTo = 0;
                            int countCC = 0;
                            int countBCC = 0;
                            int actualCountTo = 0;
                            int actualCountCC = 0;
                            int actualCountBCC = 0;

                            // Count each mail addresss type to / cc / bcc
                            for (int x=1; x<=mailItem.Recipients.Count; x++) {
                                Outlook.Recipient recipient = mailItem.Recipients.Item(x);
                                switch (recipient.Type)
                                {
                                    case 1:
                                        countTo++;
                                        break;

                                    case 2:
                                        countCC++;
                                        break;

                                    case 3:
                                        countBCC++;
                                        break;

                                    default:
                                        countTo++;
                                        break;
                                }
                                count++;
                            }

                            // Initialize variables
                            String[] mailTo = new String[(countTo > 0) ? countTo : 1];
                            String[] mailCC = new String[(countCC > 0) ? countCC : 1];
                            String[] mailBCC = new String[(countBCC > 0) ? countBCC : 1];

                            // All string[] must have at least one value, it¡s mandatory in webservices
                            if (countTo == 0)
                            {
                                mailTo[0] = "";
                            }
                            if (countCC == 0)
                            {
                                mailCC[0] = "";
                            }
                            if (countBCC == 0)
                            {
                                mailBCC[0] = "";
                            }

                            // Depending mail type each mail is assignede to it own type String[]
                            for (int x=1; x<=mailItem.Recipients.Count; x++) {
                                Outlook.Recipient recipient = mailItem.Recipients.Item(x);
                                switch (recipient.Type)
                                {
                                    case 1:
                                        mailTo[actualCountTo] = recipient.Address;
                                        actualCountTo++;
                                        break;

                                    case 2:
                                        mailCC[actualCountCC] = recipient.Address;
                                        actualCountCC++;
                                        break;

                                    case 3:
                                        mailBCC[actualCountBCC] = recipient.Address;
                                        actualCountBCC++;
                                        break;

                                    default:
                                        mailTo[actualCountTo] = recipient.Address;
                                        actualCountTo++;
                                        break;
                                }

                            }

                            // Assign mail recipients by type
                            newMail.bcc = mailBCC;
                            newMail.cc = mailCC;
                            newMail.to = mailTo;

                            // Creating mail
                            newMail = mailService.create(token, newMail);

                            // Setting attachments
                            if (mailItem.Attachments.Count > 0)
                            {
                                for (int x=1; x<=mailItem.Attachments.Count; x++) {
                                    Outlook.Attachment attachment = mailItem.Attachments.Item(x);

                                    mailAttach++;
                                    document doc = new document();
                                    doc.path = newMail.path + "/" + attachment.FileName;

                                    // save as tempfile for reading
                                    String filename = Environment.GetEnvironmentVariable("TEMP") + "\\" + DateTime.Now.ToString("yymmddHHMMss-") + attachment.FileName;
                                    // save the attachment
                                    attachment.SaveAsFile(filename);

                                    // Uploading document
                                    documentService.create(token, doc, ReadFile(filename));

                                    // Delete a file by using File class static method...
                                    if (File.Exists(filename))
                                    {
                                        // Use a try block to catch IOExceptions, to
                                        // handle the case of the file already being
                                        // opened by another process.
                                        try
                                        {
                                            File.Delete(filename);
                                        }
                                        catch (System.IO.IOException ex)
                                        {
                                            MessageBox.Show(String.Format(resources.GetString("error_deleting_tmp_file"), filename, ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                        }
                                    }

                                    // Releasing com object
                                    Marshal.ReleaseComObject(attachment);
                                }
                            }

                            // Releasing com object
                            Marshal.ReleaseComObject(mailItem);
                        }

                        // Releasing com object
                        Marshal.ReleaseComObject(selObject);
                    }

                    if (!token.Equals(""))
                    {
                        authService.logout(token);  // Always we logout
                        token = "";                 // Reseting token value
                    }

                    if (mailCount > 0)
                    {
                        MessageBox.Show(String.Format(resources.GetString("email_successful_imported"), mailCount, mailAttach));
                    }
                    else
                    {
                        MessageBox.Show(resources.GetString("error_mail_not_selected"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    if (!token.Equals(""))
                    {
                        authService.logout(token); // Always we logout
                    }
                }

            }
        }
        /// <summary>
        /// Do the <see cref="SimpleNumlWorkflow" /> using a <c>LinearRegression</c> generator/model.
        /// </summary>
        static void DoSimple_LinearRegression(Outlook outlook = Outlook.Sunny, double tempF = 15.0d, bool windy = true, 
            int maxIterations = 500, double learningRate = 0.01d, double lambda = 1, int repeat = 10)
        {
            SimpleNumlWorkflow.SimpleNumlWorkflowImpl(
                getData: () => SampleData_ComplexType.GetTennisData_ComplexType(predetermined: false),

                getDescriptor: () => Descriptor.Create<Tennis_Complex>(),

                // This is where we choose the actual algorithm
                getGenerator: (descriptor) =>
                {
                    var generator = new numl.Supervised.Regression.LinearRegressionGenerator()
                    {
                        Descriptor = descriptor,
                        MaxIterations = maxIterations,
                        LearningRate = learningRate,
                        Lambda = lambda
                    };
                    return generator;
                },

                getToPredict: () =>
                {
                    return new Tennis_Complex()
                    {
                        WeatherConditions = new WeatherConditions()
                        {
                            Outlook = outlook,
                            Temperature = tempF,
                            Windy = windy,
                        }
                    };
                },

                getPredictionDesc: (t) => "Play: " + t.Play,

                trainingPercentage: 0.8d,

                repeat: repeat
                );
        }
Example #48
0
 public OutlookFolder(OutlookListener outlookListener, Outlook.MAPIFolder oFolder)
     : base(outlookListener)
 {
     _oFolder = oFolder;
 }
 /// <summary>
 /// The constructor
 /// </summary>
 /// <param name="inspector">the inspector object to monitor</param>
 public InspectorWrapper(Outlook.Inspector inspector)
     : base(inspector)
 {
     ConnectEvents();
 }
Example #50
0
 public SyncItemEventArgs(Outlook.OlItemType itemType)
 {
     oItemType = itemType;
 }
Example #51
0
        static async Task GetUserInfo(Outlook.ApiClient client, string userEmail)
        {
            Console.WriteLine();
            Console.WriteLine("Requesting user information...");

            try
            {
                Outlook.User user = await client.GetUser(userEmail);

                PrintValue("User", user.DisplayName);
                PrintValue("Email Address", user.EmailAddress);
            }
            catch (HttpRequestException hex)
            {
                PrintError(new string[]
                {
                    "There was an error making the API call to get the user info.",
                    string.Format("ERROR: {0}", hex.Message)
                });
            }
        }
Example #52
0
 public static string GenerateReplicaStoreFileName(Outlook.OlItemType oItemType)
 {
     return "c:\\" + oItemType.ToString() + ".dat";
 }
Example #53
0
 public OutlookRecipient(OutlookListener listener, Outlook.Recipient oRecipient)
     : base(listener)
 {
     _oRecipient = oRecipient;
 }
Example #54
0
 protected void EnableSyncItem(Outlook.OlItemType oItemType)
 {
     DisableEnableSyncItem(false, oItemType);
 }
Example #55
0
        static async Task GetUsersContacts(Outlook.ApiClient client, string userEmail)
        {
            Console.WriteLine();
            Console.WriteLine("Fetching user's contacts...");

            try
            {
                 Outlook.ItemCollection<Outlook.Contact> contacts = 
                    await client.GetContacts(userEmail);

                Console.WriteLine("Fetched {0} contacts", contacts.Items.Count);
                foreach (Outlook.Contact contact in contacts.Items)
                {
                    PrintValue("Created", contact.CreatedDateTime.ToString());
                    PrintValue("Name", contact.DisplayName);
                    if (null != contact.EmailAddresses && contact.EmailAddresses.Length > 0)
                    {
                        PrintValue("Email", contact.EmailAddresses[0].Address);
                    }
                    if (!string.IsNullOrEmpty(contact.PersonalNotes))
                    {
                        PrintValue("Notes", contact.PersonalNotes);
                    }
                    Console.WriteLine();
                }
            }
            catch (HttpRequestException hex)
            {
                PrintError(new string[]
                {
                    "There was an error making the API call to get the user info.",
                    string.Format("ERROR: {0}", hex.Message)
                });
            }
        }
Example #56
0
 /// <summary>
 /// Adds the syncronize task.
 /// </summary>
 /// <param name="oSyncItem">The o sync item.</param>
 public void SheduleSyncronizeTask(Outlook.OlItemType oSyncItem)
 {
     this._workManager.SheduleTask(oSyncItem);
     //DoSync(oSyncItem);
 }
 /// <summary>
 /// The constructor to record the associate mailItem and register events.
 /// </summary>
 /// <param name="inspector"></param>
 public MailItemInspector(Outlook.Inspector inspector)
     : base(inspector)
 {
     _mailItem = inspector.CurrentItem as Outlook.MailItem;
     if (_mailItem == null)
         throw new Exception("Not a mailItem in the provided inspector");
     ConnectEvents();
 }
Example #58
0
        /// <summary>
        /// Возвращает объект настройки для соотв типа синхронизации
        /// </summary>
        /// <param name="oItemType">Type of the o item.</param>
        /// <returns></returns>
        public syncProviderSetting GetSyncProviderSettingByType(Outlook.OlItemType oItemType)
        {
            syncProviderSetting retVal = null;
            if (CurrentSettings == null)
                throw new NullReferenceException("CurrentSetting");

            switch (oItemType)
            {
                case Outlook.OlItemType.olAppointmentItem:
                    retVal = CurrentSettings.CurrentSyncAppointentSetting;
                    break;
                case Outlook.OlItemType.olContactItem:
                    retVal = CurrentSettings.CurrentContactSetting;
                    break;
                case Outlook.OlItemType.olNoteItem:
                    retVal = null;
                    break;
                case Outlook.OlItemType.olTaskItem:
                    retVal = CurrentSettings.CurrentTaskSetting;
                    break;
            }

            return retVal;
        }
Example #59
0
        public static async Task<Frame> GetNextFrameAsync(int panelId, int displayId, int previousFrameId)
		{
            Frame nci = new Frame()
            {
                PanelId = panelId,
                DisplayId = displayId
            };

            using (SqlCommand cmd = new SqlCommand("sp_GetNextFrame"))
            {
				cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@panelId", SqlDbType.Int).Value = panelId;
                cmd.Parameters.Add("@displayId", SqlDbType.Int).Value = displayId;
                cmd.Parameters.Add("@lastFrameId", SqlDbType.Int).Value = previousFrameId;

                await cmd.ExecuteReaderExtAsync((dr) =>
                {
                    nci._initfromRow(dr);
                    return false;
                });
            }

            if (nci.FrameId > 0)
            {
                switch (nci.FrameType)
                {
                    case FrameTypes.Clock:
                        nci = new Clock(nci);
                        break;

                    case FrameTypes.Html:
                        nci = new Html(nci);
                        break;

                    case FrameTypes.Memo:
                        nci = new Memo(nci);
                        break;

                    //case FrameTypes.News:

                    case FrameTypes.Outlook:
                        nci = new Outlook(nci);
                        break;

                    case FrameTypes.Picture:
                        nci = new Picture(nci);
                        break;

                    case FrameTypes.Powerbi:
                        nci = new Powerbi(nci);
                        break;

                    case FrameTypes.Report:
                        nci = new Report(nci);
                        break;

                    case FrameTypes.Video:
                        nci = new Video(nci);
                        break;

                    case FrameTypes.Weather:
                        nci = new Weather(nci);
                        break;

                    case FrameTypes.YouTube:
                        nci = new YouTube(nci);
                        break;

                    default:
                        break;
                }
            }

            return nci;
		}
Example #60
0
 /// <summary>
 /// Adds the item.
 /// </summary>
 /// <param name="oItemType">Type of the o item.</param>
 /// <returns></returns>
 public OutlookItem AddItem(Outlook.OlItemType oItemType)
 {
     return base._outlookListener.AddFolderItem(_oFolder, oItemType);
 }