AnsweredAssumed Answered

How to download individual files in alfresco cmis using c#?

Question asked by divyabharathipalivela on Jun 17, 2014
Latest reply on Mar 29, 2016 by rodrigogalodoido
Hello Team,

I have two questions here . Please help me to sort out those problems :

1) I have uploaded files into alfresco cmis using c# . After uploading I am displaying it in a table format or tree view format. But I am unable to view those files in a folder structure. How to display like :
       + Folder Name
       + Folder Name1
       + Folder Name2
=============================
       Folder Name
           – File1
           – File2
Like that I want to display.

and coming to my second requirement

If I click on File1 It needs to be one dialog like whether you want to open file or save file ?

If I select save it needs to save it in local.

I tried like :
<asp:TreeView ID="TreeView1" runat="server"></asp:TreeView>

Code Behind :

foreach (ICmisObject item in childrens)
            {
                TreeNode node = new TreeNode(item.Name);
                TreeView1.Nodes.Add(node);
                ConnectingUsingAtomPub_FolderNavigation(item.Name);
            }
   private void ConnectingUsingAtomPub_FolderNavigation(string p)
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters[DotCMIS.SessionParameter.BindingType] = BindingType.AtomPub;
            parameters[DotCMIS.SessionParameter.AtomPubUrl] = "http://127.0.0.1:8080/alfresco/cmisatom";
            parameters[DotCMIS.SessionParameter.User] = "admin";
            parameters[DotCMIS.SessionParameter.Password] = "root";
            SessionFactory factory = SessionFactory.NewInstance();
            ISession session = factory.GetRepositories(parameters)[0].CreateSession();
            IFolder root = session.GetRootFolder();
            Response.Write("<table width=100>");
            Response.Write("<tr><td>Name</td><td>LastModifiedby</td></tr>");

            foreach (ITree<IFileableCmisObject> t in root.GetDescendants(-1))
            {

                if (t.Item.Name == p.ToString())
                {

                    PrintTree(t);
                }
            }
        }

        private void PrintTree(ITree<IFileableCmisObject> tree)
        {
           // Response.Write("<tr><td> " + tree.Item.Name + "</td><td>" + tree.Item.LastModifiedBy + "</tr>");
            TreeView1.Nodes.Add(new TreeNode(tree.Item.Name));
            if (tree.Children != null)
            {
                foreach (ITree<IFileableCmisObject> treeItem in tree.Children)
                {
                    PrintTree(treeItem);
                }
            }
}
 

Please do help.

Waiting for response :)

Thanks,
Divya Palivela

Outcomes