I have an application that uploads a qvw file to server (performs a windows file copy) and places it in a directory that qlikview server knows about for documents. My problem is that when I try to retrieve that document via the API (m_QmsClient.GetUserDocuments(m_QvsGuid)), it is not in the list. If I open QV Managment Console in a browser and select the documents tab, some sort of refresh happens. Because when I run my code again, GetUserDocuments returns my new document. At first I thought it was a timing issue, so I put a loop in my code and try again every 5 seconds. It will sit there indefinitly until I browse to the Documents tab. After that, the API knows about the new document.
I can't find anything on the API that will perform this step for me. Has anyone seen this before? I need to get the document so I can set some metadata for it (create a couple document attributes).
I am running QVS11 SR2. I saw the same behavior in SR1 also.
The thing is, I'm not sure exactly what the management console sets as the metadata when you browse to the documents tab. You might want to copy a file, browse to that tab, grab the newly created DocumentMetaData object for that document, serialise it and see exactly which properties are needed as a minimum.
I imagine it's simply documentMetaData.UserDocument.FolderID (should be the same as the FolderID of the folder that it's in) and documentMetaData.UserDocument.Name (should be the same as the document's filename), but I'm not 100% sure on this.
I've tried your suggestion, but it didn't appear to work (completely). I tried to create a new DocumentMetaData object based on an existing one. That code is pasted below. While the SaveDocumentMetaData is successful, GetUserDocuments returns null when I try to retrieve the document again.
However, after the SaveDocumentMetaData I do see a .Meta file on the file system. So I'm getting closer but QMS API doesn't seem to recognize the new metadata I created.