Translate

Friday, June 17, 2011

Update Project level Multiline Text Custom Fields

What a beautilful weather & I was kinda enjoying but suddenly One of My coworker pinged me & asked me a question about the Project level custom fields (multiline Text) so while I explained him about the usage of this kind of field, thought to write down somthing which might help Project Server community :)

Text custom fields can be multiline up to 4000 bytes, for use in project detail pages (PDPs) and with workflows for demand management in Project Web App. Multiline text custom fields are not usable in Project Professional. so I added a Project level Multiline text field in my PDP & now I wanted to update this field in a given project from my PSI program.

Here is the code for the Console application :

1. You will need to add project web service (ProjectWebSvc) web ref in the solution: http://servername/pwa/_vti_bin/PSI/Project.asmx?wsdl
2. Its very basic code, which has TEXT_VALUE update for a Multiline field
_____________________________________________________________________
using System;
using System.Diagnostics;
using System.Net;
using System.Data;
using System.Text;
using Microsoft.Office.Project.Server.Library;
using PSLibrary = Microsoft.Office.Project.Server.Library;

namespace
{
ReadProjectResourcePSIclass Program{

{
static void Main(string[] args)try{
UpdateProjectMultiplineTextCField();
}

{


}
}


{
ProjectWebSvc.
proj.UseDefaultCredentials =
ProjectWebSvc.
Project proj = new ProjectWebSvc.Project();true;ProjectDataSet pds = null;
Guid
projectGuid = new Guid("195D9230-4A41-438A-917F-FDB6B292F586"); //Project for which I want to update the Multiline text field

pds = proj.ReadProjectEntities(projectGuid, 1 | 4 | 32, ProjectWebSvc.
DataStoreEnum.PublishedStore);
      {
    row.TEXT_VALUE =

      }
foreach (ProjectWebSvc.ProjectDataSet.ProjectCustomFieldsRow row in pds.ProjectCustomFields)"TYPE your multiline text,TYPE your multiline text,TYPE your multiline text,TYPE your multiline textTYPE your multiline textTYPE your multiline text,TYPE your multiline text,TYPE your multiline text,TYPE your multiline textTYPE your multiline text,TYPE your multiline text,TYPE your multiline text";Guid sessionUId = Guid.NewGuid();proj.CheckOutProject(projectGuid, sessionUId, " ");Guid jobUId = Guid.NewGuid();proj.QueueUpdateProject(jobUId, sessionUId, pds,
proj.QueuePublish(jobUId, projectGuid,
jobUId =
proj.QueueCheckInProject(jobUId, projectGuid,
false);true, " ");Guid.NewGuid();false, sessionUId, "none");   }

}
_____________________________________________________________________

Thanks to my coworker - Sumit Manchanda for initiating this :)
Happy coding :)

1 comment:

Anonymous said...

cute blog
good tips for Project Portfolio Management..
Project Portfolio Management

SharePoint Designer- Unable to open a workflow - WWF .NET 3.0, must be installed to use the feature

Every day is a learning day and If we don’t learn a new thing today, the day is wasted. I don’t think much of a man who is not wise...