Understanding Project Mini Category and Managing Project Mini Category

Introduction on Project Mini Category

Project Mini categories are Categories in Project Server Specific to a project in Project server

Project Mini Category gets created when you define a Project Level Permission.

Each project will have a Mini category and a Category Relation once you define permissions from Project Center (Project Permissions)

Individual Users or Groups can be given Specific Permission on a Project Using Mini Categories

Available Permissions

There are 7 Different permissions which can be defined on a project using Mini categories and each permission has a unique ID associated with it

View Project Schedule in Project Web App    e98573c8-7ea6-41ab-8ea4-ff8da9730d0a
View the Project Summary in the Project Center   a120a079-75bc-4f0f-b376-3fb0ae9ac940
Publish Project  0000c2b9-3f2b-48a4-b54f-a247cbbff5ba                                
Save Project to Project Server bf93a026-deac-4949-be19-c513701139ff
Open Project   3dee3fa0-1956-4b98-84bd-2259d5b8829c
Edit Project Summary Fields 0000c768-6d95-4c77-b7db-5d7cdafc1bea
View the Project Site 4B524550-2512-4D25-92B1-A4C888C66106

How Do we create a Project Mini category , Relation and Associate a user with Project Mini Category using PSI

Below Sample code is to Create a Project in Project Server and Create a mini Category for the newly created Project

const string RESOURCE_SERVICE_PATH = "_vti_bin/psi/resource.asmx";
const string PROJECT_SERVICE_PATH = "_vti_bin/psi/project.asmx";
const string QUEUESYSTEM_SERVICE_PATH = "_vti_bin/psi/queuesystem.asmx";
const string SECURITY_SERVICE_PATH = "_vti_bin/psi/security.asmx";

                    Guid resguid;
                    Guid projectID;
                    Guid jobId;
                    projectID = Guid.NewGuid();
                    ProjectWebSvc.Project projectSvc = new ProjectWebSvc.Project();
                    projectSvc.Url = PROJECT_SERVER_URI + PROJECT_SERVICE_PATH;
                    projectSvc.Credentials = nc;
                    ResourceWS.Resource PSIResource = new ResourceWS.Resource();
                    PSIResource.Url = PROJECT_SERVER_URI + RESOURCE_SERVICE_PATH;
                    PSIResource.Credentials = nc;
                    QueueSystemWebSvc.QueueSystem q = new QueueSystemWebSvc.QueueSystem();
                    q.Credentials = nc;
                    ProjectWebSvc.ProjectDataSet projectDs = new ProjectWebSvc.ProjectDataSet();
                    ProjectWebSvc.ProjectDataSet.ProjectRow projectRoweng = projectDs.Project.NewProjectRow();
                    projectRoweng.PROJ_UID = projectID;
                    projectRoweng.PROJ_NAME = projName;
                    projectRoweng.PROJ_TYPE = (int)PSLibrary.Project.ProjectType.Project;
                    jobId = Guid.NewGuid();
                    projectSvc.QueueCreateProject(jobId, projectDs, false);
                    WaitForQueue(q, jobId);
                    jobId = Guid.NewGuid();
                    projectSvc.QueuePublish(jobId, projectID, true, string.Empty);
                    WaitForQueue(q, jobId);
                    string SESSION_DESC = "Check in Project from Custom code";                  
                    jobId = Guid.NewGuid();
                    projectSvc.QueueCheckInProject(jobId, projectID, true, sessionUid, SESSION_DESC);
                    //Create Project mini Category
                    srvSecurity.SecurityProjectCategoriesDataSet updatedPDS;
                    Guid CatGuid;
                    Guid[] guidarray = new Guid[1];
                    guidarray[0] = projectID;
                    srvSecurity.Security SVSecurity = new srvSecurity.Security();
                    SVSecurity.Credentials = CredentialCache.DefaultCredentials;
                    updatedPDS = SVSecurity.ReadProjectCategory(guidarray[0]);

                    if (updatedPDS.ProjectCategories.Rows.Count == 0)
                        srvSecurity.SecurityProjectCategoriesDataSet projectCategoryDataSet1 = new srvSecurity.SecurityProjectCategoriesDataSet();
                        srvSecurity.SecurityProjectCategoriesDataSet.ProjectCategoriesRow row1 = projectCategoryDataSet1.ProjectCategories.NewProjectCategoriesRow();
                        CatGuid = Guid.NewGuid();
                        row1.WSEC_CAT_UID = CatGuid;
                        row1.PROJ_UID = projectID;
                        updatedPDS = SVSecurity.ReadProjectCategory(projectID);

                    updatedPDS = SVSecurity.ReadProjectCategory(guidarray[0]);
                    CatGuid = updatedPDS.ProjectCategories[0].WSEC_CAT_UID;

Once the Mini Category is created for a project you can Create a Relation ship with the Mini Category and a User\Group  (below Sample is for creating a relation ship for a User)

DSUpdated.UserRelations.AddUserRelationsRow(categoryguid, resguid);   //DSUpdated is the Project Category Data set (SecurityProjectCategoriesDataSet )

Once the Relation ship is defines you can Add the respective Permissions for the data set for the above User  (below ID's are for "View the Project Summary in the Project Center" and  "View the Project Summary in the Project Center")

 DSUpdated.UserPermissions.AddUserPermissionsRow(categoryguid, resguid, new Guid("A120A079-75BC-4F0F-B376-3FB0AE9AC940"));
DSUpdated.UserPermissions.AddUserPermissionsRow(categoryguid, resguid, new Guid("E98573C8-7EA6-41AB-8EA4-FF8DA9730D0A"));

Now you are all set with the Mini category.................

Happy coding ......Cheers .. Ajith




Comments (0)

Skip to main content