Example #1
0
        public string AddField(SPFieldInstance field)
        {
            if (field == null)
            {
                throw new JavaScriptException(this.Engine, "Error", "A field must be specified as the first argument.");
            }

            return(m_fieldCollection.Add(field.SPField));
        }
Example #2
0
        public SPFieldLinkInstance Construct(SPFieldInstance field)
        {
            if (field == null)
            {
                throw new JavaScriptException(this.Engine, "Error", "When constructing a new instance of a field link, a field must be supplied as the first argument.");
            }

            var newFieldLink = new SPFieldLink(field.SPField);

            return(new SPFieldLinkInstance(this.InstancePrototype, newFieldLink));
        }
Example #3
0
        public string AddNewField(string displayName, string fieldType, bool required)
        {
            SPFieldType ft;

            if (fieldType.TryParseEnum(true, out ft) == false)
            {
                SPFieldInstance.ThrowUnknownFieldTypeException(this.Engine);
            }

            return(m_fieldCollection.Add(displayName, ft, required));
        }
Example #4
0
        public string AddNewField(string displayName, string fieldType, bool required, bool compactName, ArrayInstance choices)
        {
            if (choices == null)
            {
                throw new JavaScriptException(this.Engine, "Error", "The choices argument must be specified.");
            }

            SPFieldType ft;

            if (fieldType.TryParseEnum(true, out ft) == false)
            {
                SPFieldInstance.ThrowUnknownFieldTypeException(this.Engine);
            }

            var strChoices = new StringCollection();

            foreach (var c in choices.ElementValues)
            {
                strChoices.Add(TypeConverter.ToString(c));
            }

            return(m_fieldCollection.Add(displayName, ft, required, compactName, strChoices));
        }