AnsweredAssumed Answered

how to create documents at child levels in c#?

Question asked by divyabharathipalivela on Jun 16, 2014
Latest reply on Jun 16, 2014 by kaynezhang
Hi All,


I have tried to create document at perticular folder level using c# in cmis ?

I have tried with

  foreach (ITree<IFileableCmisObject> t in root.GetDescendants(-1))
                {      
               if(t.Item.Name == txtFileUpload.Text )
                {
                    ISession session1 = factory.GetRepositories(parameters)[0].CreateSession();
                    IOperationContext oc = session1.CreateOperationContext();
                    oc.IncludeAcls = true;
                    string formattedName = Path.GetFileName(fileUpload1.FileName);
                    string Extension = Path.GetExtension(fileUpload1.PostedFile.FileName);
                    IDictionary<string, object> properties1 = new Dictionary<string, object>();
                    properties1.Add(PropertyIds.Name, formattedName);
                    properties1.Add(PropertyIds.ObjectTypeId, "cmis:document");
                    ContentStream contentStream = new ContentStream
                    {
                        FileName = formattedName,
                        MimeType = "application/msword",
                        Length = fileUpload1.FileBytes.Length,
                        Stream = new MemoryStream(fileUpload1.FileBytes)
                    };
                  
                    t.Item.Parents[0].CreateDocument(properties1, contentStream, null);
                    break;
                }
                }
but in place t.item.Parents[0] we need to write something that i am not getting. Please help me to fix this .

Thanks,
Divya Palivela

Outcomes