Exemple #1
0
        /// <summary>
        /// Init task service.
        /// </summary>
        /// <param name="token">Task service token.</param>
        /// <param name="listTypeIds">Task list name and id dictionary.</param>
        /// <param name="taskServiceType">The task service type.</param>
        /// <returns>Task service itself.</returns>
        public ITaskService InitTaskService(string token, Dictionary <string, string> listTypeIds, ServiceProviderType taskServiceType)
        {
            ITaskService taskService;

            if (taskServiceType == ServiceProviderType.OneNote)
            {
                var oneNoteService = new OneNoteService();
                taskService = oneNoteService.InitAsync(token, listTypeIds).Result;
            }
            else
            {
                var outlookService = new OutlookService();
                taskService = outlookService.InitAsync(token, listTypeIds).Result;
            }

            return(taskService);
        }
        /// <summary>
        /// Init task service.
        /// </summary>
        /// <param name="token">Task service token.</param>
        /// <param name="listTypeIds">Task list name and id dictionary.</param>
        /// <param name="taskServiceType">The task service type.</param>
        /// <returns>Task service itself.</returns>
        public ITaskService InitTaskService(string token, Dictionary <string, string> listTypeIds, ServiceProviderType taskServiceType)
        {
            if (token == null)
            {
                throw new Exception("API token is null");
            }

            ITaskService taskService;

            if (taskServiceType == ServiceProviderType.OneNote)
            {
                var oneNoteService = new OneNoteService(Configuration);
                taskService = oneNoteService.InitAsync(token, listTypeIds).Result;
            }
            else
            {
                var outlookService = new OutlookService(Configuration);
                taskService = outlookService.InitAsync(token, listTypeIds).Result;
            }

            return(taskService);
        }