I'm trying to upload photo via OData.
I've started with this code: https://community.creatio.com/questions/how-upload-attachments-odata
and this is where I'm stuck: picture is uploaded but nothing changes (product photo is still empty), as if nothing is saved...
This is the code that I'm using:
using (var fs = new FileStream("c:/temp/otter_tiny.jpg", FileMode.Open))
{
DataServiceRequestArgs args = new DataServiceRequestArgs();
//Define content type
args.ContentType = "application/octet-stream";
var productImage = new BPMSync.BpmService.SysImage();
productImage.Id = Guid.NewGuid();
productImage.Name = "produtImage.jpeg";
productImage.MimeType = "image/jpeg";
service.AddToSysImageCollection(productImage);
existingProduct.PictureId = productImage.Id;
//Save changes
DataServiceResponse responces = service.SaveChanges();
//Write file stream to activity file
service.SetSaveStream(productImage, "Data", fs, true, args);
//Save changes
service.SaveChanges();
}