Thursday, March 8, 2012

The new things in SharePoint 15 Object Model - Part 1

From the technical preview document, SharePoint 2015 has been updated a lot of methods that help developers improving the code.

1. The first thing is from SPUtility, this class gives a supplementary the method GetLayoutsFolder to specify the layout folder.

SPUtility.GetLayoutsFolder(SPWeb);
SPUtility.GetLayoutsFolder(SPSite);

If site.CompatibilityLevel returns the value greater than or equal 15, the method GetLayoutsFolder() returns "_layouts/site.CompatibilityLevel", otherwise returns "_layouts".

In aditional, there are 3 new propertie:

ContextCompatibilityLevel: Gets the compatibility level of the context site ContextLayoutsFolder: Gets the versioned layouts folder for the context site CurrentThemeFolderName:  Gets the name of the current theme folder

2.  ASP.NET has been supported Control.Page to regist the script on client by ClientScript. Almost developers often use this object to regist, but with SharePoint 2015 object model we can use the new class to replace Control.Page class.

SPPageContentManager also has fully methods to perform like Control.Page such as IsClientScriptBlockRegistered, IsStartupScriptRegistered, RegisterClientScriptBlock, RegisterHiddenField, RegisterScriptFile, RegisterStartupScript

3. SharePoint 2015 also expose new properties of SPWorkflowEventProperties
  •  AssociationId: Gets the identifier of the workflow SPWorkflowAssociation. 
  • AssociationName: Gets the name of the workflow SPWorkflowAssociation.
  • CorrelationId: Gets the correlation identifier for the workflow, if supplied.
  • Created: Gets the DateTime value for when the workflow was created.
  • ItemGuid: Gets the identifier of the workflow ParentItem.
  • ItemId: Gets the identifier of the workflow ParentItem.
  • ListId: Gets the identifier of the workflow ParentList.
  • Modified: Gets the last DateTime the workflow was modified
  • StatusText: Gets the string that represents the status of the workflow.
  • StatusValue: Gets the integer that represents the workflow status.
  • TemplateId: Gets the identifier of the workflow association base template.
This helps us improve performance a lot because these properties can be access directly when workflow is running. Of course, defends on the purpose of your project but these properties reduce the time to build a workflow a lot. That's good upgrading.

No comments: