07-30-2014 04:16 AM
07-30-2014 05:44 AM
07-30-2014 06:04 AM
07-30-2014 09:23 AM
private static void TestUploadDocument()
{
try
{
ISession session = GetSession();
IFolder folder1 = (IFolder)session.GetObjectByPath("/TESTFOLDER1");
Dictionary<string, object> properties = new Dictionary<string, object>();
properties[PropertyIds.ObjectTypeId]= "cmis:document";
properties[PropertyIds.Name] = "test20140730";
properties[PropertyIds.CreatedBy]= "admin";
VersioningState vs = VersioningState.Major;
ContentStream contentStream = new ContentStream();
FileStream fs = new FileStream("D:\\test.pdf", FileMode.Open, FileAccess.Read);
contentStream.Stream=fs;
contentStream.FileName = "test upload";
contentStream.MimeType = "pdf";
Console.WriteLine(folder1.Name);
folder1.CreateDocument(properties, contentStream, vs);
fs.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
private static ISession GetSession()
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters[DotCMIS.SessionParameter.BindingType] = BindingType.AtomPub;
//parameters[DotCMIS.SessionParameter.AtomPubUrl] = "http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom"; //for 1.1
parameters[DotCMIS.SessionParameter.AtomPubUrl] = "http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.0/atom";
parameters[DotCMIS.SessionParameter.User] = "admin";
parameters[DotCMIS.SessionParameter.Password] = "admin";
SessionFactory factory = SessionFactory.NewInstance();
IList<IRepository> repos = factory.GetRepositories(parameters);
ISession session = repos.ElementAt(0).CreateSession();
return session;
}
08-01-2014 02:18 AM
03-20-2015 07:50 AM
08-01-2014 11:18 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.