IsDocumentFolderAdministrator Method
Overloads
IsDocumentFolderAdministrator() |
Check if cucrent user is document administrator |
IsDocumentFolderAdministrator()
Check if cucrent user is document administrator
Declaration
bool IsDocumentFolderAdministrator()
Returns
Type | Description |
---|---|
System.Boolean |
True if user is document administrator |
Remarks
security
Requires membership of local groups QlikView Management API and QlikView Administrator.
Examples
The following code example uses the QMS API to check and modify document administrators.
The service key injection is assumed to be handled behind the scenes. For an example of how to inject the service key, see Samples.
using System;
using System.Collections.Generic;
using QMSApiExamples.QMSAPI;
using QMSApiExamples.ServiceSupport;
using Exception = System.Exception;
namespace QMSApiExamples
{
class Program
{
static void Main(string[] args)
{
try
{
// create a QMS API client
IQMS3 apiClient = new QMS3Client();
//retrieve a time limited service key
ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();
string userName = "DOMAIN\\user";
string currentUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
Guid qmsId = new Guid("5e2f6630-8911-4fa4-8faf-fafa4907110f");
Guid qdsId = new Guid("7fa0b459-1580-4677-8d61-acd1ec5f5d8a");
Guid folderId = new Guid("b8fb68de-338e-4747-8c8a-7ed2f5b662e9");
// Set domain\user as document folder administrator if not already one
if (!apiClient.IsUserDocumentFolderAdministratorForFolder(userName, folderId))
{
apiClient.SetDocumentFolderAdministrator(folderId, userName, ePermissionObjectType.SourceDocumentFolder);
}
// Set current user to document administrator for Email administrator if not already one
if (!apiClient.IsDocumentFolderAdministratorForType(ePermissionObjectType.MailServer))
{
apiClient.SetDocumentFolderAdministratorForEmail(qmsId, currentUser);
}
// Update Alert emails on tasks for document adminstrators
apiClient.UpdateDocumentAdministratorEmail(qdsId);
if (apiClient.IsUserDocumentFolderAdministrator(userName))
Console.WriteLine(userName + " is a document administrator");
if (apiClient.IsDocumentFolderAdministrator())
Console.WriteLine(currentUser + " is a document administrator");
if (apiClient.IsDocumentFolderAdministratorForFolder(folderId))
Console.WriteLine(currentUser + " is a document administrator for folder " + folderId);
// Delete all document administrator for folder
List<string> folderAdministrators = apiClient.GetDocumentFolderAdministrators(folderId);
apiClient.DeleteDocumentAdministrators(folderId, folderAdministrators);
}
catch (Exception ex)
{
Console.WriteLine("An exception occurred: " + ex.Message);
}
// wait for user to press any key
Console.ReadLine();
}
}
}
See Also
GetDocumentFolderAdministrators(System.Guid)
IsUserDocumentFolderAdministrator(System.String)
IsDocumentFolderAdministratorForFolder(System.Guid)
UpdateDocumentAdministratorEmail(System.Guid)
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!