C# Class GSoft.Dynamite.Definitions.FieldHelper

Helper class for managing SP Fields.
Mostrar archivo Open project: GSoft-SharePoint/Dynamite-2010

Public Methods

Method Description
AddField ( SPFieldCollection fieldCollection, System.Xml.Linq.XElement fieldXml ) : string

Adds a field defined in xml to a collection of fields.

AddFields ( SPFieldCollection fieldCollection, System.Xml.Linq.XDocument fieldsXml ) : IList

Adds a collection of fields defined in xml to a collection of fields.

FieldHelper ( ILogger logger ) : System

Default constructor with dependency injection

GetFieldById ( SPFieldCollection fieldCollection, System.Guid fieldId ) : SPField

Gets the field by identifier. Returns null if the field is not found in the collection.

SetLookupToList ( SPFieldCollection fieldCollection, System.Guid fieldId, SPList lookupList ) : void

Sets the lookup to a list.

SetLookupToList ( SPFieldLookup lookupField, SPList lookupList ) : void

Sets the lookup to a list.

Private Methods

Method Description
FieldExists ( SPFieldCollection fieldCollection, string displayName, System.Guid fieldId ) : bool
FixLookupFieldXml ( SPWeb web, System.Xml.Linq.XElement fieldXml ) : System.Xml.Linq.XElement
GetAttributeValue ( System.Xml.Linq.XElement fieldXml, string key ) : string
IsFieldXmlValid ( System.Xml.Linq.XElement fieldXml, System.Guid &id, string &displayName, string &internalName ) : bool
IsLookup ( System.Xml.Linq.XElement fieldXml ) : bool
SetLookupToList ( SPWeb web, System.Guid fieldId, string listUrl ) : void

Method Details

AddField() public method

Adds a field defined in xml to a collection of fields.
/// fieldCollection /// or /// fieldXml /// Invalid xml.
public AddField ( SPFieldCollection fieldCollection, System.Xml.Linq.XElement fieldXml ) : string
fieldCollection SPFieldCollection The SPField collection.
fieldXml System.Xml.Linq.XElement The field XML schema.
return string

AddFields() public method

Adds a collection of fields defined in xml to a collection of fields.
Null fieldsXml parameter
public AddFields ( SPFieldCollection fieldCollection, System.Xml.Linq.XDocument fieldsXml ) : IList
fieldCollection SPFieldCollection The SPField collection.
fieldsXml System.Xml.Linq.XDocument The field schema XMLs.
return IList

FieldHelper() public method

Default constructor with dependency injection
public FieldHelper ( ILogger logger ) : System
logger ILogger The logger
return System

GetFieldById() public method

Gets the field by identifier. Returns null if the field is not found in the collection.
public GetFieldById ( SPFieldCollection fieldCollection, System.Guid fieldId ) : SPField
fieldCollection SPFieldCollection The field collection.
fieldId System.Guid The field identifier.
return SPField

SetLookupToList() public method

Sets the lookup to a list.
/// fieldCollection /// or /// fieldId /// or /// lookupList /// Unable to find the lookup field.;fieldId
public SetLookupToList ( SPFieldCollection fieldCollection, System.Guid fieldId, SPList lookupList ) : void
fieldCollection SPFieldCollection The field collection.
fieldId System.Guid The field identifier of the lookup field.
lookupList SPList The lookup list.
return void

SetLookupToList() public method

Sets the lookup to a list.
/// The parameter 'lookupField' cannot be null.;lookupField /// or /// The parameter 'lookupList' cannot be null.;lookupList ///
public SetLookupToList ( SPFieldLookup lookupField, SPList lookupList ) : void
lookupField SPFieldLookup The lookup field.
lookupList SPList The lookup list.
return void