예제 #1
0
        public String GetContentElement(String id)
        {
            //MessageBox.Show(dataGridView1.SelectedRows[0].Cells[0].Value.ToString());
            //FileNet.Api.Property.PropertyFilter pf = new FileNet.Api.Property.PropertyFilter();
            //pf.AddIncludeProperty(new FileNet.Api.Property.FilterElement(null, null, null, "Cont", null));

            // Get a document from the version series to be checked for downloads.
            IDocument documentObj = Factory.Document.FetchInstance(os, id, null);

            IContentTransfer cTransfer = (IContentTransfer)documentObj.ContentElements[0];

            String name   = cTransfer.RetrievalName;
            Stream stream = cTransfer.AccessContentStream();
            double size   = writeContent(stream, Path.GetTempPath() + "/" + name);

            return(Path.GetTempPath() + "/" + name);
        }
예제 #2
0
        internal string getCachedFile(IDocument oDocument)
        {
            // Get content elements and iterate list.
            IContentElementList docContentList = oDocument.ContentElements;
            String ret = "";

            System.Collections.IEnumerator iter = docContentList.GetEnumerator();
            while (iter.MoveNext())
            {
                IContentTransfer ct   = (IContentTransfer)iter.Current;
                FileStream       fout = new FileStream(Path.GetTempPath() + ct.RetrievalName, FileMode.Create);
                int    docLen         = (int)ct.ContentSize;
                byte[] buf            = new byte[docLen];
                Stream stream         = (Stream)ct.AccessContentStream();

                stream.Read(buf, 0, docLen);
                fout.Write(buf, 0, docLen);
                fout.Flush();
                stream.Close();
                fout.Close();
                ret = Path.GetTempPath() + ct.RetrievalName;
            }
            return(ret);
        }