【发布时间】:2013-08-30 19:47:39
【问题描述】:
我见过this example 在 Java 中构建附件并将其发送到 Salesforce,但这是如何在 C# 中完成的?
编辑 - 我也使用 this page 作为参考,但我仍然不知道如何完成我尝试创建和保存附件的最后一部分。
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];
【问题讨论】:
标签: c# salesforce soap-client