1 Reply Latest reply on May 12, 2009 7:58 AM by roggeheflin

    JavaScript to Encrypt with Certificate


      I have been having touble debugging this code.  It fails on "this.encryptForRecipients".  Please help!!  I have double (triple) checked my typing, and I can't seem to find anything incorrect, excepting that I have one item in 'oGroup', not an array....  I am currently trying to execute this from the console, before i create a folder level JS.  I would prefer to use oEntity with out firstName, lastName, and fullName.


      Thank you all for yout help!



      var cerPath = "/C/Documents and Settings/rrh/Desktop/Sample/";
      var cerFile = "01PCH004.cer";
      var oCert = security.importFromFile("Certificate", cerPath + cerFile);
      var oEntity = {firstName:"Fred", lastName:"Smith", fullName:"Fred Smith", certificates:oCert, defaultEncryptCert:oCert};

      this.encryptForRecipients({oGroups:[{userEntities:oEntity, permissions:{allowPrinting:"highQuality"}}],
                      bMetaData : true});



      InvalidArgsError: Invalid arguments.
      Doc.encryptForRecipients:7:Console undefined:Exec