private void ChangeView(ISPCView selectedView)
        {
            SortedFieldName  = String.Empty;
            IsAsc            = true;
            CurrentPageIndex = 0;
            ListItemCollectionPositionNexts = new NameValueCollection();
            ListItemCollectionPositionNexts.Add("0", String.Empty);
            string listItemCollectionPositionNext = String.Empty;
            int    itemCount;
            string currentListItemCollectionPositionNext = ListItemCollectionPositionNexts[(CurrentPageIndex).ToString()];

            List <ISPCItem> items = OutlookConnector.GetConnector(selectedView.SiteSetting).GetListItems(SelectedFolder, selectedView, SortedFieldName, IsAsc, CurrentPageIndex, currentListItemCollectionPositionNext, CustomFilters, out listItemCollectionPositionNext, out itemCount);

            EUView view = selectedView as EUView;

            if (view != null)
            {
                SelectedView = SharePointManager.GetView(view.WebURL, view.ListName, view.Name, view.SiteSetting);
            }
            else
            {
                SelectedView = selectedView;
            }

            object[] args = new object[4] {
                SelectedView, items, listItemCollectionPositionNext, itemCount
            };
            this.Invoke(new UpdateContentDataGridViewHandler(UpdateContentDataGridView), args);
        }
        public void LoadItems(ISPCView view, List <ISPCItem> items, string listItemCollectionPositionNext, int itemCount)
        {
            if (listItemCollectionPositionNext != String.Empty)
            {
                NextButton.Enabled = true;
                if (ListItemCollectionPositionNexts[(CurrentPageIndex + 1).ToString()] == null)
                {
                    ListItemCollectionPositionNexts.Add((CurrentPageIndex + 1).ToString(), listItemCollectionPositionNext);
                }
            }
            else
            {
                NextButton.Enabled = false;
            }
            if (CurrentPageIndex > 0)
            {
                PreviousButton.Enabled = true;
            }
            int startIndex = CurrentPageIndex * view.RowLimit + 1;
            int endIndex   = startIndex + itemCount - 1;

            if (endIndex == 0)
            {
                startIndex = 0;
            }
            PagingLabel.Text = startIndex.ToString() + " - " + endIndex.ToString();

            OutlookConnector.GetConnector(view.SiteSetting).BindItemsToListViewControl(SelectedFolder, view, items, LibraryContentDataGridView);
        }
Esempio n. 3
0
        // JOEL JEFFERY 20110712
        /// <summary>
        /// Refreshes the node.
        /// </summary>
        /// <param name="node">The node.</param>
        private void refreshNode(TreeNode node)
        {
            node.Nodes.Clear();
            //if (e.Node.Nodes.Count == 1)
            {
                this.Refresh();
                //if (IsLoadingNode(e.Node.Nodes[0]) == true)
                {
                    ISPCFolder        folder     = (ISPCFolder)node.Tag;
                    IOutlookConnector connector  = OutlookConnector.GetConnector(folder.SiteSetting);
                    List <ISPCFolder> subFolders = connector.GetSubFolders(folder);
                    SPFoldersTreeView.BeginUpdate();
                    foreach (ISPCFolder subFolder in subFolders)
                    {
                        TreeNode folderNode = node.Nodes.Add(subFolder.Title);
                        folderNode.Tag = subFolder;
                        SetTreeNodeImage(folderNode);
                        AddLoadingNode(folderNode);
                    }
                    SPFoldersTreeView.EndUpdate();

                    //if (IsLoadingNode(e.Node.Nodes[0]) == true)
                    //    e.Node.Nodes.RemoveAt(0);
                }
            }
            this.SaveState();
        }
        public List <ISPCItem> GetViewItems(ISPCView view, string sortField, bool isAsc, int pageIndex, EUCamlFilters filters, out string listItemCollectionPositionNext, out int itemCount)
        {
            string            currentListItemCollectionPositionNext = ListItemCollectionPositionNexts[(pageIndex).ToString()];
            IOutlookConnector connector = OutlookConnector.GetConnector(view.SiteSetting);

            return(connector.GetListItems(SelectedFolder, view, sortField, isAsc, CurrentPageIndex, currentListItemCollectionPositionNext, filters, out listItemCollectionPositionNext, out itemCount));
        }
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
            ILogger log)
        {
            var outlookConnectionString  = System.Environment.GetEnvironmentVariable("OUTLOOK_CONNECTION", EnvironmentVariableTarget.Process);
            var oneDriveConnectionString = System.Environment.GetEnvironmentVariable("ONEDRIVE_CONNECTION", EnvironmentVariableTarget.Process);

            var outlookConnector  = OutlookConnector.Create(outlookConnectionString);
            var oneDriveConnector = OneDriveConnector.Create(oneDriveConnectionString);
//added comments
            var emails = await outlookConnector.Mail.GetEmailsV2Async(
                fetchOnlyUnread : true,
                fetchOnlyWithAttachment : true,
                includeAttachments : true
                );

            foreach (var email in emails.Value)
            {
                foreach (var attachemnt in email.Attachments)
                {
                    var    bytes  = attachemnt.ContentBytes;
                    Stream stream = new MemoryStream(bytes);

                    await oneDriveConnector.OneDriveFileData.CreateFileAsync("emailAttachments/", attachemnt.Name, stream);
                }
            }

            log.LogInformation("C# HTTP trigger function processed a request.");
            string responseMessage = "This HTTP triggered function executed successfully.";

            return(new OkObjectResult(responseMessage));
        }
Esempio n. 6
0
        protected override async Task <MessagingExtensionActionResponse> OnTeamsMessagingExtensionSubmitActionAsync(ITurnContext <IInvokeActivity> turnContext, MessagingExtensionAction action, CancellationToken cancellationToken)
        {
            var taskModuleOutput = JsonConvert.DeserializeObject <TaskModuleSubmitDataDeserializer>(turnContext.Activity.Value.ToString());

            if (taskModuleOutput.data.SubmittedByMail == null)
            {
                action.CommandId = taskModuleOutput.commandId;
                var task = await OnTeamsMessagingExtensionFetchTaskAsync(turnContext, action, cancellationToken);

                return(task);
            }

            if (taskModuleOutput.commandId == Constants.MessageExtensionCommandId)
            {
                var member = await TeamsInfo.GetMemberAsync(turnContext, taskModuleOutput.data.AssignedTo.objectId, cancellationToken);

                taskModuleOutput.data.AssignedTo.objectId = member.Id;
                var blobId = await BlobHelper.UploadToBlob(taskModuleOutput, turnContext);

                var blobData        = BlobHelper.GetBlob(blobId, null).Result;
                var cardResponse    = CardHelper.CreateAdaptiveCardAttachment(Status.BaseCard, blobData, "msteams", out string cardJsonstring);
                var messageResponse = await turnContext.SendActivityAsync(MessageFactory.Attachment(cardResponse), cancellationToken);

                string messageId = messageResponse.Id;
                BlobHelper.GetBlob(blobId, null, messageId);

                //Send Mail
                await OutlookConnector.SendMailAsync(Constants.SenderEmail, blobData.assignedToMail, cardJsonstring, Constants.MailSubject);
            }
            return(new MessagingExtensionActionResponse());
        }
        public void LoadViews(ISPCFolder folder)
        {
            IOutlookConnector connector = OutlookConnector.GetConnector(folder.SiteSetting);
            List <ISPCView>   views     = connector.GetViews(folder);

            ViewsComboBox.Items.Clear();
            foreach (ISPCView view in views)
            {
                ViewsComboBox.Items.Add(view);
            }
            ViewsComboBox.SelectedIndex = 0;
        }
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ISPCItem     listItem = (ISPCItem)LibraryContentDataGridView.SelectedRows[0].Tag;
            DialogResult result   = MessageBox.Show("Are you sure you would like to delete " + listItem.Title + "?", "", MessageBoxButtons.YesNo);

            if (result == DialogResult.No)
            {
                return;
            }
            OutlookConnector.GetConnector(listItem.SiteSetting).DeleteListItem(listItem);
            RefreshViewExt();
        }
Esempio n. 9
0
        public MainViewModel()
        {
            StartDate = new DateTime(year: 2012, month: 10, day: 4);
            EndDate   = DateTime.Now;

            //Anniversaries.Add(new Anniversary(3000, "Tage", new DateTime(2019, 5, 1)));
            //Anniversaries.Add(new Anniversary(3000, "Tage", DateTime.Now));
            //Anniversaries.Add(new Anniversary(3000, "Tage", DateTime.Now));
            //Anniversaries.Add(new Anniversary(3000, "Tage", DateTime.Now));

            var createOutlookConnector = Task.Factory.StartNew(() => { return(new OutlookConnector()); })
                                         .ContinueWith(outlook => { outlookConnector = outlook.Result; });
            //outlookConnector = CreateOutlookConnector().Result;
        }
        private void OkButton_Click(object sender, EventArgs e)
        {
            errorProvider1.Clear();
            ErrorLabel.Visible = false;

            string            newFileName = FileNameTextBox.Text;
            IOutlookConnector connector   = OutlookConnector.GetConnector(SelectedFolder.SiteSetting);

            if (connector.CheckFileExistency(SelectedFolder, SelectedListItem, newFileName) == true)
            {
                errorProvider1.SetError(FileNameTextBox, "There is a file with the same name already!");
                ErrorLabel.Visible = true;
                return;
            }
            connector.CopyFile(SelectedFolder, SelectedListItem, newFileName);
            this.DialogResult = DialogResult.OK;
        }
Esempio n. 11
0
 public void ClearAllNodes()
 {
     SPFoldersTreeView.Nodes.Clear();
     if (EUSettingsManager.GetInstance().Settings == null || EUSettingsManager.GetInstance().Settings.SiteSettings == null)
     {
         return;
     }
     foreach (EUSiteSetting siteSetting in EUSettingsManager.GetInstance().Settings.SiteSettings)
     {
         IOutlookConnector connector  = OutlookConnector.GetConnector(siteSetting);
         ISPCFolder        rootFolder = connector.GetRootFolder(siteSetting);
         TreeNode          rootNode   = new TreeNode(siteSetting.ToString());
         rootNode.Tag = rootFolder;
         SPFoldersTreeView.Nodes.Add(rootNode);
         SetTreeNodeImage(rootNode);
         AddLoadingNode(rootNode);
     }
 }