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


C# SPFieldCollection.GetField方法代码示例

本文整理汇总了C#中SPFieldCollection.GetField方法的典型用法代码示例。如果您正苦于以下问题:C# SPFieldCollection.GetField方法的具体用法?C# SPFieldCollection.GetField怎么用?C# SPFieldCollection.GetField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SPFieldCollection的用法示例。


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

示例1: ModelConverters

		public ModelConverters(MetaModel model, SPFieldCollection fields)
		{
			Guard.ThrowIfArgumentNull(model, "model");
			Guard.ThrowIfArgumentNull(fields, "fields");

			Model = model;
			Converters = new Dictionary<string, IFieldConverter>();

			foreach (var metaProperty in model.MetaProperties)
			{
				var field = fields.GetField(metaProperty.SpFieldInternalName);
				Converters.Add(metaProperty.MemberName, InstantiateConverter(metaProperty, field));
			}
		}
开发者ID:s-KaiNet,项目名称:Untech.SharePoint,代码行数:14,代码来源:ModelConverters.cs

示例2: FieldExists

        private bool FieldExists(SPFieldCollection fieldCollection, string displayName, Guid fieldId)
        {
            if (fieldCollection.Contains(fieldId))
            {
                // If Id is found in the collection.
                this._logger.Warn("Field with id '{0}' is already in the collection.", fieldId);
                return true;
            }

            SPField field;
            try
            {
                // Throws argument exception if not in collection.
                field = fieldCollection.GetField(displayName);
            }
            catch (ArgumentException)
            {
                return false;
            }

            if (field == null)
            {
                // Still can't find the field in the collection
                return false;
            }
            else
            {
                // We found it!
                this._logger.Warn("Field with display name '{0}' is already in the collection.", displayName);
                return true;
            }
        }
开发者ID:GAlexandreBastien,项目名称:Dynamite-2010,代码行数:32,代码来源:FieldHelper.cs

示例3: TryGetField

        public static SPField TryGetField(SPFieldCollection siteColumns, string fieldName)
        {
            siteColumns.RequireNotNull("siteColumns");
            fieldName.RequireNotNullOrEmpty("fieldName");

            return siteColumns.ContainsField(fieldName) ? siteColumns.GetField(fieldName) : null;
        }
开发者ID:utdcometsoccer,项目名称:MySP2010Utilities,代码行数:7,代码来源:SharePointUtilities.cs

示例4: GetPrimaryLookupField

        protected virtual SPFieldLookup GetPrimaryLookupField(SPFieldCollection fields, DependentLookupFieldDefinition definition)
        {
            if (definition.PrimaryLookupFieldId.HasGuidValue())
                return fields[definition.PrimaryLookupFieldId.Value] as SPFieldLookup;

            if (!string.IsNullOrEmpty(definition.PrimaryLookupFieldInternalName))
                return fields.GetFieldByInternalName(definition.PrimaryLookupFieldInternalName) as SPFieldLookup; ;

            if (!string.IsNullOrEmpty(definition.PrimaryLookupFieldTitle))
                return fields.GetField(definition.PrimaryLookupFieldTitle) as SPFieldLookup; ;

            throw new SPMeta2Exception("PrimaryLookupFieldTitle / PrimaryLookupFieldInternalName / PrimaryLookupFieldId need to be defined");
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:13,代码来源:DependentLookupFieldModelHandler.cs

示例5: AddFieldTo

        public void AddFieldTo(SPContentType contentType, SPFieldCollection sourceFields, SPWeb parentWeb = null)
        {
            if (contentType != null && !contentType.Fields.ContainsField(this))
            {
                SPFieldLink link = null;
                if (sourceFields.ContainsField(this))
                    link = new SPFieldLink(sourceFields.GetField(this));
                else if (parentWeb.AvailableFields.ContainsField(this))
                    link = new SPFieldLink(parentWeb.AvailableFields.GetField(this));

                if (link != null)
                {
                    contentType.FieldLinks.Add(link);
                    contentType.Update();
                }
            }
        }
开发者ID:TypesInCode,项目名称:J.SharePoint,代码行数:17,代码来源:SPFieldMetadata.cs


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