In the previous post, I introduced some new methods in come class’ in SharePoint 15 Object Model. In this post, I would like to show more new methods that help you prepare to upgrade your product to new baseline and improve your performance.
1. SPFieldLookup: As you known, the schema of this column contains information the original list and column that this column is looking to. If you need to get the original list and column, you must read and analyst data from schema. In new object model, you just get from method GetJsonClientFormFieldSchema() method and parse it to Json object. It’s easily to get an object and improve your code.
2. Microsoft SharePoint Foundation 15 has exposed the new class named “SPFileRightsManagementSettings” for getting information about the download file. This class defined 5 properties and without any method, I don’t know why Microsoft did not introduce any method for this class.
- AllowPrint: this property indicates whether the file is able to print or not.
- AllowScript: allow the viewer can be run the script while reviewing the document.
- AllowWritecopy: allow the viewer can write down a copy.
- DocumentAccessExpireDay: get the day which document is available to download.
- GroupName: show the group which has permission can be view this document.
There is only 1 noticed for any object of this class is not guaranteed about thread safe, that means this object must be disposed and released the memory after used.
“Because companies often have restrictions that require their files to be stored in nonencrypted formats, SharePoint Foundation does not store files in encrypted, rights-managed file formats. However, SharePoint Foundation calls an IRM protector to convert the stored file to an encrypted format each time a user downloads the file. Similarly, when a user uploads a rights-managed copy of a file, SharePoint Foundation calls the appropriate IRM protector to convert that copy to a nonencrypted format before it is stored. As a result, you do not need to create custom solutions to enable searching or archiving of document libraries where IRM is enabled. Storing the files in nonencrypted format ensures that the current Search indexing service is able to crawl content stored on the servers. Search results are already scoped to user permissions, so the user never sees search results that include content to which they do not have some level of access.”
In SharePoint Foundation, IRM is enabled for any files in document libraries and Site Collection Admin can choose the method to protect the downloadable file. Thus, IRM must be enabled at the document libraries level. For more information read more here
3. SPSolutionExporter: used to export a web site as a template and export a workflow as a workflow template. This class expose new method called “ExportFolderToList” to export a specific folder as an object to the gallery.
public static string ExportFolderToList( SPFolder folder, string solutionFileName, string title, string description, SPList solutionList )
For being time, Microsoft does not show how big the folder can be exported. The folder size exports as a solution file template must be less than the maximum size allowed unless it throws exception exceeds the maximum allowed.
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 asIsClientScriptBlockRegistered, 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.
Assembly: Microsoft.SharePoint.Client.Runtime.dll
Namespace: Microsoft.SharePoint.Client
Class: SimpleDataTable
Description: Used as a data structure to serialize and return weakly-typed data as a collection of rows, where each row is a name-value pair dictionary.
Assembly: Microsoft.Office.Server.Search.Client.dll
Namespace: Microsoft.SharePoint.Client.Search.Query
Class: KeywordQuery
Description: Contains information about a keyword based search query.
Assembly: Microsoft.Office.Server.Search.Client.dll
Namespace: Microsoft.SharePoint.Client.Search.Query
Class: KnownTableTypes
Description: Represents known values for the TableType property.
Assembly: Microsoft.Office.Server.Search.Client.dll
Namespace: Microsoft.SharePoint.Client.Search.Query
Class: Query
Description: Contains information common to all types of search queries.
Assembly: Microsoft.Office.Server.Search.Client.dll
Namespace: Microsoft.SharePoint.Client.Search.Query
Class: ResultTable
Description: Contains a list of query results, all of which are of the type specified by the TableType property.
Assembly: Microsoft.Office.Server.Search.Client.dll
Namespace: Microsoft.SharePoint.Client.Search.Query
Class: ResultTableCollection
Description: Represents a collection of ResultTable objects.
Assembly: Microsoft.Office.Server.Search.Client.dll
Namespace: Microsoft.SharePoint.Client.Search.Query
Class: SearchExecutor
Description: Executes queries against a search server.
Assembly: Microsoft.Office.Server.Search.Client.dll
Namespace: Microsoft.SharePoint.Client.Search.Query
Class: StringCollection
Description: Represents a collection of strings.
Assembly: Microsoft.SharePoint.ServerStub.dll
Namespace: Microsoft.SharePoint.ServerStub
Class: SPFieldLookupServerStub
Description: Serves as a base class for objects that can process client object model requests and responses for a corresponding SPFieldLookup object type.
Assembly: Microsoft.SharePoint.ServerStub.dll
Namespace: Microsoft.SharePoint.ServerStub
Class: SPFieldServerStub
Description: Serves as a base class for objects that can process client object model requests and responses for a corresponding SPField object type.
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint.Administration
Class: SPAppInstance
Description: Represents an SPApp object installed to a specific SPWeb site.
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint.Administration
Class: SPAppInstanceStatus (ENUM)
Description: Represents the lifecycle status of an app instance
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint.Administration.AppDeployment
Class: DatabaseProviderConstants
Description: Defines the name and unique identifier for a DatabaseProviderTypePersistedObject object.
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint.Administration.AppDeployment
Class: DatabaseProviderTypePersistedObject
Description: Stores the fully-qualified assembly type name of a registered IDatabaseProvider object.
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint.Administration.DatabaseProvider
Class: DatabaseContext
Description: Contains information for a database and its server.
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint.Administration.DatabaseProvider
Class: DatabaseProviderError (ENUM)
Description: Specifies the database provider errors.
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint.Administration.DatabaseProvider
Class: DatabaseProviderException
Description: An exception class specific to the IDatabaseProvider interface.
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint.Administration.DatabaseProvider
Class: DatabaseReadWriteState (ENUM)
Description: Specifies the read/write state of a database
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint.Administration.DatabaseProvider
Class: IDatabaseProvider
Description: Provides methods to manage the lifecycle of databases.
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint.Administration.DatabaseProvider
Class: PackageSource (ENUM)
Description: Specifies the source of the package that is associated with a provisioned database.
Assembly: Microsoft.Office.Server.Search.dll
Namespace: Microsoft.Office.Server.Search.Administration
Class: DocumentCrawlLog
Description: Contains information about crawled contents.
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint
Class: SPApplicationCredentials
Description: Provides credentials for application authentication
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint
Class: SPApplicationSecurityTokenManager
Description: Provides methods for retrieving security tokens for application authentication.
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint
Class: SPAppPrincipalManager
Description: Represents the top level object used to manage app principals
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint
Class: SPAppPrincipalPermissionKind (ENUM)
Description: Specifies the constants that represent the permissions for the app principal
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint
Class: SPAppPrincipalPermissionsManager
Description: Manages permissions for SharePoint Web app principals
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint
Class: SPFileRightsManagementSettings
Description: Represents the Information Rights Management (IRM) settings for file downloads in Microsoft SharePoint Foundation.
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint
Class: SPLanguageSettings
Description: Represents set of language preferences.
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint.IdentityModel.OAuth2
Class: SPOAuth2BearerCredentials
Description: Provides credentials for authentication with a service that supports OAuth 2.0 bearer token authentication.
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint.Administration
Class: SPApp
Description: Represents an app loaded onto Microsoft SharePoint Server and ready to be installed
Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint.Administration
Class: SPAppCatalog
Description: Represents all of the SPAppInstance objects installed on an instance of Microsoft SharePoint Server. It provides querying capabilities for discovering installations.