Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Fetching a document

Code Block
stringIObjectId id = session.CreateObjectId("12345678");
IDocument doc = session.GetObject(id) as IDocument;

// properties
Console.WriteLine(doc.Name);
Console.WriteLine(doc.GetPropertyValue("my:property"));

IProperty myProperty = doc["my:property"];
Console.WriteLine("Id:    " + myProperty.Id);
Console.WriteLine("Value: " + myProperty.Value);
Console.WriteLine("Type:  " + myProperty.PropertyType);

// content
IContentStream contentStream = doc.GetContentStream();
Console.WriteLine("Filename:   " + contentStream.FileName);
Console.WriteLine("MIME type:  " + contentStream.MimeType);
Console.WriteLine("Has stream: " + (contentStream.Stream != null));

...

Deleting an object

Code Block
stringIObjectId newId = session.CreateObjectId("12345678"):
ICmisObject cmisObject = session.GetObject(newId);

cmisObject.Delete(true);

...

Code Block
IItemEnumerable<IQueryResult> qr = session.Query("SELECT * FROM cmis:document", false);

foreach (IQueryResult hit in qr)
{
    Console.WriteLine(hit["cmis:name"].FirstValue + " (" + hit["cmis:objectId"].FirstValue + ")");
}