[Explorer API] Get Document State Description

After loading project info into the global static buffer, this code tells me a document's state...

int stateId = aaApi_GetDocumentNumericProperty(DocumentProperty.StateID, docIndex);

Is there a table somewhere that I should interrogate to get state properties such as Name and Description?

  • I found method GetStatesById() in MostOfDavesClasses.cs (I'm writing in C#).  It provides a useful example of how to get state information, which will be useful to C++ programmers as well.

     
    Regards, Jon Summers
    LA Solutions

    Answer Verified By: Jon Summers 

  • , I answered something similar to this in another post.  Here's how you would do it in C++:

    You first select the state's properties into a buffer, and then examine the buffer.

    Try something like this:

    // with appropriate error handling, etc...

    retCode = aaApi_SelectState(stateId);

    // check retCode - see documentation

    // get the property

    thePropertyString = aaApi_GetStateStringProperty(STATE_PROP_DESC, 0);

    As for how to do it in C#?  If you search the source code (MostOfDavesClasses.cs), you will find that both aaApi_SelectState() and aaApi_GetStateStringProperty() are exposed via the "PWWrapper" class.

    Take a closer look at MostOfDavesClasses.cs via a Class view, and you will see some methods that may be of use to you such as PWWrapper.GetStatesByName() and PWWrapper.GetStatesById().

    And to save everyone time who hasn't already downloaded MostOfDavesClass, you can find it here:

    https://github.com/DaveBrumbaugh/MostOfDavesClasses-CSharp-Wrappers-For-ProjectWise 

    Answer Verified By: Jon Summers 

  • , I just noticed that you said "after loading PROJECT info into the global static buffer..."

    To be clear, if a folder has a workflow, the folder also has a state, but it isn't the state of a document, but that of the folder. However, the way this works is as documents change states in a folder, the folder's state reflects the lowest (earliest?) state in the workflow that all of the documents are at, or are at a higher (later?) state in the workflow.

    These datasource settings were added long ago to get around the problem when the folder's state didn't allow users to create documents or version documents.