Beispiel #1
0
        private void SelectLocationButton_Click(object sender, RoutedEventArgs e)
        {
            ExplorerLocation explorerLocation = (ExplorerLocation)this.Tag;
            SiteSetting      siteSetting      = (SiteSetting)SiteSettingComboBox.SelectedItem;
            Folder           rootFolder       = null;

            SiteContentSelections siteContentSelections = new SiteContentSelections();

            if (explorerLocation.Folder == null)
            {
                rootFolder = new SPWeb(siteSetting.Url, siteSetting.Url, siteSetting.ID, String.Empty, siteSetting.Url, siteSetting.Url);
                rootFolder.PublicFolder = true;
                //siteContentSelections.InitializeForm(siteSetting, rootFolder, false, null);
                siteContentSelections.InitializeForm(siteSetting, rootFolder, true, null);

                if (siteContentSelections.ShowDialog(this.ParentWindow, Languages.Translate("Site Content Selections")) == true)
                {
                    explorerLocation.Folder = siteContentSelections.SelectedFolder;
                    explorerLocation.BasicFolderDefinition = explorerLocation.Folder.GetBasicFolderDefinition();
                }
            }
            else
            {
                rootFolder = explorerLocation.Folder;
                //siteContentSelections.InitializeForm(siteSetting, rootFolder, false, null);
                siteContentSelections.InitializeForm(siteSetting, rootFolder, true, null);

                if (siteContentSelections.ShowDialog(this.ParentWindow, Languages.Translate("Site Content Selections")) == true)
                {
                    explorerLocation.Folder = siteContentSelections.SelectedFolder;
                    explorerLocation.BasicFolderDefinition = explorerLocation.Folder.GetBasicFolderDefinition();
                }
            }
        }
        private void SelectLocationButton_Click(object sender, RoutedEventArgs e)
        {
            if (SiteSettingComboBox.SelectedItem == null)
            {
                MessageBox.Show(Languages.Translate("Please select a site setting."));
                return;
            }

            string        siteSettingUrl = SiteSettingComboBox.SelectedItem.ToString();
            Guid          siteSettingId  = (Guid)SiteSettingComboBox.SelectedValue;
            List <Folder> folders        = new List <Folder>();
            SPWeb         web            = new SPWeb(siteSettingUrl, siteSettingUrl, siteSettingId, siteSettingUrl, siteSettingUrl, siteSettingUrl);

            web.PublicFolder = true;
            folders.Add(web);
            SiteContentSelections siteContentSelections = new SiteContentSelections();

            siteContentSelections.InitializeForm(this.SiteSettings, folders, true, null);
            if (siteContentSelections.ShowDialog(this.ParentWindow, Languages.Translate("Save Location Selections")) == true)
            {
                this.SelectedFolder           = siteContentSelections.SelectedFolder;
                this.SaveLocationTextBox.Text = this.SelectedFolder.Title;
                this.LoadContentTypes(this.SelectedFolder);
            }
        }
        private void SelectLocationButton_Click(object sender, RoutedEventArgs e)
        {
            TaskListLocation workflowLocation = (TaskListLocation)this.Tag;

            SiteSetting siteSetting = (SiteSetting)SiteSettingComboBox.SelectedItem;
            Folder      rootFolder  = null;


            SiteContentSelections siteContentSelections = new SiteContentSelections();

            rootFolder = new SPWeb(siteSetting.Url, siteSetting.Url, siteSetting.ID, String.Empty, siteSetting.Url, siteSetting.Url);
            rootFolder.PublicFolder = true;
            siteContentSelections.InitializeForm(siteSetting, rootFolder, true, new int[] { 107 });

            if (siteContentSelections.ShowDialog(this.ParentWindow, "Site Content Selections") == true)
            {
                workflowLocation.Folder = siteContentSelections.SelectedFolder;
                workflowLocation.BasicFolderDefinition = workflowLocation.Folder.GetBasicFolderDefinition();
                SelectedFolderLabel.Content            = workflowLocation.Folder.GetUrl();
            }
            //    if (workflowLocation.Folder == null)
            //    {
            //    }
            //else
            //{
            //    rootFolder = workflowLocation.Folder;
            //    siteContentSelections.InitializeForm(siteSetting, rootFolder, true, new int[] { 107 });
            //    if (siteContentSelections.ShowDialog(this.ParentWindow, "Site Content Selections") == true)
            //    {
            //        workflowLocation.Folder = siteContentSelections.SelectedFolder;
            //        workflowLocation.BasicFolderDefinition = workflowLocation.Folder.GetBasicFolderDefinition();
            //        SelectedFolderLabel.Content = workflowLocation.Folder.GetUrl();
            //    }
            //}
        }
        private void ExplorerEditButton_Click(object sender, RoutedEventArgs e)
        {
            SiteSetting siteSetting = (SiteSetting)GeneralConfigurationListBox.SelectedItem;
            SPWeb       web         = new SPWeb(siteSetting.Url, siteSetting.Url, siteSetting.ID, String.Empty, siteSetting.Url, siteSetting.Url);

            web.PublicFolder = true;
            SiteContentSelections siteContentSelections = new SiteContentSelections();

            siteContentSelections.InitializeForm(siteSetting, web, false, null);
            if (siteContentSelections.ShowDialog(this, "Site Content Selections") == true)
            {
                ExplorerState.Folders.Add(web);
                RefreshGeneralConfigurationsListBox();
            }
        }
Beispiel #5
0
        private void SelectFromSubFoldersButton_Click(object sender, RoutedEventArgs e)
        {
            DocumentTemplateMapping documentTemplateMapping = LocationsComboBox.SelectedItem as DocumentTemplateMapping;

            SiteSetting           siteSetting           = ConfigurationManager.GetInstance().GetSiteSetting(documentTemplateMapping.Folder.SiteSettingID);
            IServiceManager       serviceManager        = ServiceManagerFactory.GetServiceManager(siteSetting.SiteSettingType);
            Folder                folder                = serviceManager.GetFolder(siteSetting, documentTemplateMapping.Folder);
            SiteContentSelections siteContentSelections = new SiteContentSelections();

            siteContentSelections.InitializeForm(siteSetting, folder, true, null);
            if (siteContentSelections.ShowDialog(this.ParentWindow, Languages.Translate("Save Location Selection")) == true)
            {
                this.SelectedFolder = siteContentSelections.SelectedFolder;
                this.SelectedFolderLabel.Content = this.SelectedFolder.Title;
            }
        }
        private void SelectLocationButton_Click(object sender, RoutedEventArgs e)
        {
            List <Folder> folders = new List <Folder>();

            foreach (SiteSetting siteSetting in Configuration.SiteSettings)
            {
                SPWeb web = new SPWeb(siteSetting.Url, siteSetting.Url, siteSetting.ID, siteSetting.Url, siteSetting.Url, siteSetting.Url);

                web.PublicFolder = true;
                folders.Add(web);
            }
            SiteContentSelections siteContentSelections = new SiteContentSelections();

            siteContentSelections.InitializeForm(Configuration.SiteSettings, folders, true, null);
            if (siteContentSelections.ShowDialog(this.ParentWindow, Languages.Translate("Save Location Selections")) == true)
            {
                Configuration.OutlookConfigurations.DefaultAttachmentSaveFolder = siteContentSelections.SelectedFolder.GetBasicFolderDefinition();
                this.SaveLocationTextBox.Text = siteContentSelections.SelectedFolder.Title;
            }
        }
        private void SelectLocationButton_Click(object sender, RoutedEventArgs e)
        {
            List <Folder> folders = new List <Folder>();

            foreach (SiteSetting siteSetting in this.SiteSettings)
            {
                SPWeb web = new SPWeb(siteSetting.Url, siteSetting.Url, siteSetting.ID, siteSetting.Url, siteSetting.Url, siteSetting.Url);
                web.PublicFolder = true;
                folders.Add(web);
            }
            SiteContentSelections siteContentSelections = new SiteContentSelections();

            siteContentSelections.InitializeForm(this.SiteSettings, folders, true, null);
            if (siteContentSelections.ShowDialog(this.ParentWindow, Languages.Translate("Save Location Selections")) == true)
            {
                this.SelectedFolder           = siteContentSelections.SelectedFolder;
                this.SaveLocationTextBox.Text = this.SelectedFolder.Title;
                this.LoadContentTypes(this.SelectedFolder);
            }
        }
Beispiel #8
0
        private void AttachmentsToSPButton_Click(object sender, RibbonControlEventArgs e)
        {
            Inspector inspector = this.Context as Inspector;

            if (inspector == null)
            {
                throw new System.Exception("This is not an inspector window.");
            }
            Outlook.MailItem mailItem = inspector.CurrentItem as Outlook.MailItem;
            if (mailItem == null)
            {
                throw new System.Exception("This is not a mail item.");
            }
            Sobiens.Connectors.Entities.Folder defaultAttachmentSaveFolder = ConfigurationManager.GetInstance().GetDefaultAttachmentSaveFolder();

            if (defaultAttachmentSaveFolder == null || ConfigurationManager.GetInstance().DontAskSaveAttachmentLocation == false)
            {
                SiteContentSelections   siteContentSelections     = new SiteContentSelections();
                SiteSettings            siteSettings              = ConfigurationManager.GetInstance().GetSiteSettings();
                List <ExplorerLocation> locations                 = ConfigurationManager.GetInstance().GetExplorerLocations(Sobiens.Connectors.Common.ApplicationContext.Current.GetApplicationType());
                List <Sobiens.Connectors.Entities.Folder> folders = ConfigurationManager.GetInstance().GetFoldersByExplorerLocations(locations, false);
                siteContentSelections.InitializeForm(siteSettings, folders, true, null);
                if (defaultAttachmentSaveFolder != null)
                {
                    siteContentSelections.SetSelectedFolder(defaultAttachmentSaveFolder);
                }

                if (siteContentSelections.ShowDialog(null, "Select attachment upload location") == false)
                {
                    return;
                }

                if (siteContentSelections.SelectedFolder == null)
                {
                    return;
                }

                defaultAttachmentSaveFolder = siteContentSelections.SelectedFolder;
            }

            SiteSetting     siteSetting           = ConfigurationManager.GetInstance().GetSiteSetting(defaultAttachmentSaveFolder.SiteSettingID);
            IServiceManager serviceManagerFactory = ServiceManagerFactory.GetServiceManager(siteSetting.SiteSettingType);

            string sourceFolder = ConfigurationManager.GetInstance().CreateATempFolder();
            List <Sobiens.Connectors.Entities.UploadItem> emailUploadFiles = new List <Sobiens.Connectors.Entities.UploadItem>();

            for (int i = mailItem.Attachments.Count; i > 0; i--)
            {
                Attachment attachment               = mailItem.Attachments[i];
                string     fileName                 = attachment.FileName;
                string     extensionName            = String.Empty;
                string     filenameWithoutExtension = String.Empty;
                if (fileName.LastIndexOf(".") > -1)
                {
                    extensionName            = fileName.Substring(fileName.LastIndexOf(".") + 1);
                    filenameWithoutExtension = fileName.Substring(0, fileName.LastIndexOf("."));
                }
                else
                {
                    filenameWithoutExtension = fileName;
                }

                string newFileName = string.Format("{0}_{1}.{2}", filenameWithoutExtension, DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss"), extensionName);
                string filePath    = string.Format("{0}\\{1}", sourceFolder, newFileName);
                attachment.SaveAsFile(filePath);
                Sobiens.Connectors.Entities.UploadItem uploadItem = new Entities.UploadItem();
                uploadItem.FilePath          = filePath;
                uploadItem.Folder            = defaultAttachmentSaveFolder;
                uploadItem.FieldInformations = new Dictionary <object, object>();

                Sobiens.Connectors.Common.ApplicationContext.Current.UploadFile(siteSetting, uploadItem, null, false, false, Upload_Success, Upload_Failed);

                string fileUrl = defaultAttachmentSaveFolder.GetUrl() + "/" + newFileName;
                if (mailItem.BodyFormat == OlBodyFormat.olFormatHTML)
                {
                    mailItem.HTMLBody = "<a href='" + fileUrl + "'>" + fileUrl + "</a><br>" + mailItem.HTMLBody;
                }
                else
                {
                    mailItem.Body = fileUrl + Environment.NewLine + mailItem.Body;
                }
                mailItem.Attachments[i].Delete();
            }
        }