Monday, January 14, 2013

CSOM Usage Scinario

Usage scenarios for the CSOM

Following are examples of some kinds of apps that the CSOM supports. The CSOM can be used instead of the PSI for many scenarios:

    Develop apps that extend Project Server   The primary purpose of the CSOM is app development for Project Server 2013, where apps can be created for a wide variety of devices that include PCs, mobile devices, and tablets. Apps can be distributed within a private app catalog or in the public Office Store.
    Automate the creation or management of entities in Project Server   The CSOM can perform CRUD operations for entities such as projects, tasks, assignments, enterprise resources, custom fields, lookup tables, timesheets, event handlers, and workflow phases and stages. There are often cases where a custom app can save time with bulk or repetitive jobs.
    Get data in the published tables of the Project database   Because direct database access to the draft, published, and archive tables is not supported, you can use the CSOM to read data that is not available in the reporting tables or views. For example, get information about workflow stages, phases, and activities. To read data in the reporting tables, you can use OData queries.
    Validate statusing and timesheet data   Use the CSOM in local event handlers or remote event receivers for pre-events to validate assignment status or timesheet data that users enter, before the data is saved in Project Web App.


    Evaluate Project Server data in remote event receivers    A remote event receiver for a ProjectCreating pre-event can use Project Server data from the CSOM to help determine whether to cancel the event. For example, before creating a project, compare the project proposal with existing projects.
    Support declarative Project Server workflows   The CSOM enables Project Server workflows that are created in SharePoint Designer 2013. The CSOM supports workflow definitions that use Windows Workflow Foundation version 4 (WF4). (The PSI does not support WF4 workflows.)
    Create complex Project Server workflows   When you develop workflows with Visual Studio 2012, you can use the CSOM for complex actions within workflow stages or create custom workflow actions.

Request limits of the CSOM

The CSOM in Project Server 2013 is built on the CSOM implementation in SharePoint Server 2013 and inherits the limits for the maximum size of a request. SharePoint has a 2 MB limit for an operations request, and a 50 MB limit for the size of a submitted binary object. The request size is limited to protect the server from excessively long queues of operations and from processing delays for large binary objects.

For example, if you use the CSOM to create a project, and then edit the project to add 252 tasks with a minimum amount of information such as a short name, the task GUID, and a duration of 1d, the total amount of data in the DraftProject.Update request is less than 2 MB. But, if you try to add 253 such tasks to an empty project, the 2 MB limit is exceeded, and you get the following exception: Microsoft.SharePoint.Client.ServerException: The request uses too many resources

To capture the data in a CSOM request over HTTP or HTTPS, you can use a web debugging tool such as Fiddler (http://www.fiddler2.com). For a code example that implements a test for request size and includes a solution that breaks a large request into to smaller groups, see DraftProject.Update.

No comments: