Hello All,
I am developing a custom .NET based application which needs to interact with the Alfresco system in place. I want to retrieve all the versions of a particular document along with all their metadata and pass them to my custom application.
I have written following code, but its giving me "Bad Request" error. I think I am getting error where there is some mismatch in the RepositoryId and ObjectId that is getting passed. I need your kind help to fix the same.
private IItemEnumerable<ICmisObject> GetChildren(IOperationContext context)
{
string objectId = "1a8fefd8-d99c-4df2-9a44-e66e2cadea2d";
INavigationService service = session.Binding.GetNavigationService();
IObjectFactory of = session.ObjectFactory;
IOperationContext ctxt = new OperationContext(context);
String folderId = session.GetObject("workspace://SpacesStore/0270f45a-b41a-41af-bab8-4951234817b9").Name;
service.GetFolderTree(session.RepositoryInfo.Id,"0270f45a-b41a-41af-bab8-4951234817b9",1000,context.FilterString,context.IncludeAllowableActions,context.IncludeRelationships,context.RenditionFilterString,context.IncludePathSegments
IObjectInFolderList children1 = service.GetChildren(session.RepositoryInfo.Id, objectId, context.FilterString, context.OrderBy, context.IncludeAllowableActions, context.IncludeRelationships, context.RenditionFilterString, context.IncludePathSegments, 10, 0, null);
PageFetcher<ICmisObject>.FetchPage fetchPageDelegate = delegate(long maxNumItems, long skipCount)
{
IObjectInFolderList children = service.GetChildren(session.RepositoryInfo.Id, objectId, context.FilterString, context.OrderBy, context.IncludeAllowableActions, context.IncludeRelationships, context.RenditionFilterString, context.IncludePathSegments, maxNumItems, skipCount, null);
// convert objects
IList<ICmisObject> page = new List<ICmisObject>();
if (children.Objects != null)
{
foreach (IObjectInFolderData objectData in children.Objects)
{
if (objectData.Object != null)
{
page.Add(of.ConvertObject(objectData.Object, ctxt));
}
}
}
return new PageFetcher<ICmisObject>.Page<ICmisObject>(page, children.NumItems, children.HasMoreItems);
};
return new CollectionEnumerable<ICmisObject>(new PageFetcher<ICmisObject>(context.MaxItemsPerPage, fetchPageDelegate));
}