Skip to main content Skip to complementary content

SetDocumentFolderAdministratorForEmail Method

Overloads

SetDocumentFolderAdministratorForEmail(Guid, String)

Assign a user as a document adminstrator for email

SetDocumentFolderAdministratorForEmail(Guid, String)

Assign a user as a document adminstrator for email

Declaration

      void SetDocumentFolderAdministratorForEmail(Guid folderID, string userName)
    

Parameters

Type Name Description
System.Guid folderID

Send in id of the qms

System.String userName

The user to set as 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

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!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: ampquestions@qlik.com