V
Vincenzo
I try to use the Project Server Events, but I can't change the project data
when the project is publishing because the ProjectDataSet property of the
ProjectPrePublishEventArgs object is NULL.
How can I change the project data (custom fields, resources, ...) when I
publish the project?
Thanks, Vincenzo.
------------------------------------------------------------------------------------
This is my code of the Event Handler:
using System;
using Microsoft.Office.Project.Server.Events;
using Microsoft.Office.Project.Server.Library;
using System.Text;
using System.IO;
namespace Mach1EventHandler
{
public class InsertMach1Data : ProjectEventReceiver
{
public override void OnPublishing(PSContextInfo contextInfo,
ProjectPrePublishEventArgs e)
{
e.Cancel = false;
TextWriter wr = new StreamWriter("c:\\temp\\log.txt", true);
wr.WriteLine(DateTime.Now.ToString() + " - publishing " +
e.ProjectName);
if(e.ProjectDataSet == null)
wr.WriteLine(DateTime.Now.ToString() + " - dataset: null");
else
wr.WriteLine(DateTime.Now.ToString() + " - dataset: " +
e.ProjectDataSet.DataSetName);
wr.Close();
}
}
}
when the project is publishing because the ProjectDataSet property of the
ProjectPrePublishEventArgs object is NULL.
How can I change the project data (custom fields, resources, ...) when I
publish the project?
Thanks, Vincenzo.
------------------------------------------------------------------------------------
This is my code of the Event Handler:
using System;
using Microsoft.Office.Project.Server.Events;
using Microsoft.Office.Project.Server.Library;
using System.Text;
using System.IO;
namespace Mach1EventHandler
{
public class InsertMach1Data : ProjectEventReceiver
{
public override void OnPublishing(PSContextInfo contextInfo,
ProjectPrePublishEventArgs e)
{
e.Cancel = false;
TextWriter wr = new StreamWriter("c:\\temp\\log.txt", true);
wr.WriteLine(DateTime.Now.ToString() + " - publishing " +
e.ProjectName);
if(e.ProjectDataSet == null)
wr.WriteLine(DateTime.Now.ToString() + " - dataset: null");
else
wr.WriteLine(DateTime.Now.ToString() + " - dataset: " +
e.ProjectDataSet.DataSetName);
wr.Close();
}
}
}