Wednesday, October 20, 2010

FluentPS v1.2 release – Easy Project Server customizations deployment

Hello everyone,

After some delay in tracking our progress with FluentPS library, we are making this delivery notice – new version 1.2 has come! Although detailed list of changes you can find on http://fluentps.codeplex.com, in this post you can find overview of new features of FluentPS.

Assume you are working on customization of Project Server and have to extend it with a couple of tens of project/task/resource/assignment custom fields, lookup tables, security groups, security categories, workflow phases and stages. Let’s add you have to maintain several Project Server environments (development, test, staging or production ones). In this case the manual deployment of Project Server entities becomes painful. Moreover, there is a high chance to forget something, or simply mistype in some object’s name. And the very first thing that comes into your mind is to automate the deployment procedure. Here is where the new FluentPS.Migrator.PSMigrator class can help.

Deploying Custom Fields

Let’s say you have to extend Project Server projects with text custom field. In this case you have to create project class containing the property marked by PSCustomField attribute (later you can use this entity to perform READ/UPDATE operations – this was covered in previous posts). It looks something like this:

[PSEntityType(PSEntityType.Project)]
public class Project
{
    [PSEntityUidField(ColumnName = ProjectCustomFieldsColumnNames.PROJ_UID)]
    public Guid Uid { get; set; }

    [PSNativeField(ColumnName = ProjectCustomFieldsColumnNames.PROJ_NAME)]
    public string Name { get; set; }

    [PSCustomField("{54A30208-4DE7-408a-987E-02AB94FBFFAD}",
                   FieldName = "Additional Info",
                   Description = "Project Additional Info",
                   IsMultiline = true)]
    public string AdditionalInfo { get; set; }
}

Now this class can be used for deployment custom fields. The code looks as following:

var psMigrator = new FluentPS.Migrator.PSMigrator(logService,
                                                  customFieldService,
                                                  environmentService,
                                                  lookupTableService,
                                                  securityService);
psMigrator.CreateCustomFields<Project>();

And that’s it!

NOTE: the GUID of custom filed set in the PSCustomField attribute is used not only for reading/updating Project Server entities, but also for deploying their custom fields. There is one influential reason to stick to those GUIDs instead of custom fields’ names – those names can be manually changed from the UI, and this may affect the system.

Deploying of Lookup Tables

The PSLookupTableService class was extended to support this purpose. You’ll have to use new PSLookupTableInfo and PSLookupValueInfo classes to define lookup tables you need. Please check out "LookupTables" sample project for code sample.

Deploying Security Groups and Security Categories

The new PSSecurityService class allows you to manipulate security groups and categories. You’ll have to use new PSSecurityGroupInfo, PSSecurityCategoryInfo and PSSecurityCategoryInfo.GroupPermissions classes to describe those objects. Please check out sources for code sample.

Read more...