Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

utilisation des ressources avec visual vasic

1 réponse
Avatar
Michael Parent
bonjour
j'utilise project 2007 professionel et visual basic .net 2005
j'ai instancié une application project dans mon projet vb via automation, et
je désire obtenir les informations des heures planifiées par jour (les mêmes
informations que l'on retrouve dans la fenêtre "utilisation des ressources"


la variable "ass" représente un assignement d'une ressource pour une tâche
et j'obtient plusieurs fois l'erreur suivante au moment de lire les valeurs
(avec la méthode TSVs.value)
"erreur inattendue avec la méthode"

System.Runtime.InteropServices.COMException (0x800A03EC): Erreur inattendue
avec la méthode.
à Microsoft.Office.Interop.MSProject.TimeScaleValue.get_Value()
à Suivi_des_taches.modMain.SyncTachesMSProject(String strFile, Int32
intIDProjet, Int32 intIDProjetMSProject)


voici mon code :

TSV = ass.TimeScaleData(timeStart, timeEnd,
Microsoft.Office.Interop.MSProject.PjAssignmentTimescaledData.pjAssignmentTimescaledWork,
Microsoft.Office.Interop.MSProject.PjTimescaleUnit.pjTimescaleDays)

For Each TSVs As Microsoft.Office.Interop.MSProject.TimeScaleValue In TSV
Application.DoEvents()
Try

If Not CType(TSVs.Value, String) = "" Then
sngValue = CType(CType(TSVs.Value, Single) / (60), Single)
End If

Catch ex As Exception
intErreur += 1
End Try

Next

1 réponse

Avatar
Michael Parent
J'ai trouvé une réponse à mon problème et ca fonctionne bien à présent!!
http://j-integra.intrinsyc.com/support/kb/article.aspx?id9261&cNode=5M3M7A

'SYMPTOMS

'When accessing Microsoft Office Project Professional 2003
(11.0.2003.0816.15) from a Java client which invokes the getValue() method
of TimeScaleValue object for several times, you may get AutomationException:
0x800a03ec - An unexpected error occurred with the method.

'CAUSE

'This is a bug in Microsoft Project which prevents holding references to a
certain number of TimeScaleValue objects, and you will get the same
0x800a03ec error in C# or VB.NET client when retrieving the Value property
of TimeScaleValue object in a loop which iterates more than 10 times. The
garbage collector of .NET or Java is not clearing up the references fast
enough.



"Michael Parent" a écrit dans le message de news:

bonjour
j'utilise project 2007 professionel et visual basic .net 2005
j'ai instancié une application project dans mon projet vb via automation,
et je désire obtenir les informations des heures planifiées par jour (les
mêmes informations que l'on retrouve dans la fenêtre "utilisation des
ressources"


la variable "ass" représente un assignement d'une ressource pour une tâche
et j'obtient plusieurs fois l'erreur suivante au moment de lire les
valeurs (avec la méthode TSVs.value)
"erreur inattendue avec la méthode"

System.Runtime.InteropServices.COMException (0x800A03EC): Erreur
inattendue avec la méthode.
à Microsoft.Office.Interop.MSProject.TimeScaleValue.get_Value()
à Suivi_des_taches.modMain.SyncTachesMSProject(String strFile, Int32
intIDProjet, Int32 intIDProjetMSProject)


voici mon code :

TSV = ass.TimeScaleData(timeStart, timeEnd,
Microsoft.Office.Interop.MSProject.PjAssignmentTimescaledData.pjAssignmentTimescaledWork,
Microsoft.Office.Interop.MSProject.PjTimescaleUnit.pjTimescaleDays)

For Each TSVs As Microsoft.Office.Interop.MSProject.TimeScaleValue In TSV
Application.DoEvents()
Try

If Not CType(TSVs.Value, String) = "" Then
sngValue = CType(CType(TSVs.Value, Single) / (60), Single)
End If

Catch ex As Exception
intErreur += 1
End Try

Next