changing the title of an item

changing the title of an item

tdQ893E
Explorer Explorer
486 Views
2 Replies
Message 1 of 3

changing the title of an item

tdQ893E
Explorer
Explorer

i need to change the title of existing items using the api. when i try the ItemService.UpdateAndCommitItems command my title stays the same?

setting the item.Title also does nothing

0 Likes
Accepted solutions (1)
487 Views
2 Replies
Replies (2)
Message 2 of 3

Nick_Hall
Collaborator
Collaborator
Accepted solution

Hi

 

This is some code I use to update Item Title & Description - it's in PowerShell, but it's very similar to C# so it should make sense

 

 

$vItem = $vault.ItemService.GetItemsByIds(@( $resultitem.Id ))[0]
$itemRevIds = @($vItem.RevId)
try {
  [Autodesk.Connectivity.WebServices.Item]$vaultItem = $vault.ItemService.EditItems($itemRevIds)[0]
  $vaultItem.Detail = $catalogDescription
  $vaultItem.Title = $catalogTitle
  $vault.ItemService.UpdateAndCommitItems(@($vaultItem))
  Write-Output 'Item Description/Title Update: Success'
} 
catch {
  $vault.ItemService.UndoEditItems(@($vaultItem))
  Write-Output 'Item Description/Title Update: FAILED'
)

 

 

Hope that helps

Nick

Message 3 of 3

tdQ893E
Explorer
Explorer
Great this solved my problem, didn't know i had to call edit items into a new item

Thanks
0 Likes