Exemple #1
0
        //
        // Creates the ContentElementList from ContentTransfer object.
        //
        public IContentElementList CreateContentElementList(String fileName)
        {
            IContentElementList cel = null;

            if (CreateContentTransfer(fileName) != null)
            {
                cel = Factory.ContentElement.CreateList();
                IContentTransfer ct = CreateContentTransfer(fileName);
                cel.Add(ct);
            }
            return(cel);
        }
Exemple #2
0
        //
        // Creates the ContentTransfer object from supplied file's
        // content.
        //
        public IContentTransfer CreateContentTransfer(String fileName)
        {
            IContentTransfer ct = null;
            FileInfo         fi = new FileInfo(fileName);

            if (ReadContentFromFile(fileName) != null)
            {
                ct = Factory.ContentTransfer.CreateInstance();
                Stream s = new MemoryStream(ReadContentFromFile(fileName));
                ct.SetCaptureSource(s);
                ct.RetrievalName = fi.Name;
            }
            return(ct);
        }
Exemple #3
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);
        }
Exemple #4
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);
        }