• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# SPField类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ProcessFieldProperties

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

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

            // TODO
            //typedField.NumberOfLines = typedFieldModel.NumberOfLines;
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:11,代码来源:ImageFieldModelHandler.cs


示例17: ProcessFieldProperties

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

            var spField = field.WithAssertAndCast<SPFieldUrl>("field", value => value.RequireNotNull());
            var typedFieldModel = fieldModel.WithAssertAndCast<URLFieldDefinition>("model", value => value.RequireNotNull());

            if (!string.IsNullOrEmpty(typedFieldModel.DisplayFormat))
                spField.DisplayFormat = (SPUrlFieldFormatType)Enum.Parse(typeof(SPUrlFieldFormatType), typedFieldModel.DisplayFormat);
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:11,代码来源:URLFieldModelHandler.cs


示例18: RenderField

        public static string RenderField(string fieldValue, SPField field)
        {
            System.Text.StringBuilder sb = new StringBuilder();
            try
            {
                SPFieldType type = field.Type;
                switch (type)
                {
                    // Nik20121108 - Handles both Hyperlink and Images
                    case(SPFieldType.URL):
                        if (((SPFieldUrl)field).DisplayFormat == SPUrlFieldFormatType.Image)
                        {
                            string imageUrl = fieldValue.Split(',')[0].Trim();
                            string imageAltTag = fieldValue.Split(',')[1].Trim();
                            sb.AppendLine("<div class=\"wet-boew-lightbox\">");
                            sb.AppendLine("<ul>");
                            sb.AppendLine("<li style=\"list-style-type:none !important;\">");
                            sb.AppendLine("<a class=\"lb-item\" href=\"" + imageUrl + "\" title=\"" + imageAltTag + "\" style=\"list-style-type:none !important;\">");
                            sb.AppendLine("<img class=\"image-actual\" src=\"" + imageUrl + "\" alt=\"" + imageAltTag + "\" style=\"list-style-type:none !important;\" />");
                            sb.AppendLine("</a>");
                            sb.AppendLine("</li>");
                            sb.AppendLine("</ul>");
                            sb.AppendLine("</div>");
                        }
                        else
                            sb.AppendLine("<a href=\"" + fieldValue.Split(',')[0] + "\">" + fieldValue.Split(',')[1] + "</a>");
                        break;
                    case(SPFieldType.Text):case(SPFieldType.Note):case(SPFieldType.Number):
                        sb.AppendLine(fieldValue);
                        break;
                    case(SPFieldType.DateTime):
                        if (((SPFieldDateTime)field).DisplayFormat == SPDateTimeFieldFormatType.DateOnly)
                        {
                            sb.AppendLine(fieldValue.Split(' ')[0]);
                        }
                        else
                            sb.AppendLine(fieldValue);
                        break;
                    case(SPFieldType.Calculated):
                        fieldValue = fieldValue.Replace("string;#", "").Replace("datetime;#", "").Replace("number;#", "");
                        sb.AppendLine(fieldValue);
                        break;
                    default:
                        sb.AppendLine(fieldValue);
                        break;
                }
            }
            catch (Exception ex)
            {
                LogEngine.Log(ex, "Accessible Lists");
            }

            return sb.ToString();
        }
开发者ID:ricardocarneiro,项目名称:wet-boew-sharepoint,代码行数:54,代码来源:FieldRenderer.cs


示例19: ProcessFieldProperties

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

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

            if (typedFieldModel.EnableLookup.HasValue)
                typedField.EnableLookup = typedFieldModel.EnableLookup.Value;
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:11,代码来源:ComputedFieldModelHandler.cs


示例20: Initialize

		public void Initialize(SPField field, Type propertyType)
		{
			try
			{
				ConverterInstance.Initialize(field, propertyType);
			}
			catch (Exception e)
			{
				throw new InvalidFieldConverterException(ConverterType, e);
			}
		}
开发者ID:s-KaiNet,项目名称:Untech.SharePoint,代码行数:11,代码来源:FieldConverterWrapper.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SPFieldCollection类代码示例发布时间:2022-05-24
下一篇:
C# SPFeatureReceiverProperties类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap