How to find URN and GUID of a document?

I tried this:

    lOk = aaApi_SelectDocument(lngProjectId, lngDocumentID)
    If lOk < 0 Then ' Si 0, il n'y a pas de document dans le buffer
        aaApi_ShowLastErrorMessageBox
        Stop
        Exit Sub
    End If

    lngptrW = aaApi_GetDocumentStringProperty(DOC_PROP_URL_NAME, 0) ' => Return NULL
    strDocumentURL = VBStringFromPtrW(lngptrW)

    lngptrW = aaApi_GetDocumentStringProperty(DOC_PROP_IS_URL, 0) ' => Return NULL
    strDocumentURL = VBStringFromPtrW(lngptrW)

    lngptrW = aaApi_GetDocumentGuidProperty(DOC_PROP_DOCGUID, 0)
    strDocumentGUID = VBStringFromPtrW(lngptrW) ' => Return "00000000000000"

    lngptrW = aaApi_GetDocumentGuidProperty(DOC_PROP_ORIGGUID, 0)
    strDocumentGUID = VBStringFromPtrW(lngptrW) ' => Return an empty string

    lngptrW = aaApi_GetDocumentGuidProperty(DOC_PROP_LOCATIONID, 0)
    strDocumentGUID = VBStringFromPtrW(lngptrW) ' => Return an empty string

  • And what is the difference between these two notions URN and GUID?

  • What you see in the Address Bar:
    pw:\\decide-pwce-us.bentley.com:decide-pwce-us-10\Documents\dww\Test Folder 01\TestTextFile 01

    URL
    pw://decide-pwce-us.bentley.com:decide-pwce-us-10/Documents/dww/Test&space;Folder&space;01/TestTextFile&space;01

    URN
    pw://decide-pwce-us.bentley.com:decide-pwce-us-10/Documents/D{2f6919f8-27bf-4254-b81e-bebdd4e77609}

    1. GUID - Global Unique ID - Think of it as a primary key for a document that does not change when you move a document to a different folder in the datasource.  ProjectID and DocumentID (may have different labels depending upon context), are unique within a folder for a document, but will change if the document is moved to a different folder.
    2. URL - Check the PW documentation for PW Explorer, but basically it is a link containing text based information which will fail if the document is moved, but is easier for a human to interpret.
    3. URN - Check the PW documentation for PW Explorer, but basically is is a link containing a GUID  which will work if the document is moved, which makes it more useful for using as an actual link.