问题描述
从MS Project文件读取 2400 任务时遇到问题。我的代码成功运行,但是一段时间后出现下一个错误:
System.Runtime.InteropServices.COMException (0x80010001): Aanroep geweigerd door aangeroepene. (Uitzondering van HRESULT: 0x80010001 (RPC_E_CALL_REJECTED)) bij Microsoft.Office.Interop.MSProject.Task.get_Name() bij _Default.MSPReadAll() in D:\Websites\WebSite1\MSP\Default.aspx.vb:regel 142
有时是在 140 个任务之后,而另一次是在 240 个任务之后。我检查的信息越少,可以阅读的任务越多。所以我在想一种超时。希望有人@stackoverflow可以帮助我。
Sub MSPReadAll()
Try
Dim appclass As New Application
appclass.displayAlerts = False
appclass.FileOpenEx(MppFile)
appclass.Visible = True
Dim project As Project = appclass.ActiveProject
Dim oSubTask As Task
Dim taskName As String
Dim taskId As String
Dim taskStart As Date
Dim PrevTask As String = ""
Dim SuperVisor As String = ""
Dim aantal As Integer = 0
Dim err As String = ""
Dim totaal As Integer = project.Tasks.Count
Response.Write(totaal.ToString)
For Each oSubTask In project.Tasks
Try
aantal = aantal + 1
taskId = oSubTask.UniqueID
taskName = oSubTask.Name
taskStart = oSubTask.Start
PrevTask = oSubTask.Predecessors
SuperVisor = oSubTask.Text18
Response.Write("<p><strong>" & taskName & " (" & aantal & ")</strong><br>ID: " & taskId & "<br>Start: " & taskStart & "<br>PrevTask: " & PrevTask & "<br>SuperVisor: " & SuperVisor & "</p>")
Catch ex2 As System.Exception
Response.Write("EX2 " & ex2.ToString)
End Try
Next
appclass.FileExit(PjSaveType.pjSave)
Catch ex As System.Exception
Response.Write(ex.ToString)
End Try
End Sub
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)