コード例 #1
0
ファイル: SharePointRibbon.cs プロジェクト: imysecy/SPLINK
        /// <summary>
        /// code written by Joy
        /// this event is fired when the move button is clicked
        /// sets the mapped folder names to the dropdownlist
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Move_Click(object sender, RibbonControlEventArgs e)
        {
            DataSet ds = new DataSet();

            if (File.Exists(UserLogManagerUtility.XMLFilePath))
            {
                ds.Tables.Clear();
                ds.ReadXml(UserLogManagerUtility.XMLFilePath);
                try
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        if (Globals.ThisAddIn.isuploadRunning == false && Globals.ThisAddIn.isTimerUploadRunning == false && Globals.ThisAddIn.isMoveRunning == false && Globals.ThisAddIn.isCopyRunninng == false)
                        {
                            Globals.ThisAddIn.copy_button_clicked = false;
                            Globals.ThisAddIn.move_button_clicked = true;

                            Outlook.Application myApplication = Globals.ThisAddIn.Application;
                            Outlook.Explorer myActiveExplorer = (Outlook.Explorer)myApplication.ActiveExplorer();
                            Globals.ThisAddIn.moveSelected = myActiveExplorer.Selection;
                            if (Globals.ThisAddIn.moveSelected.Count > 0)
                            {
                                Globals.ThisAddIn.isMoveRunning = true;
                                Globals.ThisAddIn.no_of_moved_item_uploaded = 0;
                                Globals.ThisAddIn.no_of_moved_item_to_be_uploaded = Globals.ThisAddIn.moveSelected.Count;
                                frmoption = new frmFolderOptions();
                                frmoption.ShowDialog();

                            }
                            else
                            {
                                frmMessageWindow messagebox = new frmMessageWindow();
                                messagebox.DisplayMessage = "Please select some items";
                                messagebox.TopLevel = true;
                                messagebox.TopMost = true;
                                messagebox.ShowDialog();
                                messagebox.Dispose();

                                return;
                            }

                        }
                        else
                        {
                            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();

                            return;

                        }
                    }
                }
                catch (Exception ex)
                {

                }
            }
        }
コード例 #2
0
ファイル: ThisAddIn.cs プロジェクト: imysecy/SPLINK
        /// <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
                {

                }
            }
        }