Beispiel #1
0
        public string GetFieldAsXml(bool required)
        {
            switch (Type)
            {
            case ("TaxonomyFieldType"):
            {
                return(GetSelfClosingFieldXml(required, "ShowField=\"Term1033\" Indexed=\"TRUE\""));
            }

            case ("TaxonomyFieldTypeMulti"):
            {
                return(GetSelfClosingFieldXml(required, "ShowField=\"Term1033\" Mult=\"TRUE\""));
            }

            case ("Choice"):
            {
                return(GetFieldWithContentXml(required, "FillInChoice=\"" + FillInChoice.ToString().ToUpper() + "\"", GetChoiceFieldXmlContent()));
            }

            case ("MultiChoice"):
            {
                return(GetFieldWithContentXml(required, "FillInChoice=\"" + FillInChoice.ToString().ToUpper() + "\"", GetChoiceFieldXmlContent()));
            }

            case ("Calculated"):
            {
                return(GetFieldWithContentXml(required, string.Format("ResultType=\"{0}\"", CalculatedProps.ResultType), GetCalculatedFieldXmlContent()));
            }

            case ("Number"):
            {
                var options = (Min != null ? "Min=\"" + Min + "\"" : "") + (Max != null ? " Max=\"" + Max + "\"" : "");
                return(GetSelfClosingFieldXml(required, options));
            }

            case ("Note"):
            {
                var options = NumLines != null && NumLines != 0 ? "NumLines=\"" + NumLines + "\"" : "";
                return(GetSelfClosingFieldXml(required, options));
            }

            default:
            {
                return(GetSelfClosingFieldXml(required, string.Empty));
            }
            }
        }
Beispiel #2
0
        public string GetFieldAsXml(bool required)
        {
            switch (Type)
            {
            case ("TaxonomyFieldType"):
            {
                return(GetFieldXml(required, "ShowField=\"Term1033\" Indexed=\"TRUE\""));
            }

            case ("TaxonomyFieldTypeMulti"):
            {
                return(GetFieldXml(required, "ShowField=\"Term1033\" Mult=\"TRUE\""));
            }

            case ("Choice"):
            {
                return(GetFieldXml(required, "FillInChoice=\"" + FillInChoice.ToString().ToUpper() + "\"", GetChoiceFieldXmlContent()));
            }

            case ("MultiChoice"):
            {
                return(GetFieldXml(required, "FillInChoice=\"" + FillInChoice.ToString().ToUpper() + "\"", GetChoiceFieldXmlContent()));
            }

            case ("Calculated"):
            {
                return(GetFieldXml(required, string.Format("ResultType=\"{0}\"", CalculatedProps.ResultType), GetCalculatedFieldXmlContent()));
            }

            case ("Number"):
            {
                var options = (Min != null ? "Min=\"" + Min + "\"" : "") + (Max != null ? " Max=\"" + Max + "\"" : string.Empty);
                return(GetFieldXml(required, options));
            }

            case ("HTML"):
            {
                const string additionalProps = "RichText=\"TRUE\" RichTextMode=\"FullHtml\" UnlimitedLengthInDocumentLibrary=\"TRUE\"";
                return(GetFieldXml(false, additionalProps));
            }

            case ("Lookup"):
            {
                string additionalProps = String.Format("List=\"{0}\" UnlimitedLengthInDocumentLibrary=\"FALSE\"", List, ShowField);
                return(GetFieldXml(false, additionalProps));
            }

            case ("LookupMulti"):
            {
                string additionalProps = String.Format("List=\"{0}\" UnlimitedLengthInDocumentLibrary=\"FALSE\"", List, ShowField);
                return(GetFieldXml(false, additionalProps));
            }

            case ("Note"):
            {
                var options = NumLines != null && NumLines != 0 ? "NumLines=\"" + NumLines + "\"" : string.Empty;
                options += RichText ? " RichText=\"TRUE\"" : string.Empty;
                options += UnlimitedLengthInDocumentLibrary
                        ? " UnlimitedLengthInDocumentLibrary=\"TRUE\""
                        : string.Empty;
                options += !string.IsNullOrEmpty(RichTextMode) ? String.Format(" RichTextMode=\"{0}\"", RichTextMode) : string.Empty;
                options += String.Format(" AppendOnly=\"{0}\"", AppendOnly.ToString().ToUpper());
                return(GetFieldXml(required, options));
            }

            case ("UserMulti"):
            {
                var options = string.Empty;
                options += GetXmlProperty("UserSelectionMode", UserSelectionMode);
                options += GetXmlProperty("Mult", "TRUE");
                return(GetFieldXml(required, options));
            }

            default:
            {
                return(GetFieldXml(required, string.Empty));
            }
            }
        }