Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following code that is resulting in very odd behavior using QMSAPI for QlikView v11. In the method below, I am starting small and only attempting to add a DocumentFolder to the QDS.General.Source Folders locale. Once I'm complete there, I'll need to add Document Administrator user names to that new DocumentFolder (hence my naming in the code below).
I'm only scoping to the General of the QDS adding in my folder and saving; however, I'm getting errors regarding a QVSID Guid. Even when I *include* the Services member of my new DocumentFolder class and define a QVSID there, I get this error. Any thoughts? All help much appreciated!
Jeff
public static void AddDocumentAdministrators(string sourceDocumentsPath, List<string> users)
{
try
{
// create a QMS API client
IQMS apiClient = new QMSClient();
//retrieve a time limited service key
ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();
ServiceInfo qdsService = apiClient.GetServices(ServiceTypes.QlikViewDistributionService).FirstOrDefault();
QDSSettings qdsSettings = apiClient.GetQDSSettings(qdsService.ID, QDSSettingsScope.All);
List<DocumentFolder> sourceFolders = qdsSettings.General.SourceFolders;
DocumentFolder tenantFolder = new DocumentFolder();
tenantFolder.General = new DocumentFolder.DocumentFolderGeneral();
tenantFolder.General.Type = DocumentFolderType.Source;
tenantFolder.General.Path = sourceDocumentsPath;
tenantFolder.General.SendAlertEmailForDocumentAdministrators = false;
tenantFolder.Scope = DocumentFolderScope.General;
sourceFolders.Add(tenantFolder);
apiClient.SaveQDSSettings(qdsSettings);
}
catch (System.Exception e)
{
Console.WriteLine(e.Message + e.InnerException + e.StackTrace);
}
}
}
My Error:
Error Adding Document Administrators: PIX.QMSAPI.Exceptions.DataValidationException: Validation of QDSSettings object failed: QVSID property cannot be an empty Guidmscorlib
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at QVManager.QMSAPI.IQMS.SaveQDSSettings(QDSSettings qdsSettings)
at QVManager.SourceDocumentService.AddDocumentAdministrators(String sourceDocumentsPath, List`1 users) in c:\Users\jmurr\Source\Workspaces\QVManager\QVManager\QVManager\QMSAPIOperations.cs:line 825
I've tried a few different ways. It really looks like there's some problems with the data validaiton routine of the QDSSettings objects. Anyone seen this before and have a work around for creating DocumentFolder objects and adding them to the settings?
PIX.QMSAPI.Exceptions.DataValidationException: Validation of QDSSettings objectfailed: QVSID property cannot be an empty Guid
Error message is pretty misleading, in reality it complains about empty guid for DocumentFolder. I was running into the same issue, but setting ID, in your case on tenantFolder object to Guid.NewGuid() will fix it.
As a side note, there appears to be no validation on the path, so you can submit multiple requests with same path and multiple records will be created with identical paths.