Quantcast
Channel: PTC Community: Message List - Windchill
Viewing all articles
Browse latest Browse all 8876

Re: How to get physical file size from an EPMDocument using Java code?

$
0
0

Hello Patrick!

 

Thanks for the suggestion!

 

I tried the code you provided but sadly ContentHelper.getPrimary(doc); returns null.

So I played about with the API a little further and finally I got it to work using below code:

 

            ObjectReference or = ObjectReference.newObjectReference(doc);

            ContentItem contentItem = ContentHelper.service.getPrimaryContent(or);

            if (contentItem instanceof ApplicationData) {   // as opposed to ExternalData or URLData

                sizeInKb = ((ApplicationData) contentItem).getFileSizeKB();

            }

 

Cheers!

/Peter


Viewing all articles
Browse latest Browse all 8876

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>