10-14-2016 04:26 AM
Hi
i am trying to dot this asked question by using below code .
#region --Authendication Masters..
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;
SessionFactory factory = SessionFactory.NewInstance();
ISession session = factory.GetRepositories(parameters)[0].CreateSession();
#endregion
if (file == null)
{
ViewBag.Message = "Please upload document.";
}
else if (file.ContentLength > 20728650)
{
ViewBag.Message = "File size exceeds maximum limit 20 MB.";
}
else
{
Document doc = ((Document)session.GetObject("workspace://SpacesStore/" + objectId));
// define dictionary for document
IDictionary<string, object> properties = new Dictionary<string, object>();
properties.Add(PropertyIds.Name, file.FileName);
properties.Add(PropertyIds.ObjectTypeId, "cmis:document");
//properties.Add(PropertyIds.ObjectId, objectId);
properties.Add(PropertyIds.CheckinComment, CheckInComment);
//folder Path storing Version Document..
IFolder folder = (IFolder)session.GetObjectByPath("/VersionControlDir");
byte[] data = new byte[file.ContentLength];
file.InputStream.Read(data, 0, data.Length);
ContentStream contentStream = new ContentStream
{
FileName = file.FileName,
MimeType = file.ContentType,
Length = file.ContentLength,
Stream = new MemoryStream(data)
};
folder.CreateDocument(properties, contentStream, DotCMIS.Enums.VersioningState.CheckedOut);
IObjectId ob = doc.CheckIn(true, properties, null, CheckInComment);
}
}
10-14-2016 04:55 AM
You can use GetAllVersions(IOperationContext context); mehtod of IDocument class to get a list of all versions .
Use VersioningState.Major/minor parameter of IFolder.CreateDocument/ISession.CreateDocument to controll major/minor version creation
10-14-2016 04:55 AM
You can use GetAllVersions(IOperationContext context); mehtod of IDocument class to get a list of all versions .
Use VersioningState.Major/minor parameter of IFolder.CreateDocument/ISession.CreateDocument to controll major/minor version creation
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.