Showing posts with label Project Server 2007. Show all posts
Showing posts with label Project Server 2007. Show all posts

Thursday, December 4, 2008

Enterprise Custom Fields with project server (PWA) Part-1

Hi guys,

With the request from the users we are here with another post for Enterprise Custom fields with project server (PWA).

We will go step by step to understand how custom field works in PWA or project server.

What is Enterprise Custom Fields?
In simple word Enterprise Custom Fields are useful for storing some extra value or parameter regarding the project.

That value can be useful for reporting or some kind of bifurcation or filtration or to indicating some value which is related to project for business but not in technical term.

You can say it’s a tag that we can give to any project.


How to Use Enterprise Custom Fields?
Let’s have an example:
You are using project server as a repository to monitor all your projects in your organization.

Now suppose you have multiple clients and you are using only one instance of PWA or project server (and you should).
So in this scenario your may have multiple project from multiple clients in same place now how to bifurcate which project is form which client.

At this moment you can use Enterprise custom Fields to store client name and use this as a filtration. This is the simplest example so that everyone can understand what is the use of this Custom Fields.

But in the real scenario this fields can be use in many-many other ways.


Types OF Use Enterprise Custom Fields
You can create Custom Fields against each project, against each Resource or against each task.
So you can create Custom Field by project, Custom Field by Resource, Custom Field by task.


How PWA or Project Server Works with Use Enterprise Custom Fields?
You will find Enterprise Custom Fields in
Server Settings -> Enterprise Custom Field Definition.

Over there you will find some of the predefined Custom Fields.

This place is the repository of custom fields like master location of custom fields.
First you have to create new custom field over here just like entering in master (one time job).

Then that custom field will be available to that entity (project, resource or task).
For an example if you create a custom field with entity project then that custom field available in each project.

You can field that custom field available to each project.
Please check graphical representation for understanding.




Most of the functional points are covered regarding Enterprise Custom Field.

We will come soon with implementation of Custom Field programmatically.

Mean while if you have any doubt then please feel free to comment over here.

Tuesday, June 24, 2008

Project start date in project center PWA.

Entire project plan is depend on Project start date.

And there are a lot of issues related to project start date in project server 2007.

Here we go to step by step.
1) Create a project.
2) Set start date of the project.
3) In MS Project we can set start date from Project -> project information -> start date. By default it will take today’s date.
4) For developers this date will save in PROJ_INFO_START_DATE in Project dataset.
5) Now you create tasks with some specific start date or successors and all that.
6) After that, publish that project to PWA.

In project center screen or PWA start and finish date will show different dates.

Logically it should show date from project info start date.
But it shows the minimum date from all tasks’ start date and maximum date from tasks end date.

There is no any other way to have project info start date (PROJ_INFO_START_DATE) from DB in Project center.

The only solution to overcome this situation we can create a custom field of the project.

Save project info start date in that newly created field and change the view project center web part.

Monday, June 9, 2008

Create a project in project server programmatically

Here is the way how programmatically create a project in project server 2007 (PWA) step by step using PSI.

For creating a project you have to use “_vti_bin/psi/Project.asmx” web service.
To use any PSI web service first you have to login to the server. Check my previous post

Project server has predefined database structure.
So for creating a new project we need t o create a new row in project table.
This row has many columns but only few are required for input and others are non mandatory or filled atomically.

Here are that fields
PROJ_UID : new GUID for project.
PROJ_NAME : name of the project which should be unique.
PROJ_INFO_START_DATE : it is not mendatory but every project must have start date other wuse it will take system date.
PROJ_TYPE : this is important. There are two type of porject in project server one is project and other is Template. For project its value is 0 and for template its value is 1. So we are using 0 as we are creating a project.

then this field value in row we have to add this row in project table.

After that project.asmx have a method called QueueCreateProject.
This method will create a project in draft database and push the argument in Project server Queue.

After generating project in draft database we need to publish that project.
For publishing project we have to call QueuePublish method from Project.asmx
Note: Only published project is available to user in PWA.

And last operation after publishing project we need to do is “check in the project”
Checked out project is visible to user but cannot be editable by any one. For check in the project there is also another method in project.asmx QueueCheckInProject
And as per experienced developer we have to logofffrom PSI server.
Here is the snippet for creating project in project server (PWA).
private WebSvcProject.ProjectDataSet dsProjectDataSet = null;
private Project objProject = null;
private bool CreateProject()
{

try
{
//for creating a new we need to create a new row in project table of project dataset
WebSvcProject.ProjectDataSet.ProjectRow projectRow = dsProjectDataSet.Project.NewProjectRow();
Guid _projectGUID = Guid.NewGuid(); // new GUID for each project
projectRow.PROJ_UID = _projectGUID;
projectRow.PROJ_NAME = "My new Project";
projectRow.PROJ_INFO_START_DATE = System.DateTime.Now;
projectRow.PROJ_TYPE = 0; //0 is for project and 1 is for template
dsProjectDataSet.Project.AddProjectRow(projectRow);

//create a project using project.asmx
objProject.QueueCreateProject(Guid.NewGuid(), dsProjectDataSet,
false);

//after creating project by default it is in draft
//we must have to publish the project
objProject.QueuePublish(Guid.NewGuid(), _projectGUID, true, string.Empty);

//when project is created bu default it is checked out
// we must checkin the project.
objProject.QueueCheckInProject(Guid.NewGuid(), _projectGUID, true, Guid.Empty, "Checking by system");

return true;
}
catch (Exception ex)
{
//log error
return false;
}
}

Friday, June 6, 2008

How to use PSI web service?

For any development regarding project server 2007 or project web access (PWA), we need to use PSI (project service interface) provided by project server.

There are many web service provided for different- different operation. Here is the MSDN link for Finding the PSI Web Services.

But first question is How to use PSI web service?
For that you need to login first for using any of the web service.

So here is the post how to login to use PSI web service?

For login we have to use “_vti_bin/PSI/LoginWindows.asmx” web service.

Here is the code snippet to login using loginwindows.asmx
private LoginWindows objLoginWindows = null;
private void button8_Click(object sender, EventArgs e)
{
if (Login())
{
//go ahead
}
else
{
//throw login failed error
}
}

private bool Login()
{
try
{
SetCredentials();
return objLoginWindows.Login();
}
catch (Exception ex)
{
return false;
}
}

private void SetCredentials()
{
try
{
objLoginWindows.Url = "http://pwaserver:7777/pwa/_vti_bin/PSI/LoginWindows.asmx";
//use dynamic referance and use url from web/app.config
objLoginWindows.Credentials = CredentialCache.DefaultCredentials;
//DefaultCredentials will use curently login user
}
catch
{
//log your error;
}
}

This way you can log in using loginwindows.asmx

After login successfully you can use any other web service according your permission.

Note: you have to need login every time whenever you want to access PSI.
Note: its good practice to log off using Logoff() method of the same loginwindows.asmx after completion of your work.
objLoginWindows.Logoff();

Tuesday, May 27, 2008

Writing and debugging event handlers for Project Server 2007

Hi All,

There are many scenarios where we are required to write an event handlers for Project Server.

Here is a good link for that. Click Here



Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com