Document Metadata

from Spotfire.Dxp.Application import DocumentMetadata
print Application.DocumentMetadata.LoadedFromLibraryPath

Here are more properties from DocumentMetadata
NameDescription
Public propertyFileNameUsedBySave
Gets the current file name used by save operations initiated by the user.
Public propertyIsDirty
Returns true if the document has been changed since it was last saved.
Public propertyLibraryItemUsedBySave
Gets the library item that the analysis was last saved to in the library; otherwise null.
Public propertyLoadedFromFileName
Gets the file name that the analysis was opened from; otherwise null.
Public propertyLoadedFromLibraryItem
Gets the library item that the analysis was opened from; otherwise null.
Public propertyLoadedFromLibraryPath
Gets the library path that the analysis was opened from; otherwise null.


If the analysis is located in the library, then use the LibraryItemUsedBySave

from Spotfire.Dxp.Application import DocumentMetadata
libraryItem = Application.DocumentMetadata.LibraryItemUsedBySave

print "size:\t\t", libraryItem.ContentSize
print "date created:\t", libraryItem.Created
print "description:\t", libraryItem.Description
print "guid:\t\t", libraryItem.Id
print "last modified:\t",libraryItem.LastModified
print "location:\t\t",libraryItem.Path
print "Title\t\t",libraryItem.Title

result:


size: 685362
date created: 9/11/2016 10:19:43 AM
description:  Document Metadata Test
guid: 6f072612-7c3c-4653-a2e9-f76ce6f45dc3
last modified: 9/12/2016 10:19:43 AM
location: /Analysis/lab/documentMetaData
Title documentMetaData


Check these other posts for more on this topic

2 comments:

Bob O'Connor said...

How about the date a document was created, can Spotfire read that when importing the file? I'd like to display that date in Spotfire, if possible.

Jose Leviaguirre said...

Hello Bob,

If the analysis was saved to the library:

from Spotfire.Dxp.Application import DocumentMetadata
print Application.DocumentMetadata.LibraryItemUsedBySave.Created

Check out the LibraryItem Members