Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to change the Category on a Item?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
mario.lung
1233 Views, 2 Replies

How to change the Category on a Item?

Hey,

 

any one can help me please

how i can change the Category of a item

 

i finde only the file change with

  • UpdateFileCategories

and change category from a folder

  • UpdateFolderCategories

 

so how i do it for a Item

thx for help or sugesstions

 

Mario

Vault Pro 2015

VB or c# pls

2 REPLIES 2
Message 2 of 3
wayne.brill
in reply to: mario.lung

Hi Mario,

 

I used Fiddler and I see UpdateAndCommitItem() being called when I change the category of an item using Vault Explorer.

http://justonesandzeros.typepad.com/blog/2012/03/fiddling-with-the-vault-api.html

 

I tested using UpdateAndCommitItem() to change the ItemTypId property of the item in this SDK example:

C:\Program Files (x86)\Autodesk\Autodesk Vault 2014 SDK\VS10\VB\ItemEditor

 

 

I added a button to the MainForm and added the following code. It is changing the category of the selected item in my tests.

 

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

 

Dim myItem As Item = Nothing

 

Try

 

' Using this to get the category to change the Item to

 

' On the form select the dropdown for the Type (category).

 

' Not using the Title so just leave it blank and hit ok

 

Dim form As New CreateItemForm(m_connection)

form.ShowDialog()

 

If form.DialogResult <> DialogResult.OK Then

 

Return

 

End If

 

' Get the latest item

 

Dim itemRev As Item = m_connection.WebServiceManager.ItemService.GetLatestItemByItemNumber(m_selectedItem.ItemNum)

 

'Edit the item

myItem = m_connection.WebServiceManager.ItemService.EditItem(itemRev.RevId)

 

'Change the category of the item

myItem.ItemTypId = form.Category.Id

 

 

'commit

m_connection.WebServiceManager.ItemService.UpdateAndCommitItem(myItem, _

0,

False, Nothing, Nothing, _

Nothing, Nothing, Nothing, _

Nothing, 2)

 

Catch ex As Exception

 

If Not myItem Is Nothing Then

m_connection.WebServiceManager.ItemService.UndoEditItems(

New Long() {myItem.Id})

 

End If

 

MessageBox.Show("Error occurred " + ex.ToString())

 

End Try

 

End Sub

 

 

 

Please let me know if this does not provide a solution.

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Message 3 of 3
mario.lung
in reply to: wayne.brill

Hey,

 

Thanks for the Help!

 

it Works

 

Mario

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report