S
Sergey E.
Hi guys!
Could anybody help me to understand what is wrong?
The task I'm trying to do: add object of type
Microsoft.Office.Interop.MSProject.Exception to collection of exception items
(this ‘exception’ class represents a vacation and is used within calendar).
I found only one way to do this - using of Add method of Exceptions
collection. But when I invoke it interop library throws some exception that
could not identificate itself – no information what kind of exception
occurred, only a notice that smth. failed. It confuses me.
Here is some code to understand what I’m doing. Maybe I’m wrong somewhere
but regarding to this page
http://msdn.microsoft.com/en-us/library/bb178424.aspx everything looks fine.
Resource resource = DADataProvider
..Instance.Application.ActiveProject.Resources[resourceId];
resource.Calendar.Exceptions.Add(
PjExceptionType .pjYearlyPositional, vacation.Start, vacation.Finish, 0,
vacation.Type, 0, 0, 0, 0, 0, 0);
vacation.Start, vacation.Finish – objects of DateTime type, vacation.Type -
string
public class Vacation
{
private readonly int _resourceId;
private DateTime _start;
private DateTime _finish;
private string _type;
public Vacation(int resId)
{
_resourceId = resId;
}
public int ResourceId
{
get { return _resourceId; }
}
public DateTime Start
{
get { return _start; }
set { _start = value ; }
}
public DateTime Finish
{
get { return _finish; }
set { _finish = value ; }
}
public string Type
{
get { return _type; }
set { _type = value ; }
}
}
Any help would be very appreciated!
Could anybody help me to understand what is wrong?
The task I'm trying to do: add object of type
Microsoft.Office.Interop.MSProject.Exception to collection of exception items
(this ‘exception’ class represents a vacation and is used within calendar).
I found only one way to do this - using of Add method of Exceptions
collection. But when I invoke it interop library throws some exception that
could not identificate itself – no information what kind of exception
occurred, only a notice that smth. failed. It confuses me.
Here is some code to understand what I’m doing. Maybe I’m wrong somewhere
but regarding to this page
http://msdn.microsoft.com/en-us/library/bb178424.aspx everything looks fine.
Resource resource = DADataProvider
..Instance.Application.ActiveProject.Resources[resourceId];
resource.Calendar.Exceptions.Add(
PjExceptionType .pjYearlyPositional, vacation.Start, vacation.Finish, 0,
vacation.Type, 0, 0, 0, 0, 0, 0);
vacation.Start, vacation.Finish – objects of DateTime type, vacation.Type -
string
public class Vacation
{
private readonly int _resourceId;
private DateTime _start;
private DateTime _finish;
private string _type;
public Vacation(int resId)
{
_resourceId = resId;
}
public int ResourceId
{
get { return _resourceId; }
}
public DateTime Start
{
get { return _start; }
set { _start = value ; }
}
public DateTime Finish
{
get { return _finish; }
set { _finish = value ; }
}
public string Type
{
get { return _type; }
set { _type = value ; }
}
}
Any help would be very appreciated!