380 likes | 736 Views
EPM Customization. Taking your Microsoft EPM Solution Beyond the “box”. Brendan Giles , PMP, MCP. November 21st, 2007. EPM Customization Series Part 2. Acronyms. EPM
E N D
EPM Customization Taking your Microsoft EPM Solution Beyond the “box” Brendan Giles , PMP, MCP November 21st, 2007 EPM Customization Series Part 2
Acronyms • EPM • Enterprise Project Management – Centralized control, Shared Resources, Portfolio / Project Reporting and tracking at the enterprise level. • VBA • Visual Basic for Applications programming language common to all Microsoft Office products including Microsoft Office Project. • PDS • Project Data Service – Project Server 2003 API. XML based request / reply. • PSI • Project Server Interface – Project Server 2007 API. Web services based using ADO datasets and the .NET Framework. • SOAP • Simple Object Access Protocol – Communication Protocol used to transfer data in a Microsoft EPM Solution via Http.
Overview • Microsoft Office Project Data Model • Microsoft Office Project VBA • Project Data Service API (Microsoft EPM 2003) and Enterprise Data Maintenance • Project Server Interface (Microsoft EPM 2007) • Sharepoint Web Services • Questions and Wrap-up
VBA Benefits • VBA allows: • Access to Microsoft Office Project Objects • Access to other Office Applications • Macro recordings to expose VBA Code • Key data elements: • Project • Task • Task Time-Phased • Resource • Resource Time-Phased • Assignment • Assignment Time-Phased
VBA Code Techie Alert Sub SavePlan(Share_Drive as String, Plan As String, SavedPlan As String) 'Retrieve the specified project plan from Project Server 'and save it to the fileshare FileOpen Name:="<>\" & Plan, ReadOnly:=True, _ FormatID:="MSProject.MPP", Openpool:=pjDoNotOpenPool 'Don't Try to update this project on the server when I save it to a fileshare 'besides it is read-only so it won't let you FileSaveAs Name:=Share_Drive + ":\Latest Project Plans\" & SavedPlan FileClose pjSave End Sub
VBA Retrieval of Assignments Time-Phased Data For Each Assignment In Resource.Assignments ' Check if assignment is within our report range If Assignment.Start <= EndOfPeriod _ And Assignment.Finish >= StartDate Then Set tsvs = Assignment.TimeScaleData(StartDate, EndOfPeriod, pjAssignmentTimescaledWork, pjTimescaleDays) Assignment_Remaining_Work_Hours = Assignment.RemainingWork / 60 For Each tsv In tsvs If tsv.Value <> "" Then Assignment_Work_Hours = tsv.Value / 60 'time is in mins ' Create a DBRecord Entry for this effort Add_DB_Assignment _ Project_Name:=Saved_Project_Name(prj.Name), _ Workgroup_Category:=Resource.EnterpriseOutlineCode4, _ Resource_Workgroup:=Resource.EnterpriseOutlineCode2, _ Resource_Name:=Resource.Name, _ Task_ID:=Assignment.TaskID, _ Task_Name:=Assignment.TaskName, _ Task_Start_Date:=tsv.StartDate, _ Task_Finish_Date:=tsv.EndDate, _ End If ' If tsv.value <> ..... Next tsv End If ' If Assignment.Start <= ..... Next Assignment Techie Alert
VBA also Allows Office Integration Set cnt = New ADODB.Connection With cnt .Open dbConnectStr 'Create the Assignments Table .Execute "CREATE TABLE Assignments_Table " & _ "([Assignment ID] COUNTER CONSTRAINT PrimaryKey PRIMARY KEY, " & _ "[Workgroup Category] Text(250) WITH Compression, " & _ "[Resource Workgroup] Text(250) WITH Compression, " & _ "[Resource Name] Text(250) WITH Compression, " & _ "[Project Name] Text(250) WITH Compression, " & _ "[Task ID] NUMBER, " & _ "[Task Name] Text(250) WITH Compression, " & _ "[Start Date] DATETIME, " & _ "[Finish Date] DATETIME, " & _ "[Assignment Remaining Work Hours] NUMBER, " & _ "[Assignment Remaining Work Days] NUMBER, " & _ "[Assignment Work Hours] NUMBER, " ' ' Create the Tasks Table ' .Execute "CREATE TABLE Tasks_Table " & _ "([Task ID] NUMBER, " & _ "[Project Name] Text(250) WITH Compression, " & _ "[Task Name] Text(250), " & _ "[Start Date] DATETIME, " & _ "[Finish Date] DATETIME, " & _ "[Task Remaining Work Hours] NUMBER, " & _ "[Task Remaining Work Days] NUMBER, " & _ "[Task Work Hours] NUMBER, " ‘End With Set cnt = Nothing End Sub Techie Alert
VBA Object Model Changes • VBA changes in Project Professional 2007 • Simplified custom fields and outline codes • Multiple undo and redo actions • Effective calendar dates and calendar exceptions • Advanced desktop reporting using Visual Reports • Task drivers and recalculation change highlighting to help clarify scheduling processes • Costs and budget • Queuing Service events • Importing of a Windows SharePoint Services 3.0 project • Saving of a local copy of a Project Server project for sharing Slide 9
Project Data Service • Steps to access all PDS Methods • Logon to Project Server Programmatically using valid ID and password • Obtain Authentication Cookie • Create a PDS Request in XML • Call PDS Web Service with PDS Request and authentication Cookie via a SOAP call • Receive PDS XML Reply • Parse PDS XML Reply
PDS Authentication Cookie -<Reply> <Hresult>0<Hresult> <Cookie>(F55A3…….. </Cookie> </Reply>
PDS Logon Cookie private void btnChkCookie_Click(object sender, System.EventArgs e) { // Create a persistent cookie for the URL, if the cookie doesn't // exist or if the Project Server URL changes. if (urlReset && ieCookiesOK) { CreateCookie(COOKIENAME, VALUENAME, txtMSPURL.Text, DAYSPERSIST); urlReset = false; } //Clear the listbox, for subsequent creations of the project list lblLogonStatus.Text = ""; psLogonUrl = txtMSPURL.Text + "/LgnIntAu.asp"; string textInReply = ""; if (Get_Cookie.LogonProjectServer(psLogonUrl, ref psCookie, ref textInReply)) { //Trace.Warn("Logon Okay"); lblLogonStatus.ForeColor = Color.Green; lblLogonStatus.Text = "Log on OK: " + txtMSPURL.Text; psURL = txtMSPURL.Text; //Check the PDS Call Here <----- } else { //Trace.Warn("Logon Failed"); //Trace.Warn(textInReply); lblLogonStatus.ForeColor = Color.Red; lblLogonStatus.Text = "Log on failed"; } } Techie Alert
PSI Login via Web Service public bool LogonPS(bool useWinLogon, string baseUrl, string userName, string password) { const string LOGINWINDOWS = "_vti_bin/PSI/LoginWindows.asmx"; const string LOGINFORMS = "_vti_bin/PSI/LoginForms.asmx"; bool logonSucceeded = false; try { if (useWinLogon) { loginWindows.Url = baseUrl + LOGINWINDOWS; loginWindows.Credentials = CredentialCache.DefaultCredentials; if (loginWindows.Login()) logonSucceeded = true; } } // Catch statements return logonSucceeded; } Techie Alert Slide 13
Project Data Service • XML Based Request / Reply API • Consists of: • Project Methods • Enterprise Project Creation Methods • Resource Methods • Enterprise Custom Field Methods • Timesheet / Assignment Methods • Administrative Methods • Version Methods
Enterprise Data Maintenance • Builds on the PDS to provide higher level data exchange • Uses “file drop” and SOAP programmatic interface • Adds a business layer mapping to integrate with existing Project server data • Tightly integrates Project server with other line of business applications • Resource data synchronization • Project Team Synchronization • Updating Custom field value lists
Microsoft EPM Solution 2003 Slide 17
Project Server Interface (PSI) • Web Services API using ADO.NET Datasets • Over 350 Public Methods • Firewall Friendly (Ports 80 and 443) • Access via SOAP over Http • Managed Code but supports managed and unmanaged clients • VB.NET, C#.NET and ASP.NET development • Simply add a web reference (http://servername/projectservername/_vti_bin/psi/.. • Better Design Time Control
Project Server Interface (PSI) • Synchronous Methods • aSynchronous (*Queue Methods) • Bulk data changes • Transactional / Restartable • Over 100 Server Events to listen for • ADO Datasets used for Data Transfer • Typed datasets that are familiar to developers and provide safety • Design Time Validation • Improved Performance
Project Server Interface (PSI) • A Wealth of Web Services: • Admin • Archive • Authentication (Internal Use) • Calendar • Cube Admin • Custom Fields • Events • Login Forms • LoginWindows • LookupTable • Notifications • ObjectLinkProvider • Project • PWA (Internal use) • QueueSystem • Resource • Security • Statusing • Timesheet • View (Internal Use) • WinProj (Internal Use) • WssInterop Slide 23
Project Server Interface (PSI) Simply add a web reference in Visual Studio (http://servername/projectservername/_vti_bin/psi/resource.asmx
Project Server Interface (PSI) Simply add a web reference in Visual Studio (http://servername/projectservername/_vti_bin/psi/.... Slide 25
Project Server Interface (PSI) View Web Service Properties: Slide 26
Project Server Interface (PSI) Expose the methods available ------ Retrieve data in an ADO Dataset PSI relies heavily on GUIDs (Globally Unique Identifier) in contrast to PDS that used IDs that were not always unique across Project Server Instances Slide 27
Project Server Interface (PSI) Slide 28
Project Server Events Applications can listen for Project Server Events Slide 29
Project Server Events Applications can listen for Project Server Events Slide 30
Project Server Interface (PSI) • Developers should not directly Access Project Server Databases other than the Reporting Database • PSI Web Services and methods should be used Slide 31
Sharepoint Web Services • Sharepoint Web Services give developers access to Sharepoint Sites and their content Slide 32
Sharepoint Web Services • Windows Sharepoint Services 3.0 for EPM 2007 Ships with Windows Server 2003. Slide 33
Sharepoint Web Services • Microsoft Office Sharepoint Server 2007 is recommended when using the workflow features of EPM 2007. Slide 34
Sharepoint Web Services • Project Web Access is now a Sharepoint Site in EPM 2007 Slide 35
Fetching Issues via a Sharepoint Web Service Techie Alert Slide 36
Summary • Customization of Microsoft EPM via: • Visual Basic for Applications • Project Data Services API (2003) • Project Server Interface (API) (2007) • Sharepoint Web Services • Visual Studio • ADO.NET 2.0 • .NET Framework
Questions and Answers • ?? No such thing as a stupid question ?? • Answers ---- we’ll try to have smart answers ?