我已经看过这个示例,它用 Java 构建并发送附件到 Salesforce,但是这在 C# 中是如何完成的呢?
编辑 - 我也将此页面用作参考,但我仍然不知道如何完成我尝试创建和保存附件的最后一部分。
SoapClient client = new SoapClient();
LoginResult lr = client.login(new LoginScopeHeader(), username, password);
FileInfo fileInfo = new FileInfo(myFileLocation);
FileStream stream = File.OpenRead(myFileLocation);
byte[] byteArray = new byte[fileInfo.Length];
stream.Read(byteArray, 0, byteArray.Length);
Attachment attachment = new Attachment();
attachment.Body = byteArray;
attachment.Name = myFileName + ".txt";
attachment.IsPrivate = false;
SaveResult saveResult = client.create(new sObject[] { attachment })[0];