Exemple #1
0
        private void showhelp()
        {
            AddToRtbLocal("Notes: " + "\r\n", StyleType.bodyChocolate);
            string s = @"The SUSHI 'Copy View' feature enables you to select an existing view and replicate it to another SharePoint list. Additional Help: http://www.codeplex.com/sushi/Wiki/View.aspx?title=Copy%20View&referringTitle=Home";

            SmartStepUtil.AddToRTB(rtbDisplay, s, StyleType.bodyBlack);
        }
Exemple #2
0
        private void displayPermissionsInheritance(SPWeb web)
        {
            bool siteInheritsButDisplayAsPlaceholder = true;

            if (web.HasUniqueRoleAssignments)
            {
                AddToRtbLocal(web.ServerRelativeUrl + "\r\n", StyleType.bodyBlueBold);
                siteInheritsButDisplayAsPlaceholder = false;
            }

            foreach (SPList spList in web.Lists)
            {
                if (spList.HasUniqueRoleAssignments && !spList.Hidden)
                {
                    if (siteInheritsButDisplayAsPlaceholder)
                    {
                        AddToRtbLocal(web.ServerRelativeUrl + "\r\n", StyleType.bodyDarkGray);
                        siteInheritsButDisplayAsPlaceholder = false;
                    }
                    AddToRtbLocal("   " + spList.Title + "\r\n", StyleType.bodySeaGreen);
                }
            }

            //--
            SmartStepUtil.ScrollToBottom(rtbDisplay);
            Application.DoEvents();

            //--recursively loop through all subwebs of top level site.
            foreach (SPWeb subWeb in web.Webs)
            {
                displayPermissionsInheritance(subWeb);
                subWeb.Dispose();
            }
        }
Exemple #3
0
        private void ActionThemes_Load(object sender, EventArgs e)
        {
            this.HelpKey = "Themes";
            if (this.DisableIfSharePointNotInstalledLocally())
            {
                return;
            }

            txtTargetSite.Text = GlobalVars.SETTINGS.theme_siteURL;

            foreach (Control c in this.Controls)
            {
                if (c is RadioButton && c.Name.StartsWith("optApply"))
                {
                    if (GlobalVars.SETTINGS.theme_ApplyToChildSitesOption == c.Name)
                    {
                        ((RadioButton)c).Checked = true;
                    }
                }
            }

            optApplyToParentSite.CheckedChanged             += new EventHandler(optApply_CheckedChanged);
            optApplyToChildren.CheckedChanged               += new EventHandler(optApply_CheckedChanged);
            optApplyToAllChildrenRecursively.CheckedChanged += new EventHandler(optApply_CheckedChanged);

            AddToRtbLocal("Notes: " + "\r\n", StyleType.bodyChocolate);
            string s = @"This feature allows you to apply theme to SharePoint sites and its sub sites. Here are the Steps that describe how to apply theme to a single site and its children sites. Additional Help: http://www.codeplex.com/sushi/Wiki/View.aspx?title=Themes&referringTitle=Home";

            SmartStepUtil.AddToRTB(rtbDisplay, s, StyleType.bodyBlack);
        }
Exemple #4
0
        private void runPermissionInheritanceForSiteCollection()
        {
            try
            {
                rtbDisplay.Clear();
                FrmCancelRunning.ToggleEnabled(true);
                using (SPWeb web = Util.RetrieveWeb(this.txtTargetSite.Text, this.rtbValidateMessage))
                {
                    AddToRtbLocal("Permissions Inheritance Report for Site ", StyleType.titleChocolate);
                    AddToRtbLocal(web.Url + "\r\n\r\n", StyleType.bodyBlueBold);

                    displayPermissionsInheritance(web);

                    SmartStepUtil.AddToRTB(rtbDisplay, "\r\nDONE", Color.Black, 8, true);
                    //AddToRtbLocal("\r\n\r\n\r\nReport Notes: This report shows all the SharePoint Sites and Lists that do not inherit permissions from their parent. Sites are displayed in blue, Lists are displayed in green. The server relative URL is used, so for example \"/\" is the root site. If a site is displayed in Gray it is simply a place holder, that site inherits permissions, but at least one of its child Lists does not. This report does not include hidden lists.", StyleType.bodyDarkGray);
                }
            }
            catch (Exception ex)
            {
                AddToRtbLocal(ex.Message, StyleType.bodyRed);
            }
            finally
            {
                FrmCancelRunning.ToggleEnabled(false);
            }
        }
Exemple #5
0
        /// <summary>
        /// note: not threadsafe
        /// </summary>
        public static SPWeb RetrieveWeb(string siteUrl, RichTextBox rtbValidateMessage)
        {
            try
            {
                MainForm.DefInstance.Cursor = Cursors.WaitCursor;
                rtbValidateMessage.Clear();
                if (siteUrl.Trim() == "")
                {
                    SmartStepUtil.AddToRTB(rtbValidateMessage, "site URL is blank", Color.Red, 8, false, SmartStepUtil.enumIcon.red_x);
                    return(null);
                }

                SPSite site;
                try
                {
                    site = new SPSite(siteUrl);
                }
                catch (Exception ex)
                {
                    SmartStepUtil.AddToRTB(rtbValidateMessage, "site not found: " + ex.Message + " ", Color.Red, 8, false, SmartStepUtil.enumIcon.red_x);
                    return(null);
                }

                SPWeb web = site.OpenWeb();
                SmartStepUtil.AddToRTB(rtbValidateMessage, "site found: " + web.Url + " ", Color.Green, 8, false, SmartStepUtil.enumIcon.green_check);
                return(web);
            }
            finally
            { MainForm.DefInstance.Cursor = Cursors.Default; }
        }
Exemple #6
0
        void showhelp()
        {
            string s = @"The backup feature in Sushi allows you to create manual or scheduled automatic backups of SharePoint. The SUSHI backup feature is simply a wrapper around the STSADM.exe -o export -url <sharepoint url> command. SUSHI gives you a way to easily build the commandline command without having to open up the console window. SUSHI also allows you to schedule regular backups that will run automatically. 
            Additional Help: http://www.codeplex.com/sushi/Wiki/View.aspx?title=Site%20backups&referringTitle=Home";

            SmartStepUtil.AddToRTB(rtbDisplay, s, StyleType.bodyBlack);
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            //--validate
            if (cboTargetContentType.SelectedItem == null)
            {
                SmartStepUtil.AddToRTB(rtbDisplay, "Target Content Type is blank.", Color.Red, 10, true);
                return;
            }

            //--
            if (m_editingMPindex == -1) //--Mapping Profile is new
            {
                ActionMetaDataUtil.MappingProfiles.Add(m_mpWorking);
            }
            else
            {
                ActionMetaDataUtil.MappingProfiles[m_editingMPindex] = m_mpWorking;
            }

            //--refresh cboMappingProfile
            ActionMetadata.DefInstance.populateCboMappingProfiles();
            //ActionMetadata.DefInstance.cboMappingProfile.SelectedItem = m_mpWorking;
            ActionMetadata.DefInstance.cboMappingProfile.SelectedIndex = ActionMetadata.DefInstance.cboMappingProfile.FindStringExact(m_mpWorking.ProfileName);
            //ActionMetadata.DefInstance.cboMappingProfile.Refresh();
            //--
            ActionMetaDataUtil.SaveMappingProfileToXml();
            //

            //--
            ActionMetadata.DefInstance.rtbDisplay.Clear();
            this.Close();
        }
        string _cboDocLibText; //this variable is to prevent cross-thread errors
        private void uploadAFolderPrep()
        {
            try
            {
                SPSite sps = new SPSite(txtTargetSite.Text); //note, unable to call Util.RetrieveWeb(), because it throws COM errors..
                SPWeb  web = sps.OpenWeb();

                //--kickoff
                DirectoryInfo localSourceDirRoot = new DirectoryInfo(txtLocalSourceDir.Text);
                SPFolder      docLibFolder       = web.GetFolder(_cboDocLibText);


                SmartStepUtil.AddToRTB(rtbDisplay, "Upload Started\r\n", Color.Black, 12, true);
                if (!chkCreateRootFolderInSharepoint.Checked)
                {
                    SmartStepUtil.AddToRTB(rtbDisplay, "uploading files in root folder\r\n");
                }
                UploadAFolder(docLibFolder, localSourceDirRoot, chkCreateRootFolderInSharepoint.Checked);
                SmartStepUtil.AddToRTB(rtbDisplay, txtDispCounters.Text + "\r\n", Color.Brown, 8, false);
                SmartStepUtil.AddToRTB(rtbDisplay, "Upload Completed\r\n\r\n\r\n", Color.Green, 12, true);
            }
            catch (Eh.CancelException)
            {
                SmartStepUtil.AddToRTB(rtbDisplay, "Upload Cancelled by user\r\n", Color.Red, 12, true);
            }
            catch (Exception ex)
            {
                Eh.GlobalErrorHandler(ex);
            }
            toggleCancel(false, false, true);
            SmartStepUtil.ScrollToBottom(rtbDisplay);
        }
Exemple #9
0
        private void StartRestore2(bool onlyValidate, string backupToRestore)
        {
            try
            {
                //TODO: have user type in the word "RESTORE" if destination URL already exists.

                string   destUrl             = txtRestoreDestinationURL.Text;
                FileInfo fiBackup            = new FileInfo(txtBackupPath.Text + "\\" + backupToRestore);
                string   includeUserSecurity = chkIncludeUserSecurity.Checked ? "-includeusersecurity" : "";
                SmartStepUtil.AddToRTB(rtbDisplay, "backup to restore:   ");
                SmartStepUtil.AddToRTB(rtbDisplay, fiBackup.Name + "\r\n", Color.Black, 0, true);
                SmartStepUtil.AddToRTB(rtbDisplay, "destination URL:      ");
                SmartStepUtil.AddToRTB(rtbDisplay, destUrl + "\r\n", Color.Black, 0, true);

                //--validate destination site URL
                SPSite site;
                try
                {
                    site = new SPSite(txtRestoreDestinationURL.Text);
                }
                catch (Exception ex)
                {
                    SmartStepUtil.AddToRTB(rtbDisplay, ex.Message, Color.Red, 0, false);
                    return;
                }

                SPWeb web = site.OpenWeb();
                SmartStepUtil.AddToRTB(rtbDisplay, "destination SPS Site: " + web.Url);
                if ((new Uri(txtRestoreDestinationURL.Text)).ToString() == (new Uri(web.Url)).ToString())
                {
                    SmartStepUtil.AddToRTB(rtbDisplay, " same, content will be overwritten ", Color.Firebrick, 0, false);
                }
                else
                {
                    SmartStepUtil.AddToRTB(rtbDisplay, " not same, a new site will be created ", Color.Firebrick, 0, false);
                }
                SmartStepUtil.AddToRTB(rtbDisplay, "\r\n");

                string args = string.Format(@"-o import -url ""{0}"" -filename ""{1}"" {2} ", destUrl, fiBackup.FullName, includeUserSecurity);;
                SmartStepUtil.AddToRTB(rtbDisplay, "stsadm.exe " + args, Color.Gray, 8, false);
                if (onlyValidate)
                {
                    SmartStepUtil.AddToRTB(rtbDisplay, "validating only\r\n", Color.YellowGreen, 0, true);
                }
                else
                {
                    SmartStepUtil.AddToRTB(rtbDisplay, "restore started\r\n", Color.SeaGreen, 0, true);
                    ProcessStartInfo si = new ProcessStartInfo();
                    si.Arguments = args;
                    si.FileName  = GlobalVars.StsadmExePath;
                    Process ret = Process.Start(si);
                    ret.WaitForExit();
                    SmartStepUtil.AddToRTB(rtbDisplay, "restore complete\r\n\r\n", Color.SeaGreen, 0, true);
                }
            }
            catch (Exception ex)
            {
                Eh.GlobalErrorHandler(ex);
            }
        }
        private void displayNotes()
        {
            AddToRtbLocal("Notes:", StyleType.bodyChocolate);
            string s = @"This feature allows you to bulk upload images for your user profiles and update the user profile to point to the image. This image will display on the user's MySite page and in the user profile. Additional Help: http://www.codeplex.com/sushi/Wiki/View.aspx?title=Profile%20Images&referringTitle=Home";

            SmartStepUtil.AddToRTB(rtbDisplay, s, StyleType.bodyBlack);
        }
Exemple #11
0
        private void StartBackup3(bool onlyValidate, string siteURLtoBackup, int urlCount)
        {
            SPSite sps = new SPSite(siteURLtoBackup); //note, unable to call Util.RetrieveWeb(), because it throws asynchronous errors or COM errors
            SPWeb  web = sps.OpenWeb();

            _totalSites = 0;
            //if (chkcompress.Checked == true)
            BackupRecursively(web, onlyValidate, true, true);
            //else
            //    BackupRecursively(web, onlyValidate, true, false);


            //--
            if (this.optBackupAllSubsites.Checked)
            {
                string s = (_totalSites > 1) ? "s" : "";
                if (onlyValidate)
                {
                    SmartStepUtil.AddToRTB(rtbDisplay, "\r\n" + _totalSites + " site" + s + " to be backed up for top site #" + urlCount + "\r\n", Color.Gray, 8, true);
                }
                else
                {
                    SmartStepUtil.AddToRTB(rtbDisplay, "\r\nBatch Complete. " + _totalSites + " site" + s + " backed up for top site #" + urlCount + "\r\n", Color.Gray, 8, true);
                }
            }
            SmartStepUtil.ScrollToBottom(rtbDisplay);
        }
Exemple #12
0
        void deleteOldFilesAsync(bool validateOnly)
        {
            rtbDisplay.Clear();

            //--Validate
            if (cklbDocLibs.CheckedItems.Count == 0)
            {
                SmartStepUtil.AddToRTB(rtbDisplay, "Please select a Document Library to Delete From", StyleType.bodyRed);
                return;
            }

            if (!Directory.Exists(txtArchiveDest.Text))
            {
                SmartStepUtil.AddToRTB(rtbDisplay, "Archive Folder '" + txtArchiveDest.Text + "' is not valid.", StyleType.bodyRed);
                return;
            }

            //--
            _cancel = false;
            toggle(false);

            deleteOldFilesDelegate d = new deleteOldFilesDelegate(deleteOldFiles);

            d.BeginInvoke(validateOnly, txtTargetSite.Text, null, null);
        }
        private void dgNewSites_DataError(object sender, DataGridViewDataErrorEventArgs e)
        {
            e.ThrowException = false;
            e.Cancel         = true;
            AddToRtbLocal("Gridview DataError at row " + (e.RowIndex + 1) + ", column " + (e.ColumnIndex + 1) + " message:" + e.Exception.Message + "\r\n", StyleType.bodyRed);

            SmartStepUtil.ScrollToBottom(rtbDisplay);
        }
Exemple #14
0
        private void lnkRenameListURL_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            rtbDisplay.Clear();
            string s = @"How to rename the URL name of a List:
                    Tip: To rename a list URL, use SharePoint designer. Within SharePoint Designer, navigate to the SharePoint Site containing the List, highlight the List URL you wish to rename and press F2 to rename.
                    Background: It is easy to change the title of a list or site, and it is easy to change the URL of a Site. But the SharePoint web interface does not provide a way to change the URL Name of a List. SharePoint Designer 2007 allows you to accomplish this task.";

            SmartStepUtil.AddToRTB(rtbDisplay, s, StyleType.bodyChocolate);
        }
        private string CleanFileOrFolderName(string dirtyFileName)
        {
            string cleanName = Util.StripCharactersSharepointDoesNotLike(dirtyFileName);

            if (cleanName != dirtyFileName)
            {
                SmartStepUtil.AddToRTB(rtbDisplay, "    RENAMED FILE: '" + dirtyFileName + "' renamed to '" + cleanName + "'\r\n", Color.Purple, 8, false);
                _dispIllegalChars++;
            }
            return(cleanName);
        }
        private void validOrInvalid(bool isValid)
        {
            if (isValid)
            {
                SmartStepUtil.AddToRTB(rtbDisplay, " valid ", Color.Green, 10, false, SmartStepUtil.enumIcon.green_check);
            }
            else
            {
                SmartStepUtil.AddToRTB(rtbDisplay, " invalid ", Color.Red, 10, false, SmartStepUtil.enumIcon.red_x);
            }

            SmartStepUtil.AddToRTB(rtbDisplay, "\r\n");
        }
Exemple #17
0
        private void runFindAllPermissionsForUser()
        {
            try
            {
                rtbDisplay.Clear();
                FrmCancelRunning.ToggleEnabled(true);

                if (cboUsers.SelectedItem == null)
                {
                    AddToRtbLocal("please select a user\r\n", StyleType.bodyRed);
                    return;
                }
                using (SPWeb web = Util.RetrieveWeb(this.txtTargetSite.Text, this.rtbValidateMessage))
                {
                    //--
                    SPUser user = (SPUser)cboUsers.SelectedItem;
                    AddToRtbLocal("Permissions for user ", StyleType.titleChocolate);
                    AddToRtbLocal(user.LoginName, StyleType.titleBlue);
                    AddToRtbLocal(" site ", StyleType.bodyChocolateBold);
                    AddToRtbLocal(web.Url + "\r\n", StyleType.bodyBlueBold);

                    checkThatCurrentUserHasCorrectPriviledges(web);
                    //--build list of user's SharePoint and Active Directory Groups
                    List <string> userSharepointGroups = new List <string>();
                    foreach (SPGroup group in user.Groups)
                    {
                        userSharepointGroups.Add(group.Name.ToUpper());
                    }

                    AddToRtbLocal("Looking up Active Directory groups for user...    ", StyleType.bodyDarkGray);
                    List <string> userADgroups = findADgroupsForUser(false, user, Environment.UserDomainName);
                    AddToRtbLocal(userADgroups.Count.ToString(), StyleType.bodyBlack);
                    AddToRtbLocal(" Active Directory groups found.\r\n", StyleType.bodyDarkGray);

                    AddToRtbLocal("\r\n", StyleType.bodyBlack);
                    AddToRtbLocal("________________________________________________________________________\r\n", StyleType.bodyBlack);
                    findRoleAssignments(web, user, 1, userSharepointGroups, userADgroups);
                    AddToRtbLocal("________________________________________________________________________\r\n", StyleType.bodyBlack);

                    SmartStepUtil.AddToRTB(rtbDisplay, "\r\nDONE", Color.Black, 8, true);
                }
            }
            catch (Exception ex)
            {
                AddToRtbLocal("error: " + ex.Message, StyleType.bodyRed);
            }
            finally
            {
                FrmCancelRunning.ToggleEnabled(false);
            }
        }
        private void ActionBulkSiteCreation_Load(object sender, EventArgs e)
        {
            this.HelpKey = "Bulk site creation";
            if (this.DisableIfSharePointNotInstalledLocally())
            {
                return;
            }

            txtTargetSite.Text             = GlobalVars.SETTINGS.bulkSiteCreate_siteUrl;
            chkOnlyCustomTemplates.Checked = GlobalVars.SETTINGS.bulkSiteCreate_onlyCustomTemplates;
            AddToRtbLocal("Notes: " + "\r\n", StyleType.bodyChocolate);
            string s = @"This feature enables the bulk creation of subsites based on a site template. Additional Help: http://www.codeplex.com/sushi/Wiki/View.aspx?title=Bulk%20Site%20Creation&referringTitle=Home";

            SmartStepUtil.AddToRTB(rtbDisplay, s, StyleType.bodyBlack);
        }
Exemple #19
0
        private void lnkOpenSiteManager_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            rtbDisplay.Clear();


            string u = txtTargetSite.Text + "/_layouts/sitemanager.aspx";

            Util.OpenURLinDefaultBrowser(u, rtbDisplay);
            SmartStepUtil.AddToRTB(rtbDisplay, "Navigating to " + u + "\r\n\r\n", StyleType.bodySeaGreen);

            string s = @"Site Manager is useful for giving you a view of all the Sites and Lists in your Site Collection. 

TIP: One useful feature is the ability to delete many lists at once. Within Site Manager, navigate to the Site containing the lists you wish to delete and check all the lists you wish to delete, then click Delete under the actions menu.";

            SmartStepUtil.AddToRTB(rtbDisplay, s, StyleType.bodyChocolate);
        }
Exemple #20
0
        private void ActionEmail_Load(object sender, EventArgs e)
        {
            this.HelpKey = "Email Test";
            if (this.DisableIfSharePointNotInstalledLocally())
            {
                return;
            }

            //--remember these values
            txtFromEmail.Text         = GlobalVars.SETTINGS.settings_testEmailFrom;
            txtSMTP.Text              = GlobalVars.SETTINGS.settings_testEmailSMTP;
            this.txtSMTP.TextChanged += new System.EventHandler(this.txtSMTP_TextChanged);
            AddToRtbLocal("Notes: " + "\r\n", StyleType.bodyChocolate);
            string s = @"Use the Email Test SUSHI tab to test if outbound email is set up correctly. In SharePoint Central Administration you can specify an ""Outbound SMTP server"" which is used to generate emails for alerts, and notifications. In order for outbound email to successfully send, the SMTP server needs to allow anonymous relaying from the IP addresses of the web front end servers in your SharePoint Farm. If email is set up correctly, SUSHI will display ""Successfully sent test email to SMTP server."" which means that the SMTP server recieved the email request and did not throw an error and you should shortly recieve an email. If email is set up incorrectly, you will see an error message and SUSHI will display in red the error message thrown. Unfortunately, SUSHI can't always tell you exactly why the SMTP server failed to send because it isn't possible to detect how your SMTP server is set up, but at least you know immediately that it failed, and you will know that it is a SMTP routing issue and not a SharePoint timer issue, or some other SharePoint problem.When you press the ""Send Test Email"" button, SUSHI simply instantiates a MailMessage object and uses the System.Net.Mail.SmtpClient class to attempt to send an email. The subject of the email will be """ + _subject + @""". Additional Help: http://www.codeplex.com/sushi/Wiki/View.aspx?title=Email%20Test&referringTitle=Home";

            SmartStepUtil.AddToRTB(rtbDisplay, s, StyleType.bodyBlack);
        }
Exemple #21
0
        private void ActionBulkSiteCreation_Load(object sender, EventArgs e)
        {
            this.HelpKey = "Bulk List Creation";
            if (this.DisableIfSharePointNotInstalledLocally())
            {
                return;
            }

            txtTargetSite.Text = GlobalVars.SETTINGS.bulkListCreate_siteUrl;
            ToolTip t = new ToolTip();

            t.SetToolTip(lnkOpenSiteManager, "Open Site Manager to view existing lists, delete existing lists, view settings, etc.");
            AddToRtbLocal("Notes: " + "\r\n", StyleType.bodyChocolate);
            string s = @"This feature allows you to bulk create SharePoint Lists.If you want to create many document libraries, or other lists, this feature of SUSHI will be quite helpful to you. Additional Help: http://www.codeplex.com/sushi/Wiki/View.aspx?title=Bulk%20List%20Creation&referringTitle=Home";

            SmartStepUtil.AddToRTB(rtbDisplay, s, StyleType.bodyBlack);
        }
 private void imgBrowse_Click(object sender, EventArgs e)
 {
     try
     {
         SPList list = (SPList)cboDocLib.SelectedItem;
         if (list == null)
         {
             return;
         }
         string url = list.ParentWeb.Url + "/" + list.RootFolder.Url;
         Util.OpenURLinDefaultBrowser(url, rtbDisplay);
     }
     catch (Exception ex)
     {
         SmartStepUtil.AddToRTB(rtbDisplay, ex);
     }
 }
Exemple #23
0
 public static void OpenURLinDefaultBrowser(string url, RichTextBox rtbIfError)
 {
     try
     {
         SmartStepUtil.ClearRtbSafely(rtbIfError);
         if (string.IsNullOrEmpty(url))
         {
             SmartStepUtil.AddToRTB(rtbIfError, "Unable to browse because URL is blank.", StyleType.bodyOrange);
             return;
         }
         Process.Start(url);
     }
     catch (Exception ex)
     {
         SmartStepUtil.AddToRTB(rtbIfError, "Unable to browse to " + url + ", error:" + ex.Message, StyleType.bodyRed);
     }
 }
Exemple #24
0
        private void lnkShowAllMetadata_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                FrmCancelRunning.ToggleEnabled(true); //toggleEnabled(true);
                SPList list = (SPList)cboDocLibs.SelectedItem;
                //--
                rtbDisplay.Clear();
                foreach (SPListItem listitem in list.Items)
                {
                    SmartStepUtil.AddToRTB(rtbDisplay, "Properties for  " + listitem.File.Name + "\r\n", Color.Green, 10, true);
                    List <string> props = new List <string>();
                    foreach (string item in listitem.File.Properties.Keys)
                    {
                        props.Add(item);
                    }
                    props.Sort();
                    foreach (string item in props)
                    {
                        SmartStepUtil.AddToRTB(rtbDisplay, item + ": ");
                        SmartStepUtil.AddToRTB(rtbDisplay, listitem.File.Properties[item].ToString() + "[" + listitem.File.Properties[item].GetType().Name + "]\r\n", Color.Blue, 8, false);
                    }
                    AddToRtbLocal("\r\n", StyleType.bodyBlack);

                    if (GlobalVars.CancelRunning)
                    {
                        throw new Eh.CancelException();
                    }
                }
            }
            catch (Eh.CancelException)
            {
                AddToRtbLocal("cancelled by user", StyleType.bodyBlackBold);
            }
            catch (Exception ex)
            {
                Eh.GlobalErrorHandler(ex);
            }
            finally
            {
                FrmCancelRunning.ToggleEnabled(false); //toggleEnabled(false);
            }
            SmartStepUtil.ScrollToBottom(rtbDisplay);
        }
        private void displayMappingProfileInRtb(string item, string action)
        {
            rtbDisplay.Clear();
            AddToRTBLocal("Mapping Profile Name: " + m_mpWorking.ProfileName + "\r\n", StyleType.titleBlue);
            foreach (MappingItem mi in m_mpWorking.MappingItems)
            {
                AddToRTBLocal(mi.ToString() + "\r\n", StyleType.bodyBlack);
            }
            if (m_mpWorking.MappingItems.Count == 0)
            {
                AddToRtbLocal("(No column mappings defined.)\r\n");
            }

            if (item != null)
            {
                SmartStepUtil.AddToRTB(rtbDisplay, "\r\n" + item, Color.SeaGreen, 8, true);
                AddToRTBLocal(" was " + action + "\r\n", StyleType.bodySeaGreen);
            }
        }
        private void lnkShowAllTemplates_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            SPWeb web = Util.RetrieveWeb(txtTargetSite.Text, rtbSiteValidateMessage);

            if (web == null)
            {
                return;
            }
            txtTargetSite.Text = web.Url;

            SPWebTemplateCollection templates = web.Site.GetWebTemplates(1033);

            rtbDisplay.Clear();
            SmartStepUtil.AddToRTB(rtbDisplay, "Site Template Information\r\n", Color.Blue, 10, true);
            foreach (SPWebTemplate template in templates)
            {
                SmartStepUtil.AddToRTB(rtbDisplay, "name:" + template.Name + ", title:" + template.Title + "\r\n");
            }
        }
Exemple #27
0
        private void lnkShowColumnInfo_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (cboColumnNames.SelectedItem == null)
            {
                return;
            }
            FieldAndContentType fct = (FieldAndContentType)cboColumnNames.SelectedItem;

            rtbDisplay.Clear();
            SmartStepUtil.AddToRTB(rtbDisplay, "Information about the Column ", Color.Blue, 13, true);
            SmartStepUtil.AddToRTB(rtbDisplay, fct.Field.Title + "\r\n", Color.MediumBlue, 13, true);
            //--
            SortedDictionary <string, int> uniqueValues = createUniqueListOfColumnValues();

            SmartStepUtil.AddToRTB(rtbDisplay, "List of unique values:\r\n", Color.Black, 8, true);
            foreach (KeyValuePair <string, int> de in uniqueValues)
            {
                SmartStepUtil.AddToRTB(rtbDisplay, "   " + de.Key + " (" + de.Value + ")\r\n");
            }

            //--
            List <string> fieldPropertyNames = new List <string>();

            System.Collections.Hashtable fieldPropertyValues = new System.Collections.Hashtable();
            AddToRtbLocal("\r\n\r\n", StyleType.bodyBlack);
            SmartStepUtil.AddToRTB(rtbDisplay, "Technical Info: (All properties of the column)\r\n ", Color.Black, 8, true);
            foreach (System.Reflection.PropertyInfo propInfo in fct.Field.GetType().GetProperties())
            {
                object val = propInfo.GetValue(fct.Field, null);
                fieldPropertyNames.Add(propInfo.Name);
                fieldPropertyValues.Add(propInfo.Name, val);
            }

            //--
            fieldPropertyNames.Sort();
            foreach (string item in fieldPropertyNames)
            {
                AddToRtbLocal(item + ": ", StyleType.bodyBlack);
                SmartStepUtil.AddToRTB(rtbDisplay, fieldPropertyValues[item] + "\r\n", Color.Blue, 8, false);
            }
        }
Exemple #28
0
        private void lnkDeleteSourceColumns_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            rtbDisplay.Clear();
            //TODO: redo to just display a form with checkboxes to delete columns, listing all content types besides target content type and folder content type.

            if (cboMappingProfile.SelectedItem == null)
            {
                return;
            }

            SPList         list = (SPList)cboDocLibs.SelectedItem;
            MappingProfile mp   = (MappingProfile)cboMappingProfile.SelectedItem;

            //--
            AddToRtbLocal("Deleting source columns from document library\r\n", StyleType.titleSeagreen);

            if (!findColoumRefFromInternalName(mp, list))
            {
                return;
            }

            DialogResult ret = MessageBox.Show(this, "Are you sure you want to delete these " + mp.MappingItems.Count + " columns?", "SUSHI", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (ret == DialogResult.Yes)
            {
                foreach (MappingItem mi in mp.MappingItems)
                {
                    SPField field = list.Fields[mi.sourceID];
                    if (field.CanBeDeleted == false)
                    {
                        SmartStepUtil.AddToRTB(rtbDisplay, "can't delete source column " + mi.SourceColumn + ", because it is an undeletable column\r\n");
                    }
                    else
                    {
                        SmartStepUtil.AddToRTB(rtbDisplay, "deleting source column " + mi.SourceColumn);
                        field.Delete();
                        SmartStepUtil.AddToRTB(rtbDisplay, " done. \r\n", StyleType.bodyBlackBold);
                    }
                }
            }
        }
Exemple #29
0
        private void StartBackup2(bool onlyValidate)
        {
            try
            {
                if (!System.IO.Directory.Exists(txtBackupPath.Text))
                {
                    SmartStepUtil.AddToRTB(rtbDisplay, "Backup folder '" + txtBackupPath.Text + "' does not exist.", Color.Red, 10, false);
                    return;
                }

                if (onlyValidate)
                {
                    SmartStepUtil.AddToRTB(rtbDisplay, "validating only\r\n\r\n", Color.SeaGreen, 11, true);
                }

                int urlCount = 0;
                foreach (string item in lstSiteURLs.Items)
                {
                    urlCount++;
                    StartBackup3(onlyValidate, item, urlCount);
                }

                //--
                if (!onlyValidate)
                {
                    SmartStepUtil.AddToRTB(rtbDisplay, "backup complete\r\n\r\n", Color.SeaGreen, 11, true);
                }
            }
            catch (Eh.CancelException)
            {
                SmartStepUtil.AddToRTB(rtbDisplay, "Backup Cancelled by user\r\n", Color.Red, 12, true);
            }
            catch (Exception ex)
            {
                Eh.GlobalErrorHandler(ex);
            }
            finally
            {
                toggleCancel(false, false, true);
            }
        }
Exemple #30
0
        private void ActionMetadata_Load(object sender, EventArgs e)
        {
            this.HelpKey = "Meta Data";
            if (this.DisableIfSharePointNotInstalledLocally())
            {
                return;
            }


            //--
            txtTargetSite.Text        = GlobalVars.SETTINGS.metadata_siteURL;
            tabControl1.SelectedIndex = GlobalVars.SETTINGS.metadata_selectedTab;

            //--
            ActionMetaDataUtil.LoadMappingProfilesFromXml();
            populateCboMappingProfiles();
            AddToRtbLocal("Notes: " + "\r\n", StyleType.bodyChocolate);
            string s = @"This feature of SUSHI helps with several metadata mass-update and grooming tasks. In a Search Engine world, metadata is key and keeping metadata accurate is key to findability, which is why this feature of SUSHI can be quite helpful. Additional Help: http://www.codeplex.com/sushi/Wiki/View.aspx?title=Meta%20Data&referringTitle=Home";

            SmartStepUtil.AddToRTB(rtbDisplay, s, StyleType.bodyBlack);
        }
 private void AddToRtbLocal(string strText, StyleType style, SmartStepUtil.enumIcon icon)
 {
     SmartStepUtil.AddToRTB(rtbDisplay, strText, style, icon);
 }