Cascade Skyline - with Microsoft Logo and Project Support header - author Brian Smith

June, 2008

  • Brian Smith's Microsoft Project Support Blog

    TechEd 2008 switches tracks from the Developer to the IT Professional

    • 0 Comments

    I really enjoyed TechEd last week – and thanks to all who attended the sessions and came and said “Hi”.  I’m back in the office this week doing proper work – but Christophe is back down in the sunshine of Florida.

    This week Christophe will be joined by Simon Floyd, Michael Jordan and Emmanuel Fadullon at TechEd IT Professionals in Orlando and they will be delivering the following EPM sessions:

    OFC255

    Best Practices: Enabling Innovation Process Management Using Microsoft Office Enterprise Project Management Solution and Microsoft Office SharePoint Server 2007

    Tuesday, June 10 10:30 AM

    In today’s fast-paced global economy, innovation is the key to the next big breakthrough in products, services, and processes. However, businesses are often challenged with facilitating innovation due to cultural, strategic, or logistical pitfalls. This session covers the best practices for fostering a culture of innovation by enabling an organization’s most valuable assets, its people, to actively and easily participate in the innovation process. A live demonstration shows how anyone can capture, investigate, formulate, and evaluate ideas to conclusion using the Microsoft Office Enterprise Project Management solution and SharePoint Server 2007.

    OFC358

    Deploying Microsoft Office Enterprise Project Management Solution 2007 into an Existing Microsoft Office SharePoint Server Environment

    Tuesday, June 10 1:15 PM

    Microsoft Office Enterprise Project Management Solution 2007 (EPM 2007) is a very unique form of Windows SharePoint Services V3. This sessions provides you with best practices, learned in Performance Labs in Redmond, to keep in mind when you want to deploy EPM 2007 into an existing MOSS farm.

    OFC450

    Microsoft Office Project Server 2007 Deployment for High Availability and Scalability

    Wednesday, June 11 1:00 PM

    This session covers the components of the EPM solution and the main considerations when planning for deployments that require high availability, when to scale up and out, points of failure and software/hardware boundaries.

    OFC53-TLC

    Microsoft Office Project Server 2007 Disaster Recovery

    Thursday, June 12 8:30 AM

    Learn how to recover from a catastrophic failure on your SharePoint/EPM farm. This session discusses the options to recover from a loss of any component of your SharePoint/EPM Farm: SQL server, application server, disk, etc. It covers SharePoint/EPM Farm or database restore options including pros and cons as well as a live demo. This session does not cover detailed backup/restore plans and all high availability options.

    Beside attending all these Project Server sessions, you can also meet them at the Project Server booth, don’t be shy!

  • Brian Smith's Microsoft Project Support Blog

    TechEd 2008 Preview – Part 4 – COM Add-in from Project Professional making PSI calls

    • 1 Comments

    This is the last TechEd sample and is a very simple example of a PSI call from Project Pro (or Standard for that matter).  It shows how a user of the client not connected to the server can still make PSI calls.  Obviously they need an account in the PWA they are communicating with.  The sample shows a PSI call to check that the local project name (or any text you want to enter manually) is in use on the Project Server.  The response is shown on the form for the add-in and also put into the text1 field of the project – just to show how local data can also be updated with VSTO applications. 

    The details for creating a VSTO add-in for project were very well covered in Jack Dahlgren's posting http://zo-d.com/blog/archives/programming/making-the-move-from-vba-to-vsto-in-microsoft-project.html posting recently – thanks Jack – so I will just give samples of my code and not repeat the “how to” section.  I also needed web references to the Project and LoginWindows web services.  My code is also in C# so some differences to Jack’s posting. 

    The ThisAddIn.cs file looks like this and is adding a toolbar button and setting the for to show when the button is clicked:-

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Xml.Linq;
    using MSProject = Microsoft.Office.Interop.MSProject;
    using Office = Microsoft.Office.Core;
    using System.Windows.Forms;
    
    namespace TechEdComAddIn
    {
        public partial class ThisAddIn
        {
            private Office.CommandBar commandBar;
            private Office.CommandBarButton importButton;
    
            private void ThisAddIn_Startup(object sender, System.EventArgs e)
            {
                
                if (commandBar == null)
                {
                    int barPosition = 1;
                    bool isMenuBar = false;
                    bool isTemporary = true;
                    commandBar = Application.CommandBars.Add("ValidateBar", barPosition,
                                                             isMenuBar, isTemporary);
                }
                
                try
                {
                    importButton = (Office.CommandBarButton)commandBar.Controls.Add(
                        Office.MsoControlType.msoControlButton, missing, missing, missing, missing);
                    importButton.Style = Office.MsoButtonStyle.msoButtonCaption;
                    importButton.Caption = "Validate Project Name";
                    importButton.Tag = "Validate Project Name";
                    importButton.TooltipText = "Validates a name for later use in Project Server.";
                    importButton.Click +=
                        new Office._CommandBarButtonEvents_ClickEventHandler(ImportButtonClick);
    
                    commandBar.Visible = true;
                }
                catch (ArgumentException ex)
                {
                    MessageBox.Show(ex.Message, "Error adding toolbar button",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                
            }
    
            private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
            {
            }
    
            private void ImportButtonClick(Office.CommandBarButton ctrl, ref bool cancel)
            {
                //ImportDialogBox importDialog = new ImportDialogBox();
                //importDialog.Show();
                
                ProjNameValidate myForm = new ProjNameValidate(); ;
                myForm.Show();
            }
            
           
            #region VSTO generated code
    
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InternalStartup()
            {
                this.Startup += new System.EventHandler(ThisAddIn_Startup);
                this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
            }
            
            #endregion
        }
    }
     
    The form looks like this:-
     
    image 
    And the code behind:-
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Net;
    using System.Text;
    using System.Windows.Forms;
    
    namespace TechEdComAddIn
    {
        public partial class ProjNameValidate : Form
        {
            private const string URLPREFIX = "http://";
            private const string LOGINWINDOWSWEBSERVICE = "_vti_bin/PSI/LoginWindows.asmx";
            private const string PROJECTWEBSERVICE = "_vti_bin/PSI/Project.asmx";
    
            private string baseUrl = "http://brismithwfe/cal/";
    
    
      
            private static WebSvcLoginWindows.LoginWindows loginWindows =
                new WebSvcLoginWindows.LoginWindows();
            private static WebSvcProject.Project project =
                new WebSvcProject.Project();
    
            public ProjNameValidate()
            {
                InitializeComponent();
                string projName = Globals.ThisAddIn.Application.ActiveProject.Name.ToString();
                int extLocation = projName.LastIndexOf(".mpp");
                textBoxProjectName.Text = projName.Substring(0, extLocation);
            }
    
            private void btnValidateName_Click(object sender, EventArgs e)
            {
                try
                {
                    loginWindows.Url = baseUrl + LOGINWINDOWSWEBSERVICE;
                    loginWindows.Credentials = CredentialCache.DefaultCredentials;
                    project.Url = baseUrl + PROJECTWEBSERVICE;
                    project.Credentials = CredentialCache.DefaultCredentials;
    
                   
                    WebSvcProject.ProjectDataSet dsProject =
                            new WebSvcProject.ProjectDataSet();
                    dsProject = project.ReadProjectList();
                    foreach (WebSvcProject.ProjectDataSet.ProjectRow rowProject in dsProject.Project)
                        if (rowProject.PROJ_NAME == textBoxProjectName.Text.ToString())
                        {
                            lblResponse.Text = "Project name already in use";
                            lblResponse.Visible = true;
                            break;
                        }
                        else
                        {
                            lblResponse.Text = "Project name is OK to use.";
                        }
                    Globals.ThisAddIn.Application.ActiveProject.Text1 = lblResponse.Text;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
    
            }
        }
    }
    
    I don’t think there is anything too complicated.  I trim the .mpp off the local filename and then see if it exists on the server.  Globals is the way to interact with the local application object.
    Once you have that available most of the VBA developers out there should be on home territory.  Take a look at the VSTO stuff – it is very simple to deploy too – as Jack’s article outlines.
    Technorati Tags: , ,
     
     
     
     
     
     
     
  • Brian Smith's Microsoft Project Support Blog

    TechEd Preview – Part 3 – Project Server 2007 Provisioning Project Specific Workspaces automatically

    • 10 Comments

    First day of TechEd today and despite the 3hr time difference from Seattle I still woke up early.  This posting will be part of the subject of the chalk talk I am delivering with Boris Scholl tomorrow (6/4) morning.  If any of you remember the Solution Accelerator for Six Sigma this is part inspired by some custom code that was in that solution – and is designed to allow a Project Manager to select a workspace type from a list in a custom project field – and then when she publishes that type of site will be provisioned from a pre-built template.

    The first part of this is to create some templates for new workspaces.  This is covered in the SDK, but briefly you must base any new template on an unlinked site, then you save as a template, then from the template gallery save to a file (*.stp) and then you use stsadm –o addtemplate to bring the template back in so it can be used for provisioning (and a final IIS reset).  You will also need to use the command stsadm –o enumtemplates to get the internal name (something like _GLOBAL_#2) for each of your templates for later use.

    The next step is creating a lookup table to hold the template details – and it should look something like this:-

    image

     

    I am using the description field to hold the internal name of the template as that is the one used when requesting a site to be provisioned.  You could resolve this in code somewhere – it just seemed easier to me to put it here. You also need to create a Project Level custom field that references this lookup table – and in my example I use the “NotYet” value to mean don’t create a site for me.  The names of the field/table aren’t important – but you will need to know the Guid associated with them.  Also you will need to turn off automatic site creation – as we will be controlling this via an event handler.  I am using Red/Green/Blue for the visual recognition for the demo – obviously ISO 9001, Six Sigma, Administration m- would be more useful types of templates to use.

    Now the event handler.  I’ve thrown a few comments in and also it logs to the application event log the different actions it can take.  It could certainly do with more (read some) exception handling… but it does the job.  Based on the custom field requested it will get the template name from the lookup table description.  If a site already exists it will stop – and if the requested site is already in use it will stop.

    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Linq;
    using System.Text;
    using System.Net;
    using Microsoft.Office.Project.Server.Events;
    using PSLibrary = Microsoft.Office.Project.Server.Library;
    
    
    namespace TechEdEventHandler
    {
        public class MyPublishedEventHandler : ProjectEventReceiver
        {
            private const string URLPREFIX = "http://";
            private const string LOGINWINDOWSWEBSERVICE = "_vti_bin/PSI/LoginWindows.asmx";
            private const string PROJECTWEBSERVICE = "_vti_bin/PSI/Project.asmx";
            private const string WSSINTEROPWEBSERVICE = "_vti_bin/PSI/WSSInterop.asmx";
            private const string LOOKUPTABLEWEBSERVICE = "_vti_bin/PSI/LookupTable.asmx";
            private string baseUrl = "http://brismithwfe/cal/";
            private const int EVENTID = 9191;
            
            private string webTemplateName;
            private Guid projectGuid;
            private Guid codeValue;
            const int PROJECT_CUSTOM_FIELDS_ENTITY_TYPE = 32;
            // We need the Guids for the lookup table and custom field - better practice would be to use a settings file
            private Guid workspaceTemplateLUTGuid = new Guid("b0fc9d01-b716-43d3-aa74-335a3297214b");
            private Guid workspaceTemplateCFGuid = new Guid("98c9444e-1fa2-4f12-ab2b-4cb7e1818738");
    
            private static WebSvcLoginWindows.LoginWindows loginWindows =
                new WebSvcLoginWindows.LoginWindows();
            private static WebSvcProject.Project project =
                new WebSvcProject.Project();
            private static WebSvcWssInterop.WssInterop wssInterop =
                new WebSvcWssInterop.WssInterop();
            private static WebSvcLookupTable.LookupTable lookupTable =
                new WebSvcLookupTable.LookupTable();
    
            public override void OnPublished(Microsoft.Office.Project.Server.Library.PSContextInfo contextInfo, ProjectPostPublishEventArgs e)
            {
                string eventName = "Auto Workspace Creation - OnPublished";
                
                loginWindows.Url = baseUrl + LOGINWINDOWSWEBSERVICE;
                loginWindows.Credentials = CredentialCache.DefaultCredentials;
                project.Url = baseUrl + PROJECTWEBSERVICE;
                project.Credentials = CredentialCache.DefaultCredentials;
                lookupTable.Url = baseUrl + LOOKUPTABLEWEBSERVICE;
                lookupTable.Credentials = CredentialCache.DefaultCredentials;
                wssInterop.Url = baseUrl + WSSINTEROPWEBSERVICE;
                wssInterop.Credentials = CredentialCache.DefaultCredentials;
    
                projectGuid = e.ProjectGuid;
    
                WebSvcWssInterop.WssServersDataSet dsWssServersDataSet = 
                    new WebSvcWssInterop.WssServersDataSet();
    
                WebSvcWssInterop.WssSettingsDataSet dsWssSettingsDataSet =
                    new WebSvcWssInterop.WssSettingsDataSet();
    
                WebSvcWssInterop.ProjectWSSInfoDataSet dsProjectWSSInfoDataSet =
                    new WebSvcWssInterop.ProjectWSSInfoDataSet();
    
                // If rowcount is greater than zero then a site already exists for the project - so exit
                dsProjectWSSInfoDataSet = wssInterop.ReadWssData(projectGuid);
                int rowCount = dsProjectWSSInfoDataSet.ProjWssInfo.Rows.Count;
                if (rowCount == 0)
                {
    
                    WebSvcProject.ProjectDataSet dsProject =
                        new WebSvcProject.ProjectDataSet();
                    // We are getting the project dataset - but only for the entity type 32 - custom fields
                    dsProject = project.ReadProjectEntities(projectGuid, PROJECT_CUSTOM_FIELDS_ENTITY_TYPE, WebSvcProject.DataStoreEnum.WorkingStore);
                    // The we look for the workspace template field - and get the code value
                    foreach (WebSvcProject.ProjectDataSet.ProjectCustomFieldsRow rowProjectCF in dsProject.ProjectCustomFields)
                        if (rowProjectCF.MD_PROP_UID == workspaceTemplateCFGuid)
                        {
                            codeValue = rowProjectCF.CODE_VALUE;
                        }
                    // Using the Guid for the lookup table we search for the code value 
                    Guid[] ltUidList = new Guid[] { workspaceTemplateLUTGuid };
                    WebSvcLookupTable.LookupTableDataSet dsLookupTable =
                        new WebSvcLookupTable.LookupTableDataSet();
                    dsLookupTable = lookupTable.ReadLookupTablesByUids(ltUidList, false, 1033);
                    // the code value gets us to the description which we use as the webtemplatename
                    foreach (WebSvcLookupTable.LookupTableDataSet.LookupTableTreesRow rowLookupTable in dsLookupTable.LookupTableTrees)
                        if (rowLookupTable.LT_STRUCT_UID == codeValue)
                        {
                            webTemplateName = rowLookupTable.LT_VALUE_DESC;
                        }
                    dsWssServersDataSet = wssInterop.ReadWssServerInfo();
                    dsWssSettingsDataSet = wssInterop.ReadWssSettings();
    
                    Guid wssServerUid = dsWssSettingsDataSet.WssAdmin[0].WADMIN_CURRENT_STS_SERVER_UID;
                    string wssWebFullUrl = dsWssServersDataSet.WssServers.FindByWSTS_SERVER_UID(wssServerUid).WSS_SERVER_URL
                        + "/" + dsWssSettingsDataSet.WssAdmin[0].WADMIN_DEFAULT_SITE_COLLECTION
                        + "/" + e.ProjectName.ToString();
    
                    int webTemplateLcid = 1033;
                    // If site exists then we cannot create it for this project...
                    bool SiteExists = wssInterop.WSSWebExists(wssWebFullUrl);
                    if (!SiteExists)
                    {
                        //NotYet means we will create it later
                        if (webTemplateName != "NotYet")
                        {   
                            // This is where we create a site if we need one
                            wssInterop.CreateWssSite(projectGuid, wssServerUid, wssWebFullUrl, webTemplateLcid, webTemplateName);
                            
                            string msg = string.Format("{0}: Site {1} created for Project {2}", eventName, wssWebFullUrl, e.ProjectName);
                            WriteEvent(msg, EventLogEntryType.SuccessAudit , EVENTID);
                        }
    
                        else
                        {
                            string msg = string.Format("{0}: No site required at this time for project {1}", eventName, e.ProjectName);
                            WriteEvent(msg, EventLogEntryType.Information, EVENTID);
                        }
    
    
                    }
                    else
                    {
                        string msg = string.Format("{0}: Site {1) already exists", eventName, wssWebFullUrl);
                        WriteEvent(msg, EventLogEntryType.Error, EVENTID);
                    }
    
                }
                else
                {
                    string msg = string.Format("{0}: Workspace already created", eventName);
                    WriteEvent(msg, EventLogEntryType.Information, EVENTID);
                }
                
            }
            
        private void WriteEvent(string msg, EventLogEntryType logEntryType, int eventId)
            {
                EventLog myLog = new EventLog();
                myLog.Source = "Project Event Handler";
    
                string message = msg;
                myLog.WriteEntry(msg, logEntryType, eventId);
            }
        }
    }

    Enjoy!

Page 2 of 2 (8 items) 12