What’s new in PDM Pro 2018 API

My inbox has been blowing up since my last PDM API blog post talking about the new ability to add and customize a new PDM Pro tab in the user interface. Since you all showed me so much love, I thought I would return the favor and go through the other new APIs that are in PDM Pro 2018. (You can always find this information yourself through the release notes, but I’m going to try to give you some real-world examples where I can imagine you may want to use these.)

  • Get the ID of the view in which a file is checked out. (See IEdmFile14::LockedOnViewID.)
    • This returns the vault view ID the file is checked-out in. We’ve been able to tell who has a file checked-out and on which machine for a while, but you could still get in trouble if the user has deleted and recreated his vault view, or if a user’s new machine has the old machine name. (Don’t do that!) This is probably better to use than a machine name to confirm the file is where you think it is. Also, if you have several users sharing vault views, it could be handy to check to see what the access a user may have to a checked-out file. (This is new in SP3.)
  • Remove a PDM add-in. (See IEdmAddInMgr9.)
    • We’ve been able to add, query, learn of add-ins debugging state, etc for a long time. Now we can remove add-ins too!
  • Get a list of values associated with a drop-down control on a data card. (See IEdmCardControl7.)
    • I think this one is especially nice in instances where the list is controlled by a variable…but anytime you want to know the user’s drop list choices. Before you had to get this through SQL -and anytime you can avoid querying the database directly is a good thing.
  • Add custom tabs to a PDM vault view in Windows Explorer using a PDM add-in.
  • Change the state of a file using a specific transition. (See IEdmFile13.)
    • I really like this one, before all we could do was tell PDM to change the state of the file (ChangeState2) and PDM would decide which transition to use. If you had multiple parallel transitions that did different things, the best you could do was cross your fingers and hope PDM would choose wisely! ChangeState3 give us an additional parameter where we can pass the ID of the transition we want to use. I do wish this was an optional parameter, because most of the time I probably don’t want to go through the effort of finding the transition’s ID.
  • Get the thumbnail of a file. (See IEdmFile13.)
    • Want to show your users a bitmap of a file? Cake! I think this will be nice for your new custom tab, or maybe ERP integrations where the user may want a quick preview.
  • Restore deleted items from the recycle bin to the vault view. (See IEdmFolder11.)
    • This new tool not only gives you the ability to restore a file from the recycle bin but also get a list of files that have been deleted. [On a side note, I often get asked about destroying files older than a certain date. We’ve actually had this option for a while, you can use DestroyDeletedItems and pass a parameter of destroying all files older than…]
  • Construct more complicated search criteria using comparators and boolean operators. (See IEdmSearch8.)
    • Before this command it was impossible to search with several ANDs and ORs.

      You can think of the methods “BeginAND” and “BeginOR” as your left parenthesis and “EndAnd” and “EndOr” as your right parenthesis.
  • EdmVault19 – connection to the revision table
    • EdmVault19  contains some new methods are useful for learning about the revision table settings. The Release Notes seem to give you the feeling that you can manipulate the revision table, but from my testing I do not believe this is possible.
  • Copy an assembly tree of referenced parts and drawings to a destination folder. (See IEdmVault19)
    • Now you can execute the CopyTree command without having to write your own.

Pretty good list I think!

2 comments on “What’s new in PDM Pro 2018 API

  1. Hello!

    I’m having issues using the boolean OR function with IEdmSearch8. A bit of background, we use the api mostly within excel.

    Specifically, we have an excel sheet that all users have access to and it’s configured to report on documents/drawings in our vault. We have some setup information (vault name, filepath to be searched, file prefix) that is called within the routine. In the past, without the additional operators, we’d had the report designed to search the prefix + file extension, write search results to a collection, and then search the next set of prefix + file extension, rinse and repeat.

    With the addition of AND/OR operators, I’d like to pare down the code, but when I set it up as follows, the only values written to the collection are the .xlsm files.

    searchresult.StartFolderID = SearchInFolder.ID
    searchresult.BeginOR
    searchresult.Filename = Prefix & “%.docx”
    searchresult.Filename = Prefix & “%.xlsm”
    searchresult.EndOR
    Set searchresultfinal = searchresult.GetFirstResult
    If Not searchresultfinal Is Nothing Then
    Drawings.Add searchresultfinal
    numdwg = numdwg + 1
    End If
    While Not searchresultfinal Is Nothing
    Set searchresultfinal = searchresult.GetNextResult
    If Not searchresultfinal Is Nothing Then
    Drawings.Add searchresultfinal
    numdwg = numdwg + 1
    End If
    Wend

    How should this be formatted to pull BOTH results?

    Thanks!

    • Good idea, but sadly the BeginOR only works with variable searches (AddVariable2) not FileName. In your example, I think you’ll want to do the search twice: Once for docx and once for xlsm. Adding them to your Drawings object each time.

Leave a Reply