to fetch internal filepath

Hi All,

I have a requirement to read the internal filepath (path of file present inside folder of Appian) in plugin. Iam trying to import my application zip file and have extracted for a purpose. I would like to access those xml files present in Appian folder. Could some one help on this.

 

Thanks in advance

  Discussion posts and replies are publicly visible

Parents
  • Hello,

    Something like the following should help. Given an Appian document ID, it will return the filepath. I am not sure if there is a way to retrieve the .zip files that have been imported as patches to the Appian environment, but this method will allow you to access Appian documents if you know their IDs.

    import com.appiancorp.suiteapi.content.ContentConstants; 
    import com.appiancorp.suiteapi.content.ContentService; 
    
    public class AppianDocumentUtil { 
        private ContentService contentService; 
        
        //The Smart Service / Function class creating an instance of this class should receive a ContentService object in its constructor 
        public AppianDocumentUtil(ContentService cs) { 
            contentService = cs; 
        } 
        
        //Replace with specific Exception handling
        public String getFilepathToCurrentVersionOfDocument(Long document) throws Exception { 
            Long currentVersionId = contentService.getVersionId(document, ContentConstants.VERSION_CURRENT); 
            return contentService.getInternalFilename(currentVersionId); 
        } 
    }

Reply
  • Hello,

    Something like the following should help. Given an Appian document ID, it will return the filepath. I am not sure if there is a way to retrieve the .zip files that have been imported as patches to the Appian environment, but this method will allow you to access Appian documents if you know their IDs.

    import com.appiancorp.suiteapi.content.ContentConstants; 
    import com.appiancorp.suiteapi.content.ContentService; 
    
    public class AppianDocumentUtil { 
        private ContentService contentService; 
        
        //The Smart Service / Function class creating an instance of this class should receive a ContentService object in its constructor 
        public AppianDocumentUtil(ContentService cs) { 
            contentService = cs; 
        } 
        
        //Replace with specific Exception handling
        public String getFilepathToCurrentVersionOfDocument(Long document) throws Exception { 
            Long currentVersionId = contentService.getVersionId(document, ContentConstants.VERSION_CURRENT); 
            return contentService.getInternalFilename(currentVersionId); 
        } 
    }

Children