0 Replies Latest reply: Jul 31, 2014 1:47 AM by Zhou Dz RSS

    Setting 'print and export to excel' for some user using QMS API

    Zhou Dz

      Hi all,

      I wanna setting "print and export to excel" using QMS API. Below is the qmc settings, I can easily set the option to ALL, NONE, some users and groups. And all the settings are working.

      a.jpg

       

      Now I wanna set using QMS API, here is the c#  code. My question is : the first two fuction ( setExceltoUsers and setExceltoNone) work well, but the 3rd one ( setExceltoAll) doesn't work. What's wrong with my code? Thanks.

       

       

       public static void setExceltoUsers(string guid, params string[] userNames)
              {
                  try
                  {
                      if (guid != null && userNames != null)
                      {
                          QMSClient client = GetClient();
                          DocumentMetaData documnet = GetDocumentMetaData(guid);
                          documnet.Server.Access.ExportUsers = userNames;
                          documnet.Server.Access.Export = DocumentDownloadAccess.Restricted;
                          client.SaveDocumentMetaData(documnet);
                      }
                  }
                  catch { }
              }
       public static void setExceltoNone(string guid)
              {
                  try
                  {
                      if (guid != null)
                      {
                          QMSClient client = GetClient();
                          DocumentMetaData documnet = GetDocumentMetaData(guid);
                          documnet.Server.Access.Export = DocumentDownloadAccess.None;
                          client.SaveDocumentMetaData(documnet);
                      }
                  }
                  catch { }
              }
       public static void setExceltoAll(string guid)
              {
                  try
                  {
                      if (guid != null)
                      {
                          QMSClient client = GetClient();
                          DocumentMetaData documnet = GetDocumentMetaData(guid);
                          documnet.Server.Access.Export = DocumentDownloadAccess.All;
                          client.SaveDocumentMetaData(documnet);
                      }
                  }
                  catch { }
              }
      

       

      !