I have an alfresco database with a directory of folders and files. I want to be able to move from one specific file to a different folder in the click of a button, so I used winForms for my process You need to be Using the PortCMIS library in order to test these operations in C# code, there's also a version called "OpenCMIS" you can use if you are using Java.
'''
private void btnMove_Click(object sender, EventArgs e)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
//Creates instance where I can access
//my private Alfresco sandbox database.
parameters[SessionParameter.BindingType] = BindingType.AtomPub;
parameters[SessionParameter.AtomPubUrl] = txtLink.Text;
parameters[SessionParameter.User] = txtUser.Text;
parameters[SessionParameter.Password] = txtPass.Text;
SessionFactory factory = SessionFactory.NewInstance();
session = factory.GetRepositories(parameters)[0].CreateSession();
//Error here, can't convert the string to
//"PortCMIS.Client.IFolder or IDocument".
IFolder sourcefolder = @"Rootfolder/folderWithFile";
IFolder targetFolder = @"Rootfolder/folderToPutFileIn";
IDocument doc = "fileTest.txt";
//Supposed to move the document from source folder to
//the target folder.
doc.Move(sourceFolder, targetFolder);
}
'''
Example Picture of the Folder directory
I also tried using "IFolder sourcefolder = session.GetRootFolder(@"Rootfolder/folderWithFile");" but it still doesn't work, I'm unsure on what to do
My problem here is the variables I am calling "IFolder" and "IDocument". What should I do for it to do what I want? Do I need to find a way to convert the string directory into what i wants it to be? Is there a specific function that I should be using to help move these files?
Also, not to give excuses but I'm pretty new at using CMIS and Alfresco, and programming in general (I have almost 1 year of experience in coding at this point in time). Which comes to say, if there is anything I said that might have been wrong, or something I'm doing that makes no sense, please do point it out so I can learn and get better as a result. And if you have any questions that you need answered in order to give a proper answer to my problem (necessary details and information) please do tell me about it.
Thank you !