I'm using the external API to interact with odoo from a C# program. I'm using the following library to make it easier to send XMLRPC request to odoo: https://github.com/sauljabin/xmlrpcwsc-dotnet
Until now I've succesfully connected to the odoo instance, searched for specific records and created new records. My only problem is that I can't manage to translate the special command for many2many and one2many field in C#.
The following code is working succesfuly except for the field "attachment_ids"
XmlRpcRequest requestCreateMessage = new XmlRpcRequest("execute_kw");
requestCreateMessage.AddParams(db, responseLogin.GetInt(), pass, "mail.message", "create",
XmlRpcParameter.AsArray(
XmlRpcParameter.AsStruct(
XmlRpcParameter.AsMember("body", mailItem.HTMLBody)
, XmlRpcParameter.AsMember("model", "res.partner")
, XmlRpcParameter.AsMember("res_id", responseSearch.GetArray()[0])
, XmlRpcParameter.AsMember("message_type", "comment")
, XmlRpcParameter.AsMember("subtype_id", "2")
, XmlRpcParameter.AsMember("email_from", mailItem.Sender.GetExchangeUser().PrimarySmtpAddress)
,XmlRpcParameter.AsMember("attachment_ids", XmlRpcParameter.AsArray("4", XmlRpcParameter.AsArray("1953", "1954"), 0))
)
)
);
XmlRpcResponse responseCreateMessage = client.Execute(requestCreateMessage);
the AsArray method simply return a list of the arguments. I've seen on another thread someone mentioning that formatting like
("attachment_ids", XmlRpcParameter.AsArray(XmlRpcParameter.AsArray("4", XmlRpcParameter.AsArray("1953", "1954"))))
worked for him with a different language but it didn't work for me. Also worth mentioning that the IDs that I use as imput exist in the database for the attachment model