从HP TRIM的桌面客户端获取记录的URL

|| 是否可以从HP的TRIM复制记录/文档的URL并将其发送给某人以便下载?     
已邀请:
有几种方法可以做这样的事情。假设您正在将链接发送给同一WAN上的某人,或者使TRIM系统可以访问Internet的安全风险选项,那么我要做的就是在TRIM SDK的顶部构建一个简单的Web服务。 TRIM SDK是COM(带有PIA包装器)或适当的.Net程序集(在版本7. *中),因此简单的ASP.Net服务将非常容易。 以下是我根据HP提供的代码示例(基于TRIMSDKPIA20.dll,而不是TRIM 7.0 HP.HPTRIM.SDK程序集)构建的ASP.Net服务的代码。您可以将其用作使其他内容更具RESTful的基础,但实际上,您可以使用如下URL来调用它: http:// server / ViewRecord / recno = D11-001 然后,您可以再次创建一个\“ External Link \”,这是一个基于SDK的加载项,您可以在TRIM界面中将其注册为右键单击选项。类似于\“发送下载URL ... \”会触发电子邮件并生成URL,但这有点复杂。 无论如何,Web服务的代码:
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TRIMSDK;
using System.Configuration;
using Microsoft.Win32;
using System.IO;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string errormsg = string.Empty;

        //Response.Clear();
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Database trim = new Database();
        trim.SetAsWebService();
        trim.Id = ConfigurationSettings.AppSettings[\"dbid\"];
        trim.WorkgroupServerName = ConfigurationSettings.AppSettings[\"wgserver\"];
        trim.WorkgroupServerPort = Int32.Parse(ConfigurationSettings.AppSettings[\"wgport\"]);
        trim.Connect();
        string recno = Request.QueryString[\"recno\"];
        if (String.IsNullOrEmpty(recno))
        {
            errormsg = \"No recno parameter was passed.\";
        }
        else
        {
            Record rec = trim.GetRecord(recno);
            if (rec == null)
            {
                errormsg = string.Format(\"Could not find a record with number \\\"{0}\\\". Either it doesn\'t exist, or you don\'t have permission to view it.\", recno);
            }
            else
            {
                if (!rec.IsElectronic)
                {
                    errormsg = string.Format(\"Record {0} does not have an electronic attachment\", rec.Number);
                }
                else
                {
                    IStream s = rec.GetDocumentStream(null, false, null);

                    Response.ClearHeaders();
                    Response.AddHeader(\"Content-Disposition\", \"filename=\" + rec.SuggestedFileName);
                    Response.AddHeader(\"Content-Length\", rec.DocumentSize.ToString());
                    Response.Buffer = false;
                    Response.ContentType = GetContentType(rec.Extension);

                    uint BufferSize = 10000;
                    uint DocumentLength = (uint)rec.DocumentSize;
                    byte[] buffer = new byte[BufferSize];
                    uint bytesread;
                    uint totalread = 0;

                    Stream outstream = Response.OutputStream;

                    while (totalread < DocumentLength)
                    {
                        s.RemoteRead(out buffer[0], 10000, out bytesread);
                        if (bytesread < 10000)
                        {
                            for (uint i = 0; i < bytesread; i++)
                            {
                                outstream.WriteByte(buffer[i]);
                            }
                        }
                        else
                        {
                            outstream.Write(buffer, 0, 10000);
                        }
                        totalread += bytesread;
                    }
                    outstream.Close();
                    Response.Flush();
                    return;
                }
            }
        }
        Response.Write(errormsg);
    }

    private string GetContentType(string fileExtension)
    {
        string ct = Registry.GetValue(@\"HKEY_CLASSES_ROOT\\.\" + fileExtension.ToLower(), \"Content Type\", string.Empty) as string;

        if (ct.Length == 0)
        {
            ct = \"application/octet-stream\";
        }

        return ct;
    }
}
    
在TRIM 7之前,是否可以本地执行此操作取决于安装了哪些TRIM功能。 要查看您是否有合适的东西,请在桌面上制作一个TR5文件,然后右键单击它-\“ TryURL \”-复制URL (TryURL右键单击操作需要TRIM客户端内容-如果您没有该内容,请尝试在记事本中打开TR5文件,并查看其中是否有超链接)。 您确实可以通过用于TRIM的SharePoint连接器(TIPS或TSCI)获得此功能。 还是有一种便宜的第三方产品看上去很酷-来自Icognition PtyLtd。     

要回复问题请先登录注册