none
project groups, proposal workflows, and keeping it simple RRS feed

  • Question

  • There are several SharePoint groups that make their way from Project Server to the PWA site, namely:

    Project Managers Group (Microsoft Project Server)
    Readers Group (Microsoft Project Server)
    Team members group (Microsoft Project Server)
    Web Administrators Group (Microsoft Project Server)
    Workflow and Project Detail Pages Administrators Group (Microsoft Project Server)

    All of these can be seen at ./_layouts/groups.aspx on your PWA 2010 instance.

    In the name of workflow simplicity, I want to extrapolate the Proposal Reviewers group in Project Server to a PWA site group, so that I can assign tasks to one entity and be done with it.  It's possible to enumerate the Project Server group with the workflow extensions, but task.AssignedTo is still a single-valued string that hasn't accepted multiple people in the past, and juggling multiple tasks to see which one is completed first can be messy in WF.

    So, is it possible to add another group from within PWA?  Or am I stuck with creating a timer sync job or spaghetti workflow to get around this wall?

    Tuesday, August 31, 2010 8:07 PM

Answers

  • To solve the issue, I created a Project Server Server-Side Event Handler and attached it to Security : GroupUpdated.  It deletes all of the members in an accompanying SPGroup called "Proposal Managers (Microsoft Project Server)" and repopulates to match the sister Project Server group.

    There's no error handling, logging, and PSI calls are offloaded to a helper class; just enough to help anyone else who might be interested in this.

     

     

    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Linq;
    using System.Data;
    using Microsoft.SharePoint;
    using Microsoft.Office.Project.Server.Events;
    using PSLibrary = Microsoft.Office.Project.Server.Library;
    using NeilBailey.ProjectServer.Helpers;
    
    namespace NeilBailey.ProjectServer.Events
    {
    	public class SecurityGroupUpdatedEventHandler : SecurityEventReceiver
    	{
    		// set up our group identifiers (project Guid is standard across installations,
    		// and SharePoint group name must be created beforehand).
    		private Guid proposalManagerPrjGroup = new Guid("c18b1372-24a4-4c4e-b8ac-c9ac7ad5037a");
    		private string proposalManagerSPGroup = "Proposal Managers (Microsoft Project Server)";
    
    		public override void OnGroupUpdated(PSLibrary.PSContextInfo contextInfo, GroupSetPostEventArgs e)
    		{
    			// get the PWA site and list of affected groups.
    			Guid siteUid = contextInfo.SiteGuid;
    			Guid[] groupUids = e.EffectedItems;
    
    			if (groupUids.Contains(proposalManagerPrjGroup))
    			{
    				using (SPSite site = new SPSite(siteUid))
    				{
     					using (SPWeb web = site.RootWeb)
    					{
    						SPGroup spGroup = web.Groups[proposalManagerSPGroup];
    
    						// clean out the group (same method as project site sync)
    						foreach (SPUser user in spGroup.Users)
    						{
    							spGroup.RemoveUser(user);
    						}
    
    						// do some PSI magic with helper class
    						PSHelper.SetWebServiceURLs(web.Url, "", System.Net.CredentialCache.DefaultCredentials);
    						PSHelper.Login();
    						PSHelper.LoadProjectServerData();
    						DataView userAccounts = PSHelper.GetResourcesByGroupUid(proposalManagerPrjGroup);
    
    						// repopulate user container
    						foreach (DataRowView drv in userAccounts)
    						{
    							spGroup.AddUser(
    								drv["WRES_ACCOUNT"].ToString(),
    								drv["WRES_EMAIL"].ToString(),
    								drv["RES_NAME"].ToString(),
    								"Added by Project Server Event Handler"
    								);
    						}
    					}
    				}
    			}
    		}
    	}
    }
    
    

     

    Wednesday, September 1, 2010 7:46 PM

All replies

  • And yes, I can create a security group with a mailbox from the AD/Exchange side, sync Proposal Reviewers with it, have the workflow assign tasks to it and handle it that way.  But that is still compensating in a round-about fashion.  I'd like to keep it "simple"
    Tuesday, August 31, 2010 8:10 PM
  • To solve the issue, I created a Project Server Server-Side Event Handler and attached it to Security : GroupUpdated.  It deletes all of the members in an accompanying SPGroup called "Proposal Managers (Microsoft Project Server)" and repopulates to match the sister Project Server group.

    There's no error handling, logging, and PSI calls are offloaded to a helper class; just enough to help anyone else who might be interested in this.

     

     

    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Linq;
    using System.Data;
    using Microsoft.SharePoint;
    using Microsoft.Office.Project.Server.Events;
    using PSLibrary = Microsoft.Office.Project.Server.Library;
    using NeilBailey.ProjectServer.Helpers;
    
    namespace NeilBailey.ProjectServer.Events
    {
    	public class SecurityGroupUpdatedEventHandler : SecurityEventReceiver
    	{
    		// set up our group identifiers (project Guid is standard across installations,
    		// and SharePoint group name must be created beforehand).
    		private Guid proposalManagerPrjGroup = new Guid("c18b1372-24a4-4c4e-b8ac-c9ac7ad5037a");
    		private string proposalManagerSPGroup = "Proposal Managers (Microsoft Project Server)";
    
    		public override void OnGroupUpdated(PSLibrary.PSContextInfo contextInfo, GroupSetPostEventArgs e)
    		{
    			// get the PWA site and list of affected groups.
    			Guid siteUid = contextInfo.SiteGuid;
    			Guid[] groupUids = e.EffectedItems;
    
    			if (groupUids.Contains(proposalManagerPrjGroup))
    			{
    				using (SPSite site = new SPSite(siteUid))
    				{
     					using (SPWeb web = site.RootWeb)
    					{
    						SPGroup spGroup = web.Groups[proposalManagerSPGroup];
    
    						// clean out the group (same method as project site sync)
    						foreach (SPUser user in spGroup.Users)
    						{
    							spGroup.RemoveUser(user);
    						}
    
    						// do some PSI magic with helper class
    						PSHelper.SetWebServiceURLs(web.Url, "", System.Net.CredentialCache.DefaultCredentials);
    						PSHelper.Login();
    						PSHelper.LoadProjectServerData();
    						DataView userAccounts = PSHelper.GetResourcesByGroupUid(proposalManagerPrjGroup);
    
    						// repopulate user container
    						foreach (DataRowView drv in userAccounts)
    						{
    							spGroup.AddUser(
    								drv["WRES_ACCOUNT"].ToString(),
    								drv["WRES_EMAIL"].ToString(),
    								drv["RES_NAME"].ToString(),
    								"Added by Project Server Event Handler"
    								);
    						}
    					}
    				}
    			}
    		}
    	}
    }
    
    

     

    Wednesday, September 1, 2010 7:46 PM
  • Hi nbaileyf,

    I'm trying to use your solution in a development environment, and I succesfully added to the assemblies folder in windows using the Visual Studio Command Prompt and also I have associated the assembly with the Event in Security: GroupUpdated, but when I try to test the even it shows me this error in the Event Viewer:

     

     EventHandler: \EventHandlerProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=af723c4b419e6cd4, EventHandlerProject\ could not be loaded

    Thanks in advance for your help.

    Friday, January 6, 2012 12:05 AM