/// <summary> /// <c>btnNewConnection_Click</c> Event Handler /// display new connection window form to create new connection /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnNewConnection_Click(object sender, RibbonControlEventArgs e) { try { ThisAddIn.IsUrlIsTyped = true; frmSPSiteConfigurationObject = new frmSPSiteConfiguration(); frmSPSiteConfigurationObject.ShowDialog(); } catch (Exception ex) { } }
/// <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 { } } }
/// <summary> /// Custome menu item "Itopia Edit proeprties" click event /// </summary> /// <param name="Ctrl"></param> /// <param name="CancelDefault"></param> void oFolderMenuButtonEditConnectionProperties_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault) { try { try { renameButton.Click -= new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(renameButton_Click); } catch { } //Create instance frmSPSiteConfigurationObject = new frmSPSiteConfiguration(); //Get the drop url string folderName = ((Microsoft.Office.Core.CommandBarButtonClass)(Ctrl)).Tag; frmSPSiteConfigurationObject.ShowEditForm(folderName); if (frmSPSiteConfigurationObject.IsConfigureCompleted) { UserLogManagerUtility.UpdateFolderConfigDetails("", frmSPSiteConfigurationObject.FolderConfigProperties); foreach (MAPIFolderWrapper folder in myFolders) { if (folder.FolderName == folderName) { folder.AttachedFolder.WebViewURL = frmSPSiteConfigurationObject.URL; break; } } } } catch (Exception ex) { EncodingAndDecoding.ShowMessageBox("oFolderMenuButtonConnectionProperties_Click", ex.Message, MessageBoxIcon.Error); } }
/// <summary> /// <c>btnNewConnection_Click</c> Event Handler /// It opens the New Connection window form("frmSPSiteConfiguration") to create new connection. /// this is used in outlook addin for outlook 2007 not for outlook 2010. in outlook 2010 ribbon is used /// </summary> /// <param name="Ctrl"></param> /// <param name="CancelDefault"></param> void btnNewConnection_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault) { try { frmSPSiteConfigurationObject = new frmSPSiteConfiguration(); frmSPSiteConfigurationObject.ShowDialog(); } catch (Exception ex) { } }
/// <summary> /// <c>dgvUsersInformation_CellContentClick</c> Event Handler /// it display <c>frmSPSiteConfiguration</c> window form to update connection properties /// of the selected record /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvUsersInformation_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (e.ColumnIndex == 0) { string foldername = ""; foldername = dgvUsersInformation.Rows[e.RowIndex].Cells[1].Value.ToString(); frmSPSiteConfiguration frmSPSiteConfigurationObject = new frmSPSiteConfiguration(); frmSPSiteConfigurationObject.ShowEditForm(foldername); if (frmSPSiteConfigurationObject.IsConfigureCompleted) { UserLogManagerUtility.UpdateFolderConfigDetails("", frmSPSiteConfigurationObject.FolderConfigProperties); //foreach (MAPIFolderWrapper folder in myFolders) //{ // if (folder.FolderName == folderName) // { // folder.AttachedFolder.WebViewURL = frmSPSiteConfigurationObject.URL; // break; // } //} Microsoft.Office.Interop.Outlook.Application outlookObj = Globals.ThisAddIn.Application; //Gte MAPI Name space Microsoft.Office.Interop.Outlook.NameSpace outlookNameSpace = outlookObj.GetNamespace("MAPI"); Microsoft.Office.Interop.Outlook.MAPIFolder oInBox = outlookNameSpace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox); Microsoft.Office.Interop.Outlook.MAPIFolder parentFolder = (Microsoft.Office.Interop.Outlook.MAPIFolder)oInBox.Parent; Microsoft.Office.Interop.Outlook.MAPIFolder f = MAPIFolderWrapper.GetFolder(parentFolder, foldername); if (f != null) { f.WebViewURL = frmSPSiteConfigurationObject.URL; } } BindGrid(); } } catch (Exception ex) { } }