I'm trying to access a property of a Task
in an MS Project via System.Type.GetProperty("Finish")
, but it looks like the property (and others like it e.g. Number1
) is not accessible via reflection unless my code specifically uses that property. Is this a compiler setting that I can change? I'm writing a synchronization engine so it is impossible to tell ahead of time what field of a Task
the client system may request.
So with the example below info will be null.
System.Type ty = typeof(Task);
System.Reflection.PropertyInfo info = ty.GetProperty("Finish");
but with the code below info is returned as a valid PropertyInfo object.
Task tk = activeProject.ProjectSummaryTask;
object done = tk.Finish;
System.Type ty = typeof(Task);
System.Reflection.PropertyInfo info = ty.GetProperty("Finish");
I basically expected GetProperty()
to work for all the properties listed in the API for Task
(which are quite a few).
Here is a link to the API for the Finish
property: https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.interop.msproject.task.finish?view=office-project-server
Aucun commentaire:
Enregistrer un commentaire