How do I get the ArrayList for any existing Item attachments. I want to add an attachment via the API and keep whatever attatchments already there intact. I can't find the documentation....
Solved! Go to Solution.
I think GetAttachmentsByItemId is the function you are looking for.
I'm struggling trying to figure this out. How do I properly Dim the GetAttachmentsByItemId line? I want to add the attachments strings to "fileArray" in the end.
Dim item As Item = Nothing Dim itemNo As String = ItemArray(i)(0) Dim itemRev As Item = _ ServiceManager.ItemService.GetLatestItemByItemNumb
item = ServiceManager.ItemService.EditItem(itemRev.RevId) Dim fileArray As System.Collections.ArrayList = New ArrayList fileArray.Add(ItemArray(i)(1)) Dim existingfileArray As ArrayList = _ ServiceManager.ItemService.GetAttachmentsByItemId(
I almost never use ArrayList objects any more. The List generic class is much better because you have a strongly typed collection. With ArrayList, everything is stored as Object. List allows you to have a collection of only File objects, for example.
I would do something like this.
Dim attachments As Attmt() = ServiceManager.ItemService.GetAttachmentsByItemId(
Dim attachmentList As New List(Of Attmt)()
Now you can add items to your attachmentList object. When it is time to call UpdateItem you can call attachmentList.ToArray() to convert the List to an Attmt() type.
That was the ticket! Thanks Doug!