About Me

My photo
System Analyst,Collaboration Servers Integrate,Enterprise setup planner.

Monday, 18 April 2011

Assign or Set the values to Custom Fileds of Project Server 2010

Guid sessionGuid = Guid.NewGuid();
Guid jobGuid = Guid.NewGuid();

project.CheckOutProject(prjGuid, sessionGuid, "Checked-out:PSI");
System.Threading.Thread.Sleep(1000);
CSF_WS.CustomFieldDataSet CstmDS = CustF.ReadCustomFields(null, false);
Project_WS.ProjectDataSet tempProject;
tempProject = project.ReadProject(prjGuid, Project_WS.DataStoreEnum.WorkingStore);

// DateTime startdate = (DateTime)ds2.Tables[0].Rows[i1]["PlannedStartDate"];
DateTime startdate = DateTime.Now.AddDays(2);

tempProject.Project.Rows[0][tempProject.Project.PROJ_INFO_START_DATEColumn] = startdate;
//tempProject = ((Project_WS.ProjectDataSet)tempProject.GetChanges(DataRowState.Modified));

Project_WS.ProjectDataSet.ProjectCustomFieldsDataTable P_dt = new EPMSamples.Project_WS.ProjectDataSet.ProjectCustomFieldsDataTable();


P_dt = tempProject.ProjectCustomFields; //*****This Line Represents the Assigned fields are present in Project.


CstmDS = CustF.ReadCustomFieldsByEntity(new Guid(PSLibrary.EntityCollection.Entities.ProjectEntity.UniqueId.ToString()));


//// Code FOR NEWLY ASSIGN THE VALUES TO CUSTOM FIELD i.e SET THE VALUES TO CUSTOM FIELDS


foreach (DataRow row in CstmDS.CustomFields)
{
//This is Normal project Text field.
if ((String)row["MD_PROP_NAME"] == "Test")
{
Project_WS.ProjectDataSet.ProjectCustomFieldsRow rowProjCF = P_dt.NewProjectCustomFieldsRow();
rowProjCF.MD_PROP_UID = (Guid)row["MD_PROP_UID"];
rowProjCF.PROJ_UID = prjGuid;
rowProjCF.MD_PROP_ID = (int)row["MD_PROP_ID"];
rowProjCF.CUSTOM_FIELD_UID = Guid.NewGuid();
//rowProjCF.TEXT_VALUE = ds2.Tables[0].Rows[i1]["BusinessAreaLeader"].ToString();
rowProjCF.TEXT_VALUE = "Testing values1";

tempProject.ProjectCustomFields.AddProjectCustomFieldsRow(rowProjCF);
}

//This is field Lookup field which dont have Default value, it has Default value
if ((String)row["MD_PROP_NAME"] == "Sample Areas Impacted")
{
foreach (Project_WS.ProjectDataSet.ProjectCustomFieldsRow rowProjCF in P_dt)
{

if ((String)row["MD_PROP_NAME"] == "Sample Areas Impacted" && row["MD_PROP_UID"].ToString() == rowProjCF["MD_PROP_UID"].ToString())
{
rowProjCF.MD_PROP_UID = (Guid)rowProjCF["MD_PROP_UID"];
rowProjCF.PROJ_UID = prjGuid;
rowProjCF.MD_PROP_ID = (int)rowProjCF["MD_PROP_ID"];
rowProjCF.CODE_VALUE = GetLulupValueCode("Marketing");

}
}

}

//This is field Lookup field which dont have Default value.
if ((String)row["MD_PROP_NAME"] == "Office Division")
{

Project_WS.ProjectDataSet.ProjectCustomFieldsRow rowProjCF = P_dt.NewProjectCustomFieldsRow();
rowProjCF.MD_PROP_UID = (Guid)row["MD_PROP_UID"];
rowProjCF.PROJ_UID = prjGuid;
rowProjCF.MD_PROP_ID = (int)row["MD_PROP_ID"];
rowProjCF.CUSTOM_FIELD_UID = Guid.NewGuid();
//rowProjCF.TEXT_VALUE = ds2.Tables[0].Rows[i1]["BusinessAreaLeader"].ToString();
rowProjCF.CODE_VALUE = GetLulupValueCode("Development");
tempProject.ProjectCustomFields.AddProjectCustomFieldsRow(rowProjCF);

}


}


//END Code FOR NEWLY ASSIGN THE VALUES TO CUSTOM FIELD

trackLog(" Updating project property changes.");
MessageBox.Show("Row =" + tempProject.ProjectCustomFields.Rows.Count.ToString());
if (tempProject.ProjectCustomFields.Rows.Count > 0)
{
project.QueueUpdateProject(jobGuid, sessionGuid, tempProject, false);


Guid publishguid = Guid.NewGuid();

project.QueuePublish(publishguid, prjGuid, true, String.Empty);

this.UpdateStatus("Update In Queue.....");
//this.textBox1.Text = " Update in Queue....";
Jobstate = WaitForQueue(jobGuid);
if (Jobstate == false)
{
trackLog("Queue Job for Project Custom fields Update Failed.");
return Jobstate;
}
else
{
trackLog("Queue Job Project Custom Fields Update succeeded.");
}

//System.Threading.Thread.Sleep(9000);
}
MessageBox.Show("Updated");

trackLog(" Checking-in project.");
jobGuid = Guid.NewGuid();
project.QueueCheckInProject(jobGuid, prjGuid, true, sessionGuid, "Checking-in:PSI");
Jobstate = WaitForQueue(jobGuid);
if (Jobstate == false)
{
trackLog("Queue Job Failed to Checking-in Project .");
return Jobstate;
}
System.Threading.Thread.Sleep(9000);

}

Wednesday, 13 April 2011

Steps for Assign the values to Custom Fields In Project Server 2010.

Step1:Create the Project
Step2:Edit the project
Step3:Checkout the project
Step4:Publish the project(Saves Drafts DB to Publish DB)
Step5: Check-in the Project

Monday, 11 April 2011

Farm Backup of Project Server 2010

Friday, 8 April 2011

Project Server 2007 Queue System





The user makes a server request from a client application (for example, publishing a project from Project Professional). The user passes a Job ID (a unique identifier that tracks the request) as part of the request.

The Project Web service takes the request and puts it in the queue.

A Job ID is issued to the user as an acknowledgement.

The user queries to check the status of the request through the issued Job ID.

The Office Project Server 2007 Queuing System returns the status of the request to the user.

Project Server important Urls

http://msdn.microsoft.com/en-us/library/ff462061.aspx ==>SharePoint 2010 Class library & web Service URL
http://msdn.microsoft.com/en-us/library/ms734631(v=vs.85).aspx =>
WWF Basics
http://msdn.microsoft.com/en-us/library/ms734702(v=vs.85).aspx =>Programing WWF


http://msdn.microsoft.com/en-us/library/ms440519(v=office.12).aspx
http://msdn.microsoft.com/en-us/library/ff843379.aspx

Custom Fileds;
http://www.projectified.com/projectified/2007/10/programmatic-ac.html
http://msdn.microsoft.com/en-us/library/websvclookuptable.lookuptable.readlookuptables.aspx

Code Samples ProjectServer2010
http://207.46.16.248/en-us/library/websvcproject.project.readprojectlist_di_pj14mref.aspx

http://www.eggheadcafe.com/software/aspnet/35906199/how-to-save-project-custom-field-value-thru-psi.aspx

http://projectserverblogs.com/index.php?paged=3&s=sdk