【发布时间】:2011-12-09 10:47:14
【问题描述】:
使用 COM 数据控件从 Siebel 获取附件。
SiebelBusObjectInterfaces.SiebelDataControl sblDataControl = new SiebelBusObjectInterfaces.SiebelDataControl();
bool success = sblDataControl.Login("host=\"siebel.TCPIP.None.None://bla bla bla /EAIObjMgr_enu\"", "karephul", getPassword());
string errorCode = sblDataControl.GetLastErrCode() + " " + sblDataControl.GetLastErrText();
SiebelBusObjectInterfaces.SiebelBusObject oBO;
SiebelBusObjectInterfaces.SiebelBusComp serviceRequest;
SiebelBusObjectInterfaces.SiebelBusComp actionAttachment;
oBO = sblDataControl.GetBusObject("Action");
actionAttachment = oBO.GetBusComp("Action Attachment");
success = actionAttachment.ActivateField("Activity Id");
success = actionAttachment.ActivateField("ActivityFileName");
success = actionAttachment.ClearToQuery();
success = actionAttachment.SetSearchSpec("Activity Id", "3-QOUKDD"); // hard code for now.
success = actionAttachment.SetSearchSpec("ActivityFileExt", "txt");
success = actionAttachment.ExecuteQuery(1); // ForwardOnly = 1, I guess;
if (actionAttachment.FirstRecord())
{
string fileName = actionAttachment.GetFieldValue("ActivityFileName");
string fileLoc = actionAttachment.InvokeMethod("GetFile", "ActivityFileName");
}
下面这段代码获取适当的文件并将其保存在服务器的临时文件夹中,并为我提供完全限定的路径。
string fileLoc = actionAttachment.InvokeMethod("GetFile", "ActivityFileName");
有没有办法可以将文件获取到我的本地机器?
上下文:
这段代码是用 C# 编写的,我们在客户端运行这段代码,它无法访问服务器的临时目录。
谢谢 卡勒菲尔
【问题讨论】:
-
请注意,在 SO 上您不需要使用
<pre><code>块。只需将代码缩进四个空格。