Tuesday, July 27, 2010

SharePoint field objects – classname, name and types

While working on one of SharePoint project I searched for classnames and fieldtypes that I needed to identify all different field types.

Following table shows most important fields for list.

important fields.

Classname Type TypeAsString TypeDisplayName TypeShortDescription
Microsoft.SharePoint.SPFieldBoolean Boolean Boolean Yes/No Yes/No (check box)
Microsoft.SharePoint.SPFieldCalculated Calculated Calculated Calculated Calculated (calculation based on other columns)
Microsoft.SharePoint.SPFieldChoice Choice Choice Choice Choice (menu to choose from)
Microsoft.SharePoint.SPFieldComputed Computed Computed Computed Computed
Microsoft.SharePoint.SPFIeld ContentTypeId ContentTypeId Content Type Id Content Type Id
Microsoft.SharePoint.SPFieldCurrency Currency Currency Currency Currency ($, , ?)
Microsoft.SharePoint.SPFieldDateTime DateTime DateTime Date and Time Date and Time
Microsoft.SharePoint.SPFieldFile File File File File
Microsoft.SharePoint.SPField Guid Guid Guid Guid
Microsoft.SharePoint.SPFieldNumber Integer Integer Integer Integer
Microsoft.SharePoint.Portal.WebControls.BusinessDataField Invalid BusinessData Business data Business data
Microsoft.SharePoint.Publishing.Fields.ContentTypeIdFieldType Invalid ContentTypeIdFieldType Content Type Id Content Type Id
Microsoft.SharePoint.Publishing.Fields.HtmlField Invalid HTML Publishing HTML Full HTML content with formatting and constraints for publishing
Microsoft.SharePoint.Publishing.Fields.ImageField Invalid Image Publishing Image Image with formatting and constraints for publishing
Microsoft.SharePoint.Publishing.Fields.LayoutVariationsField Invalid LayoutVariationsField Variations Page Layout Variations
Microsoft.SharePoint.Publishing.Fields.LinkField Invalid Link Publishing Hyperlink Hyperlink with formatting and constraints for publishing
Microsoft.SharePoint.Publishing.Fields.PublishingScheduleEndDateField Invalid PublishingScheduleEndDateFieldType Publishing Schedule End Date Publishing Schedule End Date
Microsoft.SharePoint.Publishing.Fields.PublishingScheduleStartDateField Invalid PublishingScheduleStartDateFieldType Publishing Schedule Start Date Publishing Schedule Start Date
Microsoft.SharePoint.Publishing.Fields.SummaryLinkField Invalid SummaryLinks SummaryLinks Summary Links data
Microsoft.Office.Server.WebControls.FieldTypes.SPFieldTargetTo Invalid TargetTo Audience Targeting Audience Targeting
Microsoft.SharePoint.SPFieldLookup Lookup Lookup Lookup Lookup (information already on this site)
Microsoft.SharePoint.SPFieldLookup Lookup LookupMulti Lookup Lookup (information already on this site)
Microsoft.SharePoint.SPFieldNumber Number Number Number Number (1, 1.0, 100)
Microsoft.SharePoint.SPFieldRecurrence Recurrence Recurrence Recurrence Recurrence
Microsoft.SharePoint.SPFieldMultiLineText Note Note Multiple lines of text Multiple lines of text
Microsoft.SharePoint.SPFieldText Text Text Single line of text Single line of text
Microsoft.SharePoint.SPFieldUrl URL URL Hyperlink or Picture Hyperlink or Picture
Microsoft.SharePoint.SPFieldUser

Samples:

SPSite site = new SPSite("http://office2007");
    SPWeb web = site.OpenWeb();
    SPList list = web.Lists["Documenten"];
 
    // Add a new text field
    list.Fields.Add("NewTextField", SPFieldType.Text, false);
 
    // Add a new HTML field
    HtmlField htmlField = new HtmlField(
        list.Fields, "HTML", "NewHTMLField");
    list.Fields.Add(htmlField);


No comments: