I did something similar, but in Python and against the test steps, so even if I don’t have code that you can copy and paste it, this may indicate the right direction.
Instead of calling:
attachmentFactory.AddItem( filename )
Calling a function without parameters (or a null parameter, I can not say since I have never used the OTA API with C #):
file = attachmentFactory.AddItem()
Now assign the file to the binding element and the rest of its properties:
file.Filename = "C:\\Users\\myUser\\just\\an\\example\\path" + fileName file.Description = "File description" file.Type=1 file.Post()
The type indicates the local file, not the URL.
source share