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

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

    Chandra
TeamSite Developer Resources

  • 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.
image
OpenText CE Products
TeamSite
APIs