SAP Business One浏览器扩展组件-新 SDK 功能
SAP Business One浏览器扩展组件-代码样本
if (SBO_Application.ClientType == BoClientType.ct_Browser)
{
string path = null;
try
{
path = SBO_Application.GetFileFromBrowser();
using (FileStream fs = File.Open(path, FileMode.Open))
{
//read the file
}
}
catch (Exception ex)
{
//exception handling
}
try
{
bool isSucceed = SBO_Application.SendFileToBrowser(path);
}
catch (Exception ex)
{
//exception handling
}
}
else if(SBO_Application.ClientType == BoClientType.ct_Desktop)
{
System.IO.Stream readStream = null;
OpenFileDialog openFileDialog1 = new OpenFileDialog();
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
if ((readStream = openFileDialog1.OpenFile()) != null)
{
using (readStream)
{
//read the file
}
}
}
catch (Exception ex)
{
//exception handling
}
}
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
System.IO.Stream writeStream = null;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
if ((writeStream = saveFileDialog1.OpenFile()) != null)
{
using (writeStream)
{
//write the file
}
}
}
catch (Exception ex)
{
//exception handling
}
}
}
上传和下载文件