Vault Customization

Vault Customization

Reply
Contributor
stefan.palm
Posts: 17
Registered: ‎12-31-2006
Message 1 of 5 (296 Views)
Accepted Solution

Edit and update ITEM attachements - ITEM lock remains

296 Views, 4 Replies
01-11-2012 06:37 AM

Hi all,

 

i have an issue with ITEM's that remains locked after edit (add attachements). Anyone have a clue on why this happens?

 

All code for updateing the ITEM runs just fine and attachements are added etc. And i run UndoEditItems with the help files says will make sure no locks remains, still the lock do remain.

 

 

Try

'all code for update item, no errors raised and result is as aspected

.......

Catch ex As Exception

 WebServiceManager.ItemService.UndoEditItems(New Long() {it.Id})

End Try

 

 

 

 

 

Any tip is appreciated

Thanks

 

 



 

For lifecycle state changes, you need to first call EditItemLifeCycleStates.  The documentation for that function has sample code.

 

You say you are not getting any errors, so how do you know that things are in a bad state?

Employee
Redmond.D
Posts: 812
Registered: ‎12-12-2006
Message 2 of 5 (290 Views)

Re: Edit and update ITEM attachements - ITEM lock remains

01-11-2012 09:37 AM in reply to: stefan.palm

When you call EditItem you get a new Item object returned.  When calling UndoEditItems, make sure to pass in the Id value from that new Item object.

 

If that's not your problem, you'll have to post more of your code.  And post the Exception details too.



Doug Redmond
Software Engineer
Autodesk, Inc.
http://justonesandzeros.typepad.com/

Contributor
stefan.palm
Posts: 17
Registered: ‎12-31-2006
Message 3 of 5 (283 Views)

Re: Edit and update ITEM attachements - ITEM lock remains

01-11-2012 11:31 PM in reply to: Redmond.D

the thing is there is no error raised. Code runs fine and result is ok but ITEM remains locked.

 

Code that edits the item.

 

.....


'Change ITEM to Work In Progress
it = WebServiceManager.ItemService.UpdateLifeCycleStatesSkipRevisionBump(New Long() {it.Id}, GetItemLifeCycleStateDefinitionByName("Work In Progress").Id, False, Nothing, Nothing, Nothing, Nothing).First

 

'Edit ITEM
it = WebServiceManager.ItemService.EditItem(it.RevId)

 

'Update and commit ITEM attachements
it = WebServiceManager.ItemService.UpdateAndCommitItem(it, 0, Nothing, Nothing, Nothing, Nothing, attachments.ToArray(GetType(Autodesk.Connectivity.WebServices.Attmt)), Nothing, 2)

 

'Change item back to released
it = WebServiceManager.ItemService.UpdateLifeCycleStatesSkipRevisionBump(New Long() {it.Id}, GetItemLifeCycleStateDefinitionByName("Released").Id, False, Nothing, Nothing, Nothing, Nothing).First

Employee
Redmond.D
Posts: 812
Registered: ‎12-12-2006
Message 4 of 5 (280 Views)

Re: Edit and update ITEM attachements - ITEM lock remains

01-12-2012 06:57 AM in reply to: stefan.palm

For lifecycle state changes, you need to first call EditItemLifeCycleStates.  The documentation for that function has sample code.

 

You say you are not getting any errors, so how do you know that things are in a bad state?



Doug Redmond
Software Engineer
Autodesk, Inc.
http://justonesandzeros.typepad.com/

Contributor
stefan.palm
Posts: 17
Registered: ‎12-31-2006
Message 5 of 5 (275 Views)

Re: Edit and update ITEM attachements - ITEM lock remains

01-12-2012 07:08 AM in reply to: Redmond.D

Ok, i'll take a look at that, missed it.

 

i know that things are in a bad state when i try to acces the item manually after my code ran on it. Then i get an dialog (in vault explorer) that says i can not access it because it is locked to the user i used for running the code.

 


Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.