AnsweredAssumed Answered

How to upload document on user created folder using dotcmis dll

Question asked by shivtechno on Oct 10, 2016
Latest reply on Oct 10, 2016 by kaynezhang

I am trying to upload file on custom created folder by user or shared folder in alfresco but every time while uploading document it goes and upload on root  folder how can i change

folder or i can upload folder by object id of folder using dotcmis folder.

 

      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/api/-default-/public/cmis/versions/1.0/atom";

                    parameters[DotCMIS.SessionParameter.User] = UserName;

                    parameters[DotCMIS.SessionParameter.Password] = Password;

                    parameters[DotCMIS.SessionParameter.RepositoryId] = selectedValue; // Repository id of Custom Created Folder .....

                    SessionFactory factory = SessionFactory.NewInstance();

                    ISession session = factory.GetRepositories(parameters)[0].CreateSession();

 

                     IOperationContext oc = session.CreateOperationContext();

                    oc.IncludeAcls = true;

                    IFolder folder = session.GetRootFolder();

                    // document name

                    string formattedName = file.FileName;

                    // define dictionary

                    IDictionary<string, object> properties = new Dictionary<string, object>();

                    properties.Add(PropertyIds.Name, formattedName);

 

 

                    // define object type as document, as we wanted to create document

                    properties.Add(PropertyIds.ObjectTypeId, "cmis:document");//"cmis:document"

Outcomes