Autodesk Vault Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
"Value of type long can not be converted to 1-dimansio nal array of long"
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I try to change the status on a file from work in progress to released.
but i keep getting the error "Value of type long can not be converted to 1-dimansional array of long"
please help with this, i cant figure out how to change the file status :-(
Dim files As File() = docSvc.GetLatestFilesByFolderId(parentFolder.Id, False)
If (Not files Is Nothing AndAlso files.Length > 0) Then
For Each file As File In files
Dim MyfileName(0) As String
MyfileName(0) = "VAULT002.idw"
If file.Name = MyfileName(0) Then
'MsgBox(file.FileLfCyc.LfCycStateId.ToString)
MsgBox(parentFolder.FullName & "/" & file.Name & " - " & "FilID: " & file.Id & " - " & "FilMasterID: " & file.MasterId)
Dim ThisFileID As Long = file.Id
Dim ThisFileMasterID(0) As Long
ThisFileMasterID(0) = file.MasterId
'Lifecycle Definitions
'Name : Monsun Basic Release Process = 6
'Lifecycle States
'Work in Progress = LifecyclestateID 24
'For Review = LifecyclestateID 25
'Released = LifecyclestateID 26
'Obsolete = LifecyclestateID 27
Dim MyLifecycleDefinition As LfCycDef
Dim docsvcExt As Autodesk.Connectivity.WebServices.DocumentServiceE xtensions
Dim ThisFileLifecycleStateName As String = docSvc.GetFileById(ThisFileID).FileLfCyc.LfCycStat eName
Dim ThisFileLifeCyclestateID As Long = docSvc.GetFileById(ThisFileID).FileLfCyc.LfCycStat eId
Dim ThisFileLifeCycledefinitionID As Long = docSvc.GetFileById(ThisFileID).FileLfCyc.LfCycDefI d
MsgBox("LifecyclestateName: " & ThisFileLifecycleStateName & " - LifecyclestateID: " & ThisFileLifeCyclestateID & " - Lifecycledefinition: " & ThisFileLifeCycledefinitionID)
If ThisFileLifeCyclestateID = 24 Then
ThisFileLifeCyclestateID = 26
Dim Thisfile As File
Thisfile = docsvcExt.UpdateFileLifeCycleStates(ThisFileMaster ID, ThisFileLifeCyclestateID, ("TEST RELEASE"))
End If
Exit For
End If
Next file
End If
Solved! Go to Solution.
Re: "Value of type long can not be converted to 1-dimansio nal array of long
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
The second parameter in UpdateFileLifeCycleStates needs an array of Long values. You are passing in a Long instead of a Long().
Also you don't want to hard-code the lifecycle ID values. It's fine for testing, but those numbers may change. A better approach is to look lifecycle state based on its system name, which will not change. You do this by calling GetLifeCycleDefinitionsByIds then scanning through the results for the LfCycDef that matches the system name.
Re: "Value of type long can not be converted to 1-dimansio nal array of long
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I know that this is the problem but please show me how to pass / decleare this long() array?
I can figure out how to declare this. I really need to figure this out bud i am stuckt here :-(
Can you please show how to do this the right way?
Regards.
Kent boettger
Re: "Value of type long can not be converted to 1-dimansio nal array of long
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
This is correct way how to call UpdateFileLifeCycleStates in VB.NET - you need to pass arrays fro both masterdIds and stateIds arguments:
Thisfile = docsvcExt.UpdateFileLifeCycleStates(New Long() { ThisFileMasterID }, New Long() { ThisFileLifeCyclestateID }, "TEST RELEASE")

Jan Liska
Technical Consultant
Autodesk, Inc.
Re: "Value of type long can not be converted to 1-dimansio nal array of long
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thank you Jan, I changed my code according to your recommendations tried this new code but now i get a new error. reference to object net set? What is the problem here.
Dim files As File() = DocSrv.GetLatestFilesByFolderId(parentFolder.Id, False)
If (Not files Is Nothing AndAlso files.Length > 0) Then
For Each file As File In files
Dim MyfileName(0) As String
MyfileName(0) = Me.TextBox1.Text '"VAULT002.idw"
If file.Name = MyfileName(0) Then
With file
MsgBox("File found")
Try
'Lifecycle Definitions
'Name : Monsun Basic Release Process = 6
'Lifecycle States
'Work in Progress = LifecyclestateID 24
'For Review = LifecyclestateID 25
'Released = LifecyclestateID 26
'Obsolete = LifecyclestateID 27
'Get FileID
Dim ThisFileID As Long = file.Id
'Get file master ID
Dim ThisFileMasterID() As Long = New Long() {DocSrv.GetFileById(file.Id).MasterId}
'Create array of LyfecycleStates
Dim ThisFileLifeCycleState() As Long = New Long() {24, 25, 26, 27}
Dim MyFileToUpdate As File = DocSrv.GetFileById(file.Id)
'Update file LifeCycle state
With MyFileToUpdate
'MsgBox((ThisFileMasterID(0) & ":" & (ThisFileLifeCycleState(2) & ":" & "TEST RELEASE")))
DocSrvExt.UpdateFileLifeCycleStates(New Long() {ThisFileMasterID(0)}, New Long() {ThisFileLifeCycleState(2)}, "TEST RELEASE")
MsgBox("LifeCycle state Changed")
End With
Catch ex As Exception
'ERROR HERE "Object reference not set to an instance of an object"
MsgBox(ex.Message)
End Try
End With
Exit For
End If
Next file
End If
Re: "Value of type long can not be converted to 1-dimansio nal array of long
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
The error means that you're trying to use object which is not initialized yet. I suggest to check your code under debugger to find out more details.

Jan Liska
Technical Consultant
Autodesk, Inc.
Re: "Value of type long can not be converted to 1-dimansio nal array of long
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks a lot for your help on this, now i got it all working :-) happy me :-) i tried to debug with no luck, but then i and addet the DocumentServiceExtensions to my login code and now everything works. Just saved month of work, before we go life with our vault. Now i can release all AutoCAD drawings in the vault with one click! When you ever come to Denmark i will buy you a Beer :-) below is the missing part of my code in case others have the same problem.
Dim DocSrvExt As DocumentServiceExtensions = New DocumentServiceExtensions()
DocSrvExt.SecurityHeaderValue = New Autodesk.Connectivity.WebServices.DocumentExSvc.Se curityHeader()
DocSrvExt.SecurityHeaderValue.UserId = winAuthSvc.SecurityHeaderValue.UserId
DocSrvExt.SecurityHeaderValue.Ticket = winAuthSvc.SecurityHeaderValue.Ticket
DocSrvExt.Url = "http://" + serverName + "/AutodeskDM/Services/DocumentServiceExtensions.as mx"
Re: "Value of type long can not be converted to 1-dimansio nal array of long
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Glad to hear that you were able to solve the problem. If you're using 2012 release I suggest to look at WebServiceManager class which is available in Autodesk.Connectivity.WebServicesTools. The class simplifies access to individual web service classes.

Jan Liska
Technical Consultant
Autodesk, Inc.

