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));
        }
Exemple #2
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 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 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;
        }
Exemple #5
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);
     }
 }
Exemple #6
0
        public void UploadItems(object _uploadItems)
        {
            bool uploadSucceeded = false;
            List <EUUploadItem>    uploadItems = (List <EUUploadItem>)_uploadItems;
            FileExistDialogResults lastFileExistDialogResults = FileExistDialogResults.NotSelected;
            bool doThisForNextConflicts = false;

            foreach (EUUploadItem uploadItem in uploadItems)
            {
                string   newDestinationUrl = uploadItem.DestinationFolderUrl + "/";
                string   copySource        = new FileInfo(uploadItem.EmailUploadFile.FilePath).Name;
                string[] copyDest          = new string[1] {
                    uploadItem.DestinationFolderUrl + "/" + copySource
                };
                byte[] itemByteArray = SharePointManager.ReadByteArrayFromFile(uploadItem.EmailUploadFile.FilePath);

                EUListItem listItem;

                string            newFileName = copySource;
                IOutlookConnector connector   = OutlookConnector.GetConnector(uploadItem.Folder.SiteSetting);

                if (
                    (doThisForNextConflicts == true && lastFileExistDialogResults == FileExistDialogResults.Skip)
                    ||
                    lastFileExistDialogResults == FileExistDialogResults.Cancel)
                {
                    uploadItem.SharePointListViewControl.DeleteUploadItemInvoke(uploadItem.EmailUploadFile.UniqueID);
                    continue;
                }

                bool isCurrentFileUploadCanceled = false;
                if (
                    (doThisForNextConflicts == false)
                    ||
                    (doThisForNextConflicts == true && lastFileExistDialogResults == FileExistDialogResults.Copy)
                    )
                {
                    while (connector.CheckFileExistency(uploadItem.Folder, null, newFileName) == true)
                    {
                        FileExistConfirmationForm fileExistConfirmationForm = new FileExistConfirmationForm(copyDest[0]);
                        fileExistConfirmationForm.ShowDialog();
                        lastFileExistDialogResults = fileExistConfirmationForm.FileExistDialogResult;
                        doThisForNextConflicts     = fileExistConfirmationForm.DoThisForNextConflicts;

                        newFileName = fileExistConfirmationForm.NewFileName;
                        if (lastFileExistDialogResults == FileExistDialogResults.Skip || lastFileExistDialogResults == FileExistDialogResults.Cancel)
                        {
                            uploadItem.SharePointListViewControl.DeleteUploadItemInvoke(uploadItem.EmailUploadFile.UniqueID);
                            isCurrentFileUploadCanceled = true;
                            break;
                        }
                        if (lastFileExistDialogResults == FileExistDialogResults.CopyAndReplace)
                        {
                            break;
                        }
                        string newCopyDest = copyDest[0].Substring(0, copyDest[0].LastIndexOf("/")) + "/" + newFileName;
                        copyDest = new string[] { newCopyDest };
                    }
                }
                if (isCurrentFileUploadCanceled == true)
                {
                    continue;
                }

                if (uploadItem.EmailUploadFile.IsListItemAndAttachment == false)
                {
                    uint?result = SharePointManager.UploadFile(uploadItem.Folder.SiteSetting, uploadItem.Folder.ListName, uploadItem.Folder.RootFolderPath, uploadItem.Folder.SiteUrl, uploadItem.Folder.WebUrl, copySource, copyDest, itemByteArray, uploadItem.Fields, uploadItem.EmailUploadFile.MetaData, uploadItem.EmailUploadFile.FieldInformations, out listItem);
                    if (uploadItem.SharePointListViewControl != null && listItem != null)   // JON SILVER JULY 2011 - Is this success???
                    {
                        uploadItem.SharePointListViewControl.NotifyUploadItemInvoke(uploadItem.EmailUploadFile.UniqueID, listItem);
                    }
                    // JON SILVER JULY 2011
                    if (result.HasValue && listItem != null)
                    {
                        uploadSucceeded = true;
                    }
                }
                else
                {
                    int?result = SharePointManager.UploadListItemWithAttachment(uploadItem);
                    uploadSucceeded = result.HasValue;
                }
            }

            // JON SILVER JULY 2011 - RAISE UPLOAD SUCCESS SO WE CAN DELETE IF WE ARE MOVING
            if (!uploadSucceeded && UploadFailed != null) //why is UploadFailed null sometimes? JJ
            {
                UploadFailed(this, new EventArgs());
            }
            else if (UploadSucceeded != null)
            {
                UploadSucceeded(this, new EventArgs());
            }
        }