Saturday, March 10, 2012

The new things in SharePoint 15 Object Model - Part 2

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.

No comments: