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....
Thanks!
Solved! Go to Solution.
Solved by Redmond.D. Go to Solution.
I think GetAttachmentsByItemId is the function you are looking for.
Thanks Doug.
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.GetLatestItemByItemNumber(itemNo)
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(itemRev.Id)
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(itemRev.Id)
Dim attachmentList As New List(Of Attmt)()
attachmentList.AddRange(attachments)
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.
Can't find what you're looking for? Ask the community or share your knowledge.