当前位置: 首页>>代码示例>>C#>>正文


C# SPField类代码示例

本文整理汇总了C#中SPField的典型用法代码示例。如果您正苦于以下问题:C# SPField类的具体用法?C# SPField怎么用?C# SPField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SPField类属于命名空间,在下文中一共展示了SPField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessFieldProperties

        protected override void ProcessFieldProperties(SPField field, FieldDefinition fieldModel)
        {
            // let base setting be setup
            base.ProcessFieldProperties(field, fieldModel);

            var typedField = field as SPFieldUser;
            var typedFieldModel = fieldModel.WithAssertAndCast<UserFieldDefinition>("model", value => value.RequireNotNull());

            typedField.AllowDisplay = typedFieldModel.AllowDisplay;
            typedField.Presence = typedFieldModel.Presence;
            typedField.AllowMultipleValues = typedFieldModel.AllowMultipleValues;

            if (!string.IsNullOrEmpty(typedFieldModel.SelectionMode))
                typedField.SelectionMode = (SPFieldUserSelectionMode)Enum.Parse(typeof(SPFieldUserSelectionMode), typedFieldModel.SelectionMode);

            if (typedFieldModel.SelectionGroup.HasValue)
            {
                typedField.SelectionGroup = typedFieldModel.SelectionGroup.Value;
            }
            else if (!string.IsNullOrEmpty(typedFieldModel.SelectionGroupName))
            {
                var group = GetCurrentWeb().SiteGroups.OfType<SPGroup>().FirstOrDefault(g => g.Name.ToUpper() == typedFieldModel.SelectionGroupName.ToUpper());
                typedField.SelectionGroup = group.ID;
            }
        }
开发者ID:Uolifry,项目名称:spmeta2,代码行数:25,代码来源:UserFieldModelHandler.cs

示例2: InitializeWithField

        //protected Label LabelRegularExpression;
        public void InitializeWithField(SPField field)
        {
            this.fldCustomFieldTypeRegEx = field as CustomFieldTypeRegEx;

            if (this.Page.IsPostBack)
            {
                return;
            }

            txtRegularExpression.Text = "";
            txtErrorMessage.Text = "";

            if (field != null)
            {
                txtRegularExpression.Text = fldCustomFieldTypeRegEx.propRegularExpression;
                txtErrorMessage.Text = fldCustomFieldTypeRegEx.propErrorMessage;
                //this.txtRegularExpression.Visible = true;
            }
            else
            {
                txtRegularExpression.Text = "";
                txtRegularExpression.Text = "";
                //this.txtRegularExpression.Visible = true;
            }
        }
开发者ID:photon-infotech,项目名称:sharepoint-resource-management,代码行数:26,代码来源:CustomFieldTypeRegExFieldEditor.cs

示例3: IsDisplayField

        public static bool IsDisplayField(SPField field)
        {
            using (new EnterExitLogger("Utilities:IsDisplayField function"))
            {
                bool display = false;

                if (field != null && !field.Hidden && (Array.IndexOf<string>(EXCLUDED_FIELDS, field.InternalName) < 0))
                {
                    switch (field.Type)
                    {
                        case SPFieldType.Computed:
                            if (((SPFieldComputed)field).EnableLookup) { display = true; }
                            break;
                        case SPFieldType.Calculated:
                            if (((SPFieldCalculated)field).OutputType == SPFieldType.Text) { display = true; }
                            break;
                        default:
                            display = true;
                            break;
                    }
                }

                return display;
            }
        }
开发者ID:karayakar,项目名称:SharePoint,代码行数:25,代码来源:Utilities.cs

示例4: ProcessFieldProperties

        protected override void ProcessFieldProperties(SPField field, FieldDefinition fieldModel)
        {
            // let base setting be setup
            base.ProcessFieldProperties(field, fieldModel);

            if (!string.IsNullOrEmpty(fieldModel.ValidationMessage))
                field.ValidationMessage = fieldModel.ValidationMessage;

            if (!string.IsNullOrEmpty(fieldModel.ValidationFormula))
                field.ValidationFormula = fieldModel.ValidationFormula;


            var typedFieldModel = fieldModel.WithAssertAndCast<DateTimeFieldDefinition>("model", value => value.RequireNotNull());
            var typedField = field as SPFieldDateTime;

            if (!string.IsNullOrEmpty(typedFieldModel.CalendarType))
                typedField.CalendarType = (SPCalendarType)Enum.Parse(typeof(SPCalendarType), typedFieldModel.CalendarType);

            if (!string.IsNullOrEmpty(typedFieldModel.DisplayFormat))
                typedField.DisplayFormat = (SPDateTimeFieldFormatType)Enum.Parse(typeof(SPDateTimeFieldFormatType), typedFieldModel.DisplayFormat);

#if !NET35
            if (!string.IsNullOrEmpty(typedFieldModel.FriendlyDisplayFormat))
                typedField.FriendlyDisplayFormat = (SPDateTimeFieldFriendlyFormatType)Enum.Parse(typeof(SPDateTimeFieldFriendlyFormatType), typedFieldModel.FriendlyDisplayFormat);
#endif
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:26,代码来源:DateTimeFieldModelHandler.cs

示例5: CustomFieldTypeValidation

        protected override void CustomFieldTypeValidation(AssertPair<FieldDefinition, SPField> assert, SPField spObject, FieldDefinition definition)
        {
            var typedObject = spObject as SPFieldLookup;
            var typedDefinition = definition.WithAssertAndCast<LookupFieldDefinition>("model", value => value.RequireNotNull());

            // https://github.com/SubPointSolutions/spmeta2/issues/310
            // AllowMultipleValues - TRUE - LookupMulti
            // AllowMultipleValues - FALSE - Lookup
            assert.ShouldBeEqual((p, s, d) =>
            {
                var srcProp = s.GetExpressionValue(m => m.FieldType);
                var dstProp = d.GetExpressionValue(m => d.TypeAsString);

                var isValid = typedDefinition.AllowMultipleValues
                    ? typedObject.TypeAsString == "LookupMulti"
                    : typedObject.TypeAsString == "Lookup";

                return new PropertyValidationResult
                {
                    Tag = p.Tag,
                    Src = srcProp,
                    Dst = dstProp,
                    IsValid = isValid
                };
            });
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:26,代码来源:LookupFieldDefinitionValidator.cs

示例6: ProcessCommonProperties

        private static void ProcessCommonProperties(SPField siteField, FieldDefinition fieldModel)
        {
            siteField.Title = fieldModel.Title;
            siteField.Group = fieldModel.Group;

            // SPBug, description cannot be null
            siteField.Description = fieldModel.Description ?? string.Empty;
        }
开发者ID:nklychnikov,项目名称:spmeta2,代码行数:8,代码来源:FieldModelHandler.cs

示例7: ProcessFieldProperties

        protected override void ProcessFieldProperties(SPField field, FieldDefinition fieldModel)
        {
            // let base setting be setup
            base.ProcessFieldProperties(field, fieldModel);

            var typedFieldModel = fieldModel.WithAssertAndCast<SummaryLinkFieldDefinition>("model", value => value.RequireNotNull());
            var typedField = field as SummaryLinkField;
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:8,代码来源:SummaryLinkFieldModelHandler.cs

示例8: OnSaveChange

 public void OnSaveChange(SPField field, bool isNewField)
 {
     if (field is RegExpField)
     {
         var Validfield = field as RegExpField;
         Validfield.ValidRegExp = RegExp.Text;
         Validfield.ErrorMessage = ErrorMessage.Text;
     }
 }
开发者ID:Bobs13,项目名称:RegExpField,代码行数:9,代码来源:RegExpFieldEdit.ascx.cs

示例9: AddTemplateContainer

 protected virtual void AddTemplateContainer(Control container, SPField field, string className = null) {
     TemplateContainer templateContainer = CreateTemplateContainer(field);
     container.Controls.Add(templateContainer);
     ControlTemplate.InstantiateIn(templateContainer);
     var gridCol = templateContainer.FindControl("GridCol") as HtmlGenericControl;
     if (gridCol == null)
         throw new ArgumentException("Could not find 'GridCol' in FabricListFieldIterator control template.");
     gridCol.Attributes.Add("class", className ?? "col-md-12");
 }
开发者ID:RunLola,项目名称:Practices.SharePoint,代码行数:9,代码来源:FabricListFieldIterator.cs

示例10: InitializeWithField

        public void InitializeWithField(SPField field)
        {
            this.fldCGMADimensionFieldType = field as CGMADimensionFieldType;

            if (this.Page.IsPostBack)
            {
                return;
            }
        }
开发者ID:nandaTF,项目名称:cgma_latest,代码行数:9,代码来源:CGMADimensionFieldEditor.cs

示例11: SPGENEntityEvalLinqExprArgs

 public SPGENEntityEvalLinqExprArgs(string operand, object value, Expression expr, XmlNode CamlQuery, PropertyInfo sourceProperty, PropertyInfo ownerProperty, SPField field)
 {
     this.Operand = operand;
     this.Value = value;
     this.Expression = expr;
     this.CamlQuery = CamlQuery;
     this.SourceProperty = sourceProperty;
     this.Field = field;
     this.OwnerEntityProperty = ownerProperty;
 }
开发者ID:powareverb,项目名称:spgenesis,代码行数:10,代码来源:SPGENEntityEvalLinqExprArgs.cs

示例12: Initialize

		public void Initialize(SPField field, Type propertyType)
		{
			Guard.ThrowIfArgumentNull(field, "field");
			Guard.ThrowIfArgumentNull(propertyType, "propertyType");

			Guard.ThrowIfArgumentNotIs<string>(field.FieldValueType, "field.FieldValueType");

			Field = field;
			PropertyType = propertyType;
		}
开发者ID:s-KaiNet,项目名称:Untech.SharePoint,代码行数:10,代码来源:JsonFieldConverter.cs

示例13: FieldNode

        public FieldNode(SPField field)
        {
            this.Tag = field;
            this.SPParent = field.ParentList;
            //this.ContextMenuStrip = SPMMenu.Strips.GetMenu(typeof(FieldMenuStrip));

            Setup();

            //this.Nodes.Add(new ExplorerNodeBase("Dummy"));
        }
开发者ID:lucaslra,项目名称:SPM,代码行数:10,代码来源:FieldNode.cs

示例14: InstantiateConverter

		private static IFieldConverter InstantiateConverter(MetaProperty info, SPField field)
		{
			var converter = info.CustomConverterType != null ?
				FieldConverterResolver.Instance.Create(info.CustomConverterType) :
				FieldConverterResolver.Instance.Create(field.TypeAsString);

			converter.Initialize(field, info.MemberType);

			return converter;
		}
开发者ID:s-KaiNet,项目名称:Untech.SharePoint,代码行数:10,代码来源:ModelConverters.cs

示例15: CreateTemplateContainer

 protected virtual TemplateContainer CreateTemplateContainer(SPField field) {
     TemplateContainer templateContainer = new TemplateContainer();
     //templateContainer.ControlMode = base.ControlMode;                    
     PropertyInfo ControlMode = typeof(TemplateContainer).GetProperty("ControlMode", BindingFlags.NonPublic | BindingFlags.Instance);
     ControlMode.SetValue(templateContainer, base.ControlMode);
     //templateContainer.FieldName = field.InternalName;
     PropertyInfo FieldName = typeof(TemplateContainer).GetProperty("FieldName", BindingFlags.NonPublic | BindingFlags.Instance);
     FieldName.SetValue(templateContainer, field.InternalName);
     return templateContainer;
 }
开发者ID:RunLola,项目名称:Practices.SharePoint,代码行数:10,代码来源:FabricListFieldIterator.cs


注:本文中的SPField类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。