Now and again I come across code with hardcoded SharePoint IDs in it.
Or scary loops matching a field, list or property name.
SharePoint provides some classes containing the out of the box IDs, you only have to know they exist.
I made an overview so nobody has to hardcode those pesky GUIDs, ContentTypeIds or property names any longer.
WSS/Core - Microsoft.SharePoint.SPBuiltInFieldId
The SPBuiltInFieldId
class contains 314 GUIDs for the default SharePoint fields.
You can find them all on the SPBuiltInFieldId
fields page, but I name some of the more common ones:
Created
Created_x0020_By
ID
Modified
Modified_x0020_By
Title
UniqueId
WSS/Core - Microsoft.SharePoint.SPBuiltInContentTypeId
The SPBuiltInContentTypeId
class contains 34 content type IDs for the default SharePoint content types.
You can find them all on the SPBuiltInContentTypeId
fields page, but I name some of the more common ones:
Announcement
Document
Folder
Item
Task
WSS/Core - Microsoft.SharePoint.SPListTemplateType
The SPListTemplateType
enumeration
is more commonly known and used but what’s more special about this enumeration is to use it in combination with the
SPSite.GetCatalog
method.
With this method you can easily retrieve the MasterPageCatalog
for the current site collection:
The enumerations contain four list template IDs for the default SharePoint catalogs.
ListTemplateCatalog
MasterPageCatalog
WebPartCatalog
WebTemplateCatalog
MOSS - Microsoft.SharePoint.Publishing.FeatureIds
The FeatureIds
class contains 16 GUIDs for the MOSS publishing features.
You can find them all on the FeatureIds
fields page,
but I name the most common ones:
Navigation
Publishing
Server - Microsoft.SharePoint.Publishing.Internal.WssFeatureIds
This class is not documented and the namespace implies its internal.
The WssFeatureIds
class however is public and the only place the 24 WSS feature IDs are available.
Because this class is not documented I list all fields:
AnnouncementsList
BasicWebParts
ContactsList
CustomList
DataConnectionLibrary
DataSourceLibrary
DiscussionsList
DocumentLibrary
EventsList
GanttTasksList
GlobalContentTypes
GlobalFields
GlobalMobilityRedirect
GridList
IssuesList
LinksList
NoCodeWorkflowLibrary
PictureLibrary
SurveysList
TasksList
TeamCollaboration
WebPageLibrary
WorkflowHistoryList
XmlFormLibrary
Server - Microsoft.SharePoint.Publishing.FieldId
The FieldId
class contains 61 GUIDs for the publishing fields.
You can find them all on the FieldId
properties page,
but I name some of the more common ones:
Contact
PageLayout
PreviewImage
PublishingPageContent
PublishingPageImage
RollupImage
Server - Microsoft.SharePoint.Publishing.ContentTypeId
The ContentTypeId
class contains 10 content type IDs for the publishing content types.
You can find them all on the ContentTypeId
properties page,
but I name some of the more common ones:
ArticlePage
MasterPage
PageLayout
WelcomePage
MOSS - Microsoft.Office.Server.UserProfiles.PropertyConstants
The PropertyConstants
class contains 42 names of the standard user profile properties.
You can find them all on the PropertyConstants
fields page,
but I name some of the more common ones:
BirthDay
CellPhone
Department
FirstName
LastName
Manager
PictureUrl
PreferredName
Title
WorkEmail
WorkPhone