Example #1
0
 public EUUploadItem(EUFolder folder, string destinationFolderUrl, EUEmailUploadFile emailUploadFile, List <EUField> fields, EUFieldInformations fieldInformations, SharePointListViewControl sharePointListViewControl)
 {
     EmailUploadFile      = emailUploadFile;
     DestinationFolderUrl = destinationFolderUrl;
     FieldInformations    = fieldInformations;
     Folder = folder;
     Fields = fields;
     SharePointListViewControl = sharePointListViewControl;
 }
 public void UploadFiles(ISPCFolder folder, List <EUEmailUploadFile> uploadFiles, List <EUField> fields, EUFieldInformations fieldInformations, SharePointListViewControl sharePointListViewControl)
 {
     throw new Exception("Not implemented");
 }
Example #3
0
        public static void UploadEmail(SharePointListViewControl listviewControl, ISPCFolder dragedFolder, DragEventArgs e, List <EUEmailUploadFile> emailUploadFiles, bool isListItemAndAttachmentMode)
        {
            try
            {
                EUFieldInformations fieldInformations = null;
                EUFieldCollection   fields            = null;

                UploadProgressForm uploadProgressForm = new UploadProgressForm();
                if (EUSettingsManager.GetInstance().Settings == null)
                {
                    MessageBox.Show("You need to configure settings first.");
                    SettingsForm settingsControl = new SettingsForm();
                    settingsControl.ShowDialog();
                    return;
                }

                if (dragedFolder as EUFolder != null)
                {
                    EUFolder             dragedSPFolder = dragedFolder as EUFolder;
                    List <EUContentType> contentTypes   = SharePointManager.GetContentTypes(dragedSPFolder.SiteSetting, dragedSPFolder.WebUrl, dragedSPFolder.ListName);
                    fields = SharePointManager.GetFields(dragedSPFolder.SiteSetting, dragedSPFolder.WebUrl, dragedSPFolder.ListName);
                    ListItemEditForm listItemEditForm = new ListItemEditForm();
                    listItemEditForm.InitializeForm(dragedSPFolder, null);
                    listItemEditForm.ShowDialog();

                    if (listItemEditForm.DialogResult != DialogResult.OK)
                    {
                        return;
                    }
                    foreach (EUEmailUploadFile emailUploadFile in emailUploadFiles)
                    {
                        emailUploadFile.FieldInformations = listItemEditForm.FieldInformations;
                    }
                }

                string sourceFolder = EUSettingsManager.GetInstance().CreateATempFolder();

                if (EUSettingsManager.GetInstance().Settings.UploadAutomatically == true || dragedFolder as FSFolder != null || dragedFolder as GFolder != null)
                {
                    if (listviewControl != null)
                    {
                        for (int i = 0; i < emailUploadFiles.Count; i++)
                        {
                            EUEmailUploadFile emailUploadFile = emailUploadFiles[i];
                            listviewControl.LibraryContentDataGridView.Rows.Insert(i, 1);
                            listviewControl.LibraryContentDataGridView.Rows[i].Tag = emailUploadFile.UniqueID.ToString();
                            if (dragedFolder as EUFolder != null)
                            {
                                listviewControl.LibraryContentDataGridView.Rows[i].Cells["ExtensionImageColumn"].Value = Sobiens.Office.SharePointOutlookConnector.Properties.Resources.ajax_loader;
                            }
                            string title = emailUploadFile.FilePath.Split('\\')[emailUploadFile.FilePath.Split('\\').Length - 1];
                            listviewControl.LibraryContentDataGridView.Rows[i].Cells["TitleColumn"].Value = title;
                        }
                    }
                    // JOEL JEFFERY 20110712 Hook up the UploadFailed event
                    // JON SILVER JULY 2011 Hook up the UploadSucceeded event
                    if (!addedEventHandler)
                    {
                        OutlookConnector.GetConnector(dragedFolder.SiteSetting).UploadFailed    += new EventHandler(EUEmailManager_UploadFailed);
                        OutlookConnector.GetConnector(dragedFolder.SiteSetting).UploadSucceeded += new EventHandler(EUEmailManager_UploadSucceeded);
                        addedEventHandler = true;
                    }

                    OutlookConnector.GetConnector(dragedFolder.SiteSetting).UploadFiles(dragedFolder, emailUploadFiles, fields, fieldInformations, listviewControl);
                }
                else
                {
                    uploadProgressForm.Initialize(dragedFolder, sourceFolder, emailUploadFiles, isListItemAndAttachmentMode, fieldInformations);
                    uploadProgressForm.ShowDialog();
                }
            }
            catch (System.Exception ex)
            {
                string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                LogManager.LogAndShowException(methodName, ex);
                throw ex;
            }
        }
Example #4
0
        /// <summary>
        /// Ensures the folder exists.
        /// </summary>
        /// <param name="folder">The folder.</param>
        /// <param name="destinationFolderUrl">The destination folder URL.</param>
        /// <param name="emailUploadFile">The email upload file.</param>
        /// <param name="fields">The fields.</param>
        /// <param name="fieldInformations">The field informations.</param>
        /// <param name="sharePointListViewControl">The share point list view control.</param>
        /// <returns>The url of the new folder.</returns>
        private string ensureFolderExists(EUFolder folder, string destinationFolderUrl, EUEmailUploadFile emailUploadFile, List <EUField> fields, EUFieldInformations fieldInformations, SharePointListViewControl sharePointListViewControl)
        {
            string newFolderName     = SharePointManager.MakeFileNameSafe(emailUploadFile.Subject + (emailUploadFile.SentOn.HasValue ? emailUploadFile.SentOn.Value.ToString(" yyyyddMM") : ""));
            string newDestinationUrl = destinationFolderUrl + "/" + newFolderName;

            if (!SharePointManager.CheckFolderExists(folder.SiteSetting, newDestinationUrl, folder.ListName, folder.FolderPath, newFolderName))
            {
                SharePointManager.CreateListFolder(folder.SiteSetting, folder.FolderPath, folder.WebUrl, folder.ListName, newFolderName);
            }
            // JOEL JEFFERY 20110712 - what the hell was I thinking?
            //folder.FolderPath = folder.FolderPath += "/" + newFolderName;
            return(newDestinationUrl);
        }
Example #5
0
        public void QueueUploadItems(EUFolder folder, string destinationFolderUrl, List <EUEmailUploadFile> uploadFiles, List <EUField> fields, EUFieldInformations fieldInformations, SharePointListViewControl sharePointListViewControl)
        {
            List <EUUploadItem> uploadItems = new List <EUUploadItem>();

            foreach (EUEmailUploadFile emailUploadFile in uploadFiles)
            {
                if (emailUploadFile.SaveFormatOverride == SaveFormatOverride.Word)
                {
                    destinationFolderUrl = ensureFolderExists(folder, destinationFolderUrl, emailUploadFile, fields, fieldInformations, sharePointListViewControl);
                }
                EUUploadItem uploadItem = new EUUploadItem(folder, destinationFolderUrl, emailUploadFile, fields, fieldInformations, sharePointListViewControl);
                uploadItems.Add(uploadItem);
            }
            ThreadPool.QueueUserWorkItem(new WaitCallback(UploadItems), uploadItems);
            bool test;
        }
Example #6
0
        public void UploadFiles(ISPCFolder folder, List <EUEmailUploadFile> uploadFiles, List <EUField> fields, EUFieldInformations fieldInformations, SharePointListViewControl sharePointListViewControl)
        {
            EUFolder _folder = folder as EUFolder;
            string   destinationFolderUrl = _folder.WebUrl.TrimEnd(new char[] { '/' }) + "/" + _folder.FolderPath.TrimStart(new char[] { '/' });

            BackgroundThreadManager.GetInstance().QueueUploadItems(_folder, destinationFolderUrl, uploadFiles, fields, fieldInformations, sharePointListViewControl);

            /*
             * List<EUField> fields = SharePointManager.GetFields(_folder.SiteSetting, _folder.WebUrl, _folder.ListName);
             * foreach (EUEmailUploadFile uploadFile in uploadFiles)
             * {
             *  string copySource = new FileInfo(uploadFile.FilePath).Name;
             *  string[] copyDest = new string[1] { destinationFolderUrl + "/" + copySource };
             *  byte[] itemByteArray = SharePointManager.ReadByteArrayFromFile(uploadFile.FilePath);
             *
             *  EUUploadItem uploadItem = new EUUploadItem(_folder.SiteSetting, _folder.ListName, _folder.RootFolderPath, _folder.WebUrl, copySource, copyDest, itemByteArray, fields, uploadFile.MailItem, fieldInformations);
             *  BackgroundThreadManager.GetInstance().QueueUploadItems(uploadItem);
             * }
             */
        }
        public void UploadFiles(ISPCFolder folder, List <EUEmailUploadFile> uploadFiles, List <EUField> fields, EUFieldInformations fieldInformations, SharePointListViewControl sharePointListViewControl)
        {
            GFolder _folder = folder as GFolder;

            foreach (EUEmailUploadFile emailUploadFile in uploadFiles)
            {
                GMailManager.GetInstance().UploadFile(folder.SiteSetting, emailUploadFile.FilePath, folder.UniqueIdentifier);
            }
        }
        public void UploadFiles(ISPCFolder folder, List <EUEmailUploadFile> uploadFiles, List <EUField> fields, EUFieldInformations fieldInformations, SharePointListViewControl sharePointListViewControl)
        {
            FSFolder _folder = (FSFolder)folder;

            foreach (EUEmailUploadFile uploadFile in uploadFiles)
            {
                string copySource = new FileInfo(uploadFile.FilePath).Name;
                File.Copy(uploadFile.FilePath, _folder.Path + "\\" + copySource);
            }
        }