Tuesday, November 25, 2008

Employee Directory WebPart


I recently had the challenge of implementing a webpart for a client to show a list of employees that was Presence Aware. Initially I could not get the awareness to work until I stumbled across some very useful resources that explained the 'hey presto' solution to get this working.

I followed this guide to implement the web part in Microsoft Office SharePoint Server. Then this older article to solve my problems with Presence awareness

Good luck and if you follow the guides I have listed you should have no problems. They will also provide you with a great base for extending the capabilities of the webpart.

Wednesday, April 11, 2007

Web Services Contract First - WSCF (Thinktecture)

One of my old favourites is approaching web services development from a contract first approach as opposed to developing in Visual Studio using a methods based approach. I recently completed a project using the WSCF tool and had in my mind to start my web services by developing the contract first. Now that brings me to another interesting point about contract first development - For most people and teams WSDL is really too complicated to hand craft . So here is my checklist that led me to adopt the WSCF tool for my project:
  • Design contract first to avoid dependence on inherited objects e.g. datasets
  • Don't want to handcraft complicated WSDL
  • Rich generation of strongly typed objects
  • Efficient handling of object collections
  • Proxy classes that lend themselves to quick programming related tasks
  • Code generation so I could concentrate on implementing the methods
  • Approach contact first by designing the XSD's first

I encourage you to play with this tool using the provided walkthrough which will give you a good basic understanding of how it works. From there you can experiment with a whole host of code generation features for your objects and WSDL. An especially nice feature is the tight integratation in the Visual Studio 2005 IDE. Please note are quite a few limitations with WSCF so it is not a panacea for all your web service ills. The forum on the thinktecture site will give guidance on what you can and can't do.

Enjoy!

Tuesday, April 10, 2007

PSI - Add Resource custom field values based on a Lookup table values

When you are trying to add values based on Project Server 2007 lookup values the code can get a little tricky so I thought I would outline the steps and include the appropriate code for your reference.

1. Establish a ResourceDataset object
2. Populate the ResourceDataset using the Resource GUID
3. Call my AddResCF function as below passing in the value text (Please refer to the inline comments for further direction)

private bool AddResCFs(Proxy.ResourceDataSet resourceDS, string CFText)
{
bool result = false;
Guid structGuid = Guid.Empty;
string cf_md_prop_name = "";
Guid cf_md_prop_uid = Guid.Empty;
int cf_md_prop_id = int.MinValue;
byte cf_md_prop_type_enum = byte.MinValue;
try
{

//establish a LookupTable dataset using the name of the lookup table which in my case is a class variable (I haven't included the GetLookup_UID function as its pretty straight forward).
Guid LTGuid = new Guid(CustomUtils.GetLookup_UID(lookupName));
//create a lookup table dataset
Proxy.LookupTableDataSet dsLookup = new Proxy.LookupTableDataSet();

//Populate the LookupDataset using the Guid returned above
dsLookup = utils.LookupTableProxy.ReadLookupTablesByUids(new Guid[] { LTGuid }, false, int.Parse(LANGUAGE_ID.ToString()));

//Now check if the value exists in the Lookup table ( in this instance I am querying the description column instead of the name column) The LU_ValueExists just does a for each on the rows in the LookupTableDataset and set the result to true if the value is located
if (LU_ValueExists(dsLookup,"lt_value_desc", CFText))
{
//Create a ResourceCustomFieldsRow and populate the neccesary columns
Proxy.ResourceDataSet.ResourceCustomFieldsRow cfRow = resourceDS.ResourceCustomFields.NewResourceCustomFieldsRow();

//the following fields are not required but should be set to null for correctness
cfRow.SetNUM_VALUENull();
cfRow.SetFLAG_VALUENull();
cfRow.SetDUR_VALUENull();
cfRow.SetDUR_FMTNull();
cfRow.SetDATE_VALUENull();
cfRow.SetTEXT_VALUENull();

//Next populate the custom fields row with the correct property values using the Enterprise field name (different from LookupTable name). Again I am using a class variable for this purpose.
cf_md_prop_uid = CustomUtils.GetCustomFieldsProps(entfieldName, out cf_md_prop_name, out cf_md_prop_id, out cf_md_prop_type_enum);
if (cf_md_prop_uid != Guid.Empty)
{
cfRow.MD_PROP_UID = cf_md_prop_uid;
cfRow.MD_PROP_ID = cf_md_prop_id;
cfRow.CUSTOM_FIELD_UID = Guid.NewGuid();
cfRow.FIELD_TYPE_ENUM = cf_md_prop_type_enum;
cfRow.CODE_VALUE = skill_struct_uid;
cfRow.RES_UID = (Guid)resourceDS.Resources.Rows[0]["RES_UID"];
//add row to ResourceDataset
resourceDS.ResourceCustomFields.Rows.Add(cfRow);
result = true;
}
else
{
result = false;
}
}
return result;
}

4. Call the UpdateResources of your PSI Resources proxy object
private bool UpdateResourceEntField(Proxy.ResourceDataSet ResourceDS, Guid resGuid)
{
//add situation for exception handling
Proxy.ExceptionHandlers.Situation situation = Proxy.ExceptionHandlers.Situation.AddResourceSkills;
try
{
//check the resource out before calling the update method (I prefer this to the included check-//out boolean included in the function call)
//NB: Remember to include checkin code in your exception handlers as the resource will remain checked out if an handled exception occurs
bool bCheckOut = false;
bCheckOut = CheckOutResource(resGuid);
Proxy.Global.utils.ResourceProxy.UpdateResources(ResourceDS, false, false);
//Checkin the resource
bCheckOut = CheckInResource(resGuid);
return true;
}

Please note the above assumes that you already know the lookup table row value so you can read the loopuptable using a filter with the value specified. Also I have tried at length to just create an empty ResourceDataSet and then just add a populated ResourceCustomFields row but kept getting a GeneralUnhandledException from the PSIErrors collection. NICE!

The above is not a full set of functions but should get you going in the right direction. If I receive enough requests I'll polish it up into a little sample app for download.

Also I thought a little call to action: We have to share our Project Server Interface (PSI) code as MS didn't give us much to go on. The more that gets out there, the easier it will become to find resources on people's blog and discussion groups. Thanks for listening to my rant :-)

Project Server 2007 - SQL (not mdb) Analysis Services Repository

I recently had to install Analysis Services 2005 subsequent to the initial installation of PS2007. I found this great tip and database backup on Christophe Fiessinger's Blog. The post details how to setup a SQL database copy of the Analysis Services repository...read more...

You will need to have the correct products installed and then you can update the ini file for the correct settings as specified in Christophe's post. (check here on Projectified)

Friday, March 30, 2007

PS2007 Task Duration Calculation (based on Days)

This is just a short blog to comment on a little problem I recently ran into regarding updating the duration for a task using the PSI. The problem was 8 inches from the screen (i.e. me) however I thought I would blog about it to save someone else the problem (embarrassment). When adding a task duration to the ProjectDataset.TaskRow object the figure has to represent tenths of minutes as specified in the SDK class documentation. Here is a complete copy of my CreateTask function. Please note the example is written in C# and based on a strongly typed TaskDetails object.

public static void CreateTask(Proxy.ProjectDataSet dataset, int projNum, Proxy.TaskInfo TaskDetails, string name, Guid taskGuid)
{
Proxy.ProjectDataSet.TaskRow taskRow = dataset.Task.NewTaskRow();
taskRow.PROJ_UID = dataset.Project[projNum].PROJ_UID;
taskRow.TASK_UID = taskGuid;
TimeSpan span = TaskDetails.EndDate.Subtract(TaskDetails.StartDate);
int Days = span.Days;
taskRow.TASK_DUR_FMT = (int)PSLibrary.Task.DurationFormat.Day;
taskRow.TASK_DUR = (Days * 4800);
taskRow.TASK_NAME = name;
taskRow.TASK_START_DATE = TaskDetails.StartDate;
taskRow.TASK_FINISH_DATE = TaskDetails.EndDate;
//TaskDetails.Config_Position;
taskRow.TASK_PRIORITY = int.Parse(TaskDetails.Priority);
//TaskDetails.Project_Code;
taskRow.TASK_CONTACT = TaskDetails.TaskOwner;
//TaskDetails.WO_Code;
dataset.Task.AddTaskRow(taskRow);
}


Please note that line taskRow.TASK_DUR_FMT = (int)PSLibrary.Task.DurationFormat.Day only specifies how the duration will be displayed in the Project Server interfaces (PWA & Project Prof).

The 4800 figure should be changed based on the standard working hours in your project calendar. If the calendar used has a different number of working hours you will need to update this figure based on the following calculations:.

Here is how you get to 4800 to represent tenths of a minute.
Standard calendar = 8 hrs per day

8 Hours = 480 minutes

X10 = 4800 tenths of minutes

This presents a problem with maintainability but that is a configuration issue and something you will need to handle separately.

Friday, October 20, 2006

IE 7 - Missing drag links

I still consider IE 7.0 is missing one killer feature that I love about firefox. I would love to be able to drag a link from a page being viewed to the tabs area and either drop it on an existing tab or create a new tab. Otherwise I think the new browser from MS is great and will finally put an end to all those open windows and the naf grouping in the desktop toolbar. Of course I would probably just use Firefox if MS would ensure that the javascript they used on dynamic pages worked in that browser. I can't see that happening any time soon though.

Thursday, May 11, 2006

Project Manager field - Project Server 03

The project managers field is input in the file properties dialog in Project Professional. It is called the author field. This maps backs to the project server database in the msp_projects table and is located in the proj_prop_manager field.

Friday, May 05, 2006

Rename a published project - Project server 2003

Some notes on the process to rename a published project in Microsoft Project Server 2003. First off download the Rename Project Tool from Microsoft. Next you will need to install the tool on the machine running project server. In the installation guide, I have always created an additional registry key for the PDSRights.CPDSRights value, incrementing the string PDSExtensionExN increasing N by 1. This is regardless of whether there is already PDS extensions installed on the machine. (That will make more sense when you're actually installing the tool and referencing the guide). There is some confusion about required security credentials required to Logon to the Project Server using the tool. It has always worked for me using the server administrator account, however the Trusted Connection checkbox will generally allow you to overcome logon failures! Also make sure that all updates have been processed for the project in question - check this with the project manager and resources.

It is merely then a case of running the tool and choosing the project you wish to rename.

The additional step not documented by Microsoft is to update the Windows SharePoint Services site with the new project name. To do this you logon the WSS site with an administrator account and do the following:
1. Go to Site Settings.
2. Under Customization select Change site title and description.
3. Modify the title and click OK.

I really don't consider this tool should be installed on project manager's machines as the installation is not clean and usability is not well considered. This should remain a tool used by System Administrators and IT staff. If you are looking for a more user friendly way to rename projects then check out the Project Renamer add-on from Bogdanov and Associates. This tool claims to integrate nicely into Project Web Access. I guess if your organisation renames a lot of projects then the investment in an add-on like this could be justified.

Enterprise Library 2.0 - Hands on Labs

These labs have now become available here. For any .Net developers still doing cross cutting business logic other ways I would encourage you to try out Enterprise library. At a high level it is useful for (in no order of priority):

  • Auditing
  • Logging
  • Configuration
  • Security
  • Data Access
  • Exception Management

I basically wanted to post this on my blog as I am constantly amazed at the number of .Net developers that I speak with who have near used this set of tools. For mine this continues to be the crowning glory for the MS patterns and practices group.

Friday, April 28, 2006

Pair Programming

A few year ago I had the opportunity to work in a pair programming environment. After that experience I have always believed that in the right circumstances, pair programming increases productivity and more importantly, the quality of deliverables.

Fundamentally the decision to allocate pairs to a task should not be collaboratively made by the development team, but rather made by the architect / manager based on feedback from team members. Some of the considerations an architect needs to consider include:
  • Complexity of task
  • Capability of the programmer(s)
  • Competing priorities
  • appetite for quality and therefore risk mitigation

This success of pair programming also relies on the management taking a proactive view on quality outputs. Which ever way you slice quality considerations, it makes for a better business. The difficulty is that too many manager's are focused on quick turn arounds and quick wins. I some words of advice for those managers, A sustainable business has to be built on quality! Jonathan Cogley ran an interesting little experiment on this subject. Check out his blog here.

Tuesday, March 28, 2006

BizTalk 2006 RTM

Caught this on BizTalkBills blog. Everyone without an MSDN subscription will have to wait for another month or so for the full product release.

Friday, February 24, 2006

WinFX February CTP

Having not played with the beta's or CTP of Windows Workflow Foundation I decided this afternoon I would quickly install this and get some sample happening. Well a few hours later I have the basics installed on a Virtual Image. Why does this always take longer than u think? Ho Hum. The best download spots are MSDN Vista and WinFX beta page at MSDN and The Official Microsoft Windows Workflow site. I'm particularly interested in looking at the Workflow functionality as compared to vendor based products like K2.Net and Captaris. I'll try to keep this blog up to date with my findings.

Ph..by the way make sure you completely remove the Jan CTP and previous betas before installing.

Monday, February 13, 2006

Anthem.Net for Ajax in .Net 1.1 and 2.0

This is a great tool developed by Jason Diamond for simplifying Ajax implementations using Visual Studio 2005. Microsoft certainly have made this technology complicated with Atlas. I recall playing with Atlas last year and thinking it was too cumbersome for limited functional implementations. You can get Anthen on its own sourceforge project.

Friday, January 20, 2006

Visual Studio 2005 & Enterprise Library June 2005

After trying unsuccessfully to get Enterprise Library June 2005 to work in my .Net 2.0 application I discovered this great article by Michael Schmitt on the codeproject website. Prior to running up an app in VSTS 2005 I had naively believed Ent Lib June 05 was compatible with .Net 2.0. Michael's article quickly allowed me to keep me going. As an aside I have downloaded the Nov CTP release of Ent Lib 2.0 which is available on the patterns and practices website on gotdotnet. As I am working on a commercial project for a client I will stick with the stable June 2005 release rather than place my unsuspecting client on the bleeding edge.

Thursday, January 19, 2006

Holidays in Fiji

Bella and I recently returned from a well earned break in Fiji. We had an amazing time and I would recommend it to anyone who enjoys the sun, sand and water with a heap of friendly people thrown in! I have included this photo of a sunset panorama I stitched from the view from our resort villa. It was great chilling out most afternoons having a wee drink while the sun went down.
After that sort of relaxation, I feel like I have enough charge in the batteries to tackle the new technical stack from our friends at MS. Here goes!

SQL 2005, XML, XPath and Performance

I have been playing with the XML querying in SQL Server 2005 and have to say that this is nice to have what Oracle has had for a number of years now. The performance penalties associated with querying XML columns directly has presented me with a bit of a conundrum in terms of performance. Accepting that indexes can be applied to XML columns to improve query performance there still would be a significant penalty associated with querying node values within the XML column data. As it stands I believe common sense should prevail. If your application can tolerate the performance hits then don't worry about it. If perfromance is a prevalent issue the mitigating steps will need to be taken.

One suggested alternative I have read is to promote the node values into a column of not XML data type, but a data type that supports faster relational DB queries. Interestingly you would have to do this during the database design phase of development with dual updates from update code in an application or SQL. This means having a relatively known and stable XML structure. Another option is to perform a straight forward dynamic query at run time within the SQL engine i.e. retrieve the node values from the XML column and place into a column within a temporary table (or the like) for more complex data queries to be performed. Maybe there is a better approach but I am yet to find it!

As an aside when an index is created on an XML column (CREATE PRIMARY XML INDEX idx_Index ON Table(Column) ,apparently this creates a node table to improve searching of XML structures. Obviously if it doesn't have to build on in memory structure for each query then this would be faster than a non indexed XML column. I need to investigate what happens to newly created XML data that has more nodes. Does the index update with every insert? If it doesn't then loading an XML schema (XSD) would be recommended in addition to regular updates of the index.

Friday, December 16, 2005

EPM and Costs

Accepting my opinions on the importance of methodology and process, EPM implementations are not as cheap as a first glance might appear i.e product cost alone. Inevitably the implementation of an EPM tool like project server will identify process change. I should add that the process changes are definitely worth while as they add consistency and therefore transparency across the enterprise. Of course with this kind of change there are the associated change management, learning & development costs. When compared to potential cost savings of transparent and accountable issue and risk management, the cost could be considered relatively small. The problem as I see it, rests in companies not having a tangible way of measuring the cost of risk realisation which prohibits decision makers being in a position to justify the spend on an EPM solution. It seems to be a bit of chicken and egg scenario i.e. effective program/risk management is an outcome of EPM. This is only one cost justification for EPM but many more exist.

Anyway, as corporations grow in size and complexity, effective approaches to EPM will realise competitive advantages and the ability to respond quickly to costly mistakes. Let's remember that in today’s market, atleast 60% of projects die a slow death due to the many problems not being captured by current processes. It would be scary to quantify the lost revenue faced by many large corporates.

EPM with Project Server 03

I would like to share some thoughts on my experience with Microsoft Project Server 2003 as an EPM tool. I am convinced that Enterprise Project Management (EPM) should be adopted by more organisations as a way of adding increased visibility and accountability to their PM processes. What organisations need to appreciate is that any tool, including Project Server, only addresses about 30% of the EPM dilemma. In my experience most companies do not place enough emphasis on the methodologies and processes required to compliment the effectiveness of these tools. Project Server lends itself well to customisation and organisation's can really leverage its power by incorporating their practices and processes into the customisation and configuration of this product.

The biggest feedback I hear from executives is "I need to make my project manager's more accountable so I can achieve a more objective view of my programs and portfolios". In my opinion, PMs have not really had fair levels of accountabilities and spend an inordinate amount of time scrummaging to defend the current state of play. Reporting and resource management continue to plague the life of a PM and EPM goes some way towards adding a manageable structure to this dilemma. Unfortunately there is also the difficulty of having executives taking responsibility for identified risks/issues. Project Server will add traceable history to these problems, which depending on how competent you are, will be considered a good or bad thing.

Project Server Traffic Light Indicators - SQL Reporting Services

Recently I had to mirror a custom Project Center view from Project Server 03 using reporting services. When trying to dynamically display the traffic light indicators in a SQL reporting services report I started to confront some of the limitations of the 2000 version of this product. The assumption was that these images were not included in the datbase as BLOBS. The problem came when trying to dynamically load an image based on a numeric database value and the relative URL path. The trick I discovered (thanx Google newsgroups) was some quite simple logic in the value attribute of the image control. As an example, I have included the logic for the the schedule field from the dataset.

=iif(Fields!Schedule.Value="1","02 red.jpeg", iif(Fields!Schedule.Value="3","01 green.jpeg",iif(Fields!Schedule.Value="2","03 yellow.jpeg","")))

The logic driving the field values is contained in a SQL view. Hopes this helps someone else trying to do a similar thing.