/// <summary> /// code in this section written by Joy /// this method fires by the timer before uploading the mail items /// </summary> /// <param name="ClipboardContent"></param> /// <param name="Target"></param> /// <param name="Cancel"></param> void addinExplorer_beforeMovingToMappedFolder(object ClipboardContent, Microsoft.Office.Interop.Outlook.MAPIFolder Target, bool Cancel) { if (isTimerUploadRunning == false && isuploadRunning == false) { try { AddfFolderinSessionMapi(); IsUrlIsTyped = false; currentFolderSelected = Target.Name; currentFolderSelectedGuid = Target.EntryID; myTargetFolder = Target; if (IsUploadingFormIsOpen == true) { if (Globals.ThisAddIn.frmlistObject != null) { Globals.ThisAddIn.frmlistObject.Invoke(new progressUpdater(()=> { frmlistObject.progressBar1.Value = frmlistObject.progressBar1.Minimum; frmlistObject.lblPRStatus.Text = ""; })); } //frmMessageWindow objMessage = new frmMessageWindow(); //objMessage.DisplayMessage = "Please check the uploading form. Form is still open."; //objMessage.TopLevel = true; //objMessage.TopMost = true; //objMessage.ShowDialog(); //objMessage.Dispose(); ////EncodingAndDecoding.ShowMessageBox("", "Please check the uploading form. Form is still open.", MessageBoxIcon.Warning); //Cancel = true; //return; } //Check dropping item is from browser or not if (ClipboardContent.GetType().Name == "String") { //Set active folder as TargetFolder this.Application.ActiveExplorer().SelectFolder(Target); //'Cerate instance frmSPSiteConfigurationObject = new frmSPSiteConfiguration(); //Get the drop url frmSPSiteConfigurationObject.URL = Convert.ToString(ClipboardContent); frmSPSiteConfigurationObject.ShowDialog(); if (frmSPSiteConfigurationObject.IsConfigureCompleted) { //Save the details in log proeprties object XMLLogProperties xLogProperties = frmSPSiteConfigurationObject.FolderConfigProperties; Outlook.MAPIFolder newFolder = null; bool result = CreateFolderInOutLookSideMenu(xLogProperties.DisplayFolderName, xLogProperties.SiteURL, out newFolder, Target); Cancel = true; if (result == true && newFolder != null) { //Set new folder location xLogProperties.OutlookFolderLocation = newFolder.FolderPath; //Create node in xml file UserLogManagerUtility.CreateXMLFileForStoringUserCredentials(xLogProperties); MAPIFolderWrapper omapi = null; if (string.IsNullOrEmpty(xLogProperties.DocumentLibraryName) == true) { //Doc name is empty means Folder is not mapped with Doc Lib omapi = new MAPIFolderWrapper(ref newFolder, addinExplorer, false); } else { omapi = new MAPIFolderWrapper(ref newFolder, addinExplorer, true); } omapi.AttachedFolder.WebViewURL = ListWebClass.WebViewUrl(omapi.AttachedFolder.WebViewURL); myFolders.Add(omapi); } } else { frmSPSiteConfigurationObject.Close(); Cancel = true; } } else { } } catch (Exception ex) { EncodingAndDecoding.ShowMessageBox("BeforeItemPaste", ex.Message, MessageBoxIcon.Error); } finally { } } }
/// <summary> /// <c>addinExplorer_BeforeItemPaste</c> Event Handler /// Fires when any item is dragged and dropped to an outlook Folder /// </summary> /// <param name="ClipboardContent"></param> /// <param name="Target"></param> /// <param name="Cancel"></param> void addinExplorer_BeforeItemPaste(ref object ClipboardContent, Microsoft.Office.Interop.Outlook.MAPIFolder Target, ref bool Cancel) { ///code written by Joy/// ///checks if any upload is running if (isuploadRunning == true||isTimerUploadRunning==true||isMoveRunning==true||isCopyRunninng==true) { frmMessageWindow objMessage = new frmMessageWindow(); objMessage.DisplayMessage = "Your uploads are still running.Please wait for sometime."; objMessage.TopLevel = true; objMessage.TopMost = true; objMessage.ShowDialog(); objMessage.Dispose(); //EncodingAndDecoding.ShowMessageBox("", "Please check the uploading form. Form is still open.", MessageBoxIcon.Warning); Cancel = true; return; } else { try { ///all code in this section written by joy ///retrieves the mail items from the Selection and set the progressbar value to default Outlook.MailItem mailitem; no_of_items_copied = 0; Outlook.Application myApplication = Globals.ThisAddIn.Application; Outlook.Explorer myActiveExplorer = (Outlook.Explorer)myApplication.ActiveExplorer(); ///retrieves the mail items from the Selection oselection = myActiveExplorer.Selection; no_of_items_to_be_uploaded = oselection.Count; AddfFolderinSessionMapi(); IsUrlIsTyped = false; currentFolderSelected = Target.Name; currentFolderSelectedGuid = Target.EntryID; myTargetFolder = Target; if (IsUploadingFormIsOpen == true) { if (Globals.ThisAddIn.frmlistObject != null) { ///set the progressbar value to default frmlistObject.progressBar1.Value = frmlistObject.progressBar1.Minimum; frmlistObject.lblPRStatus.Text = ""; } //frmUploadItemsList frmUplList = new frmUploadItemsList(); //frmUplList.progressBar1.Value = frmUplList.progressBar1.Minimum; //frmUplList.lblPRStatus.Text = ""; //frmUplList.Refresh(); //frmUplList.Visible = false; //frmUplList.Dispose(); } //Check dropping item is from browser or not if (ClipboardContent.GetType().Name == "String") { //Set active folder as TargetFolder this.Application.ActiveExplorer().SelectFolder(Target); //'Cerate instance frmSPSiteConfigurationObject = new frmSPSiteConfiguration(); //Get the drop url frmSPSiteConfigurationObject.URL = Convert.ToString(ClipboardContent); frmSPSiteConfigurationObject.ShowDialog(); if (frmSPSiteConfigurationObject.IsConfigureCompleted) { //Save the details in log proeprties object XMLLogProperties xLogProperties = frmSPSiteConfigurationObject.FolderConfigProperties; Outlook.MAPIFolder newFolder = null; bool result = CreateFolderInOutLookSideMenu(xLogProperties.DisplayFolderName, xLogProperties.SiteURL, out newFolder, Target); Cancel = true; if (result == true && newFolder != null) { //Set new folder location xLogProperties.OutlookFolderLocation = newFolder.FolderPath; //Create node in xml file UserLogManagerUtility.CreateXMLFileForStoringUserCredentials(xLogProperties); MAPIFolderWrapper omapi = null; if (string.IsNullOrEmpty(xLogProperties.DocumentLibraryName) == true) { //Doc name is empty means Folder is not mapped with Doc Lib omapi = new MAPIFolderWrapper(ref newFolder, addinExplorer, false); } else { omapi = new MAPIFolderWrapper(ref newFolder, addinExplorer, true); } omapi.AttachedFolder.WebViewURL = ListWebClass.WebViewUrl(omapi.AttachedFolder.WebViewURL); myFolders.Add(omapi); } } else { frmSPSiteConfigurationObject.Close(); Cancel = true; } } else { } } catch (Exception ex) { EncodingAndDecoding.ShowMessageBox("BeforeItemPaste", ex.Message, MessageBoxIcon.Error); } finally { } } }