Getting file info using OpenAPI
Options
Does anyone know if using the OpenAPI we can have access to the information of one file?, I mean, if we can access the information about the user that created de file, the date that was created o modified.
Thanks in advance
Ricardo
Thanks in advance
Ricardo
0
Comments
-
There are methods defined for these in OPENAPI.
OPENAPI JavaDoc will also help to find which method gets the file creation date and modified date.
IWFile file=(IWFile)fileObject;
// Get the File data which contains the metadata information
IWFile.Data fileData = file.getFileData(fileSysService);
// Getting the size of the File
size=Long.toString(((IWSimpleFile.Data)fileData).numContentBytes);
title =fileData.name;
creationTime=fileData.creationTime.toString();
String creatorName=fileData.creator.getName(accessService);
//Get the creator name only ..... remove the group name and '\'
creator=creatorName.substring(creatorName.lastIndexOf('\\')+1);
String ownerName=fileData.owner.getName(accessService);
owner=ownerName.substring(ownerName.lastIndexOf('\\')+1);
contModTime=fileData.lastContentModTime.toString();
parentPath=fileData.parent.getPath(fileSysService);
path=fileData.path;
IWAccessor lastMod=fileData.lastModifier;
// check file contents are modified
if (lastMod!=null){
String lastUserName= lastMod.getName(accessService);
lastUser=lastUserName.substring(lastUserName.lastIndexOf('\\')+1);
}
IWFile.ExtraData extraData=fileData.getFileExtraData();
IWArea area=extraData.area;
IWArea.Data areaData=area.getAreaData(fileSysService);
String lastName=IWPath.extractLastName(IWPath.smInputCaseSensitive,path);
IWFileVersion currentVersion=extraData.currentFileVersion;
if(currentVersion!=null){
// Getting the Revision String of the File as Version
String revString=currentVersion.getRevisionString(fileSysService);
version=revString.substring(revString.lastIndexOf('/')+1);
// Getting the Description (comments entered by user)
Collection history=(Collection)currentVersion.getHistoryTable(fileSysService, path, 1);
Iterator iter =(Iterator) history.iterator();
while (iter.hasNext()){
IWFileVersion.FileHistoryResultInfo hisdata = (IWFileVersion.FileHistoryResultInfo)iter.next();
description=description+ hisdata.checkinComment;
Hope this helps
Chandra0
Categories
- All Categories
- 111 Developer Announcements
- 49 Articles
- 103 General Questions
- 123 IM Services
- 40 OpenText Hackathon
- 31 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 897 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 123 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 1 XM Fax
TeamSite Developer Resources
If you are interested in gaining full access to the content, you can register for a My Support account here.
- Docker Automation
- LiveSite Content Services (LSCS) REST API
- Single Page Application (SPA) Modules
- TeamSite Add-ons
If you are interested in gaining full access to the content, you can register for a My Support account here.