0 Replies Latest reply: Oct 22, 2013 8:12 PM by Keith Doyle RSS

    QMS API arbitrarily associating a folder with an ID

    Keith Doyle

      I've been writing some automation code using the QMS API, and have been able to figure out how to make things work.   However, I'm concerned about potential side-effects that may exist given that in order to perform some functions, especially ADD/CREATE type functions, I've just tried stuff until I found something that worked.   I'm thinking that may not always be the best solution, but information is pretty darn vague around here....


      In particular, we needed to be able to dynamically create a set of temporary source folders for the purpose of loading dashboard documents in parallel.   So, I needed a way to add N source folders programmatically.   Well, I found a way that seems to work.  I get the QDSSettings.General object, and replace its SourceFolders array with a larger array with the additional folders.  In order to create a new folder, I create an instance of a DocumentFolder object and a couple of sub-objects (General in particular), and then just create an ID for it using Guid.NewGuid().   I ultimately do a SaveQDSSettings to update.  As I said, this seems to work fine.  What I'm wondering though, is if I were to delete the folder in the UI (or by programmatically removing it from the SourceFolders array in the settings object), and then later add it again programmatically, this would end up with the folder path being associated with a new Guid.   As far as I'm concerned, that's not a problem, but I'm wondering if QMS internally keeps any folder/ID references, and if this might create a duplicate folder association that could cause problems...   Again, I don't know if or where that might be an issue, but the solution I ended up with to programmatically add a source folder frankly, seems kludgy given the need to regenerate the SourceFolders array.


      I note that many structures within QMS API objects apparelntly USED to be list objects, but have since been changed to be arrays.  Most of the help examples don't work because if this but I figured that out and now look for it to make sure I use arrays for such things.   The problem with arrays, is you can't add to them, you have to recreate them, which is what I'm doing here in expanding the list of source folders-- again it works, but I would think that using a list with the .add method would have been cleaner.    I presume there was some reason to convert everything from list to array, but it was darned confusing at first to find that none of the example code worked because they were still doing things with lists...





      Keith Doyle