/// <summary>
        /// Runs the specified command.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="keyValues">The key values.</param>
        /// <param name="output">The output.</param>
        /// <returns></returns>
        public override int Execute(string command, StringDictionary keyValues, out string output)
        {
            output = string.Empty;

            string url = Params["url"].Value;

            if (url != null)
            {
                url = url.TrimEnd('/');
            }

            Common.Lists.ReplaceFieldValues rfv = new Common.Lists.ReplaceFieldValues();
            rfv.LogFile = Params["logfile"].Value;
            if (Params["field"].UserTypedIn)
            {
                rfv.FieldName.Add(Params["field"].Value);
            }
            rfv.Publish = Params["publish"].UserTypedIn;
            rfv.Quiet   = Params["quiet"].UserTypedIn;
            rfv.Test    = Params["test"].UserTypedIn;
            rfv.UseInternalFieldName = Params["useinternalfieldname"].UserTypedIn;

            if (Params["inputfile"].UserTypedIn)
            {
                rfv.ParseInputFile(Params["inputfile"].Value, Params["inputfiledelimiter"].Value, Params["inputfileisxml"].UserTypedIn);
            }
            else
            {
                rfv.SearchStrings.Add(new Common.Lists.ReplaceFieldValues.SearchReplaceData(Params["searchstring"].Value, Params["replacestring"].Value));
            }
            if (rfv.SearchStrings.Count == 0)
            {
                throw new SPException("No search strings were specified.");
            }

            string scope = Params["scope"].Value.ToLowerInvariant();

            if (scope == "farm")
            {
                foreach (SPService svc in SPFarm.Local.Services)
                {
                    if (!(svc is SPWebService))
                    {
                        continue;
                    }

                    foreach (SPWebApplication webApp in ((SPWebService)svc).WebApplications)
                    {
                        rfv.ReplaceValues(webApp);
                    }
                }
            }
            else if (scope == "webapplication")
            {
                SPWebApplication webApp = SPWebApplication.Lookup(new Uri(url));
                rfv.ReplaceValues(webApp);
            }
            else if (scope == "site")
            {
                using (SPSite site = new SPSite(url))
                {
                    rfv.ReplaceValues(site);
                }
            }
            else if (scope == "web")
            {
                using (SPSite site = new SPSite(url))
                    using (SPWeb web = site.AllWebs[Utilities.GetServerRelUrlFromFullUrl(url)])
                    {
                        rfv.ReplaceValues(web);
                    }
            }
            else if (scope == "list")
            {
                SPList list = Utilities.GetListFromViewUrl(url);
                rfv.ReplaceValues(list);
            }

            return((int)ErrorCodes.NoError);
        }
        /// <summary>
        /// Runs the specified command.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="keyValues">The key values.</param>
        /// <param name="output">The output.</param>
        /// <returns></returns>
        public override int Execute(string command, StringDictionary keyValues, out string output)
        {
            output = string.Empty;

            string url = Params["url"].Value;
            if (url != null)
                url = url.TrimEnd('/');

            Common.Lists.ReplaceFieldValues rfv = new Common.Lists.ReplaceFieldValues();
            rfv.LogFile = Params["logfile"].Value;
            if (Params["field"].UserTypedIn)
                rfv.FieldName.Add(Params["field"].Value);
            rfv.Publish = Params["publish"].UserTypedIn;
            rfv.Quiet = Params["quiet"].UserTypedIn;
            rfv.Test = Params["test"].UserTypedIn;
            rfv.UseInternalFieldName = Params["useinternalfieldname"].UserTypedIn;

            if (Params["inputfile"].UserTypedIn)
            {
                rfv.ParseInputFile(Params["inputfile"].Value, Params["inputfiledelimiter"].Value, Params["inputfileisxml"].UserTypedIn);
            }
            else
            {
                rfv.SearchStrings.Add(new Common.Lists.ReplaceFieldValues.SearchReplaceData(Params["searchstring"].Value, Params["replacestring"].Value));
            }
            if (rfv.SearchStrings.Count == 0)
                throw new SPException("No search strings were specified.");

            string scope = Params["scope"].Value.ToLowerInvariant();

            if (scope == "farm")
            {
                foreach (SPService svc in SPFarm.Local.Services)
                {
                    if (!(svc is SPWebService))
                        continue;

                    foreach (SPWebApplication webApp in ((SPWebService)svc).WebApplications)
                    {
                        rfv.ReplaceValues(webApp);
                    }
                }
            }
            else if (scope == "webapplication")
            {
                SPWebApplication webApp = SPWebApplication.Lookup(new Uri(url));
                rfv.ReplaceValues(webApp);
            }
            else if (scope == "site")
            {
                using (SPSite site = new SPSite(url))
                {
                    rfv.ReplaceValues(site);
                }
            }
            else if (scope == "web")
            {
                using (SPSite site = new SPSite(url))
                using (SPWeb web = site.AllWebs[Utilities.GetServerRelUrlFromFullUrl(url)])
                {
                    rfv.ReplaceValues(web);
                }
            }
            else if (scope == "list")
            {
                SPList list = Utilities.GetListFromViewUrl(url);
                rfv.ReplaceValues(list);
            }

            return (int)ErrorCodes.NoError;
        }