Remove Default Domain Viewer from File in Google Drive
===

I am working on a very simple script that will update the viewers of a document. In my Google Apps domain, the default sharing permissions were changed. My admin would like to go back and change the sharing settings on all existing documents. While working on my POC, I have encountered an error and was wondering if there was a different piece of GAS which I should employ.

The problem is that I am unable to remove the domain user as a viewer on a document due to an "Invalid Email" error.

The message is: `Exception: Invalid email: MyDomain.com`

Thank you in advance for any assistance.

[I have removed logging and error catching from the following code.]

    function removeDomainUser()
    {
      DocsList.getAllFiles().forEach(
        function (file,i ,array)
        {

            //--Always pick the Domain Viewer--//

            var toRemove = -1;
            file.getViewers().forEach(
              function(user,i)
              {
                toRemove = user.getEmail() == "MyDomain.com" ? i : toRemove;
              }
            );

            //--If there is a Domain viewer, remove it--//

            toRemove > -1 ? file.removeViewer(file.getViewers()[toRemove]) : '';
        }
      );
    }
