Esempio n. 1
0
        /// <summary>
        /// Creates a new monitoring task to begin an audit.
        /// </summary>
        /// <param name="sourceUser">The user who receives or sends messages that are being audited</param>
        /// <param name="mailMonitor">The details of the monitoring task</param>
        /// <returns>The audit task being created</returns>
        public MailMonitor CreateMailMonitor(String sourceUser, MailMonitor mailMonitor) {
            Uri requestUri = new Uri(String.Format("{0}/{1}/{2}",
                                                   baseMailMonitorUri,
                                                   domain,
                                                   sourceUser));

            return Insert(requestUri, mailMonitor) as MailMonitor;
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new monitoring task to begin an audit.
        /// </summary>
        /// <param name="sourceUser">The user who receives or sends messages that are being audited</param>
        /// <param name="mailMonitor">The details of the monitoring task</param>
        /// <returns>The audit task being created</returns>
        public MailMonitor CreateMailMonitor(String sourceUser, MailMonitor mailMonitor)
        {
            Uri requestUri = new Uri(String.Format("{0}/{1}/{2}",
                                                   baseMailMonitorUri,
                                                   domain,
                                                   sourceUser));

            return(Insert(requestUri, mailMonitor) as MailMonitor);
        }
Esempio n. 3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="service"></param>
        private static void RunSample(AuditService service) {
            //A sample base64 encoded PGP format key
            string sampleKey = "LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tClZlcnNpb246IEdudVBHIHYxLjQu\n" +
                "MTAgKEdOVS9MaW51eCkKCm1RRU5CRXhGbWM0QkNBRG9RUU5OVzdRQTB5anNIWkhNVEY5RU9pMjJa\n" +
                "TTR2QkQrK3E5TkNvME5OcTA1b0R1WDQKR3JUWFVGdk9KV1ZoVDNtdCtaaCtSQlBhS3NYVUd3ZEpw\n" +
                "R1ZzMk4rbzZyMXF6TXorZ0paNEN3NDJZMzNRbjZJRgpPOTh4Mkh0TVNTUGk1QlVTYlExSnA3czYx\n" +
                "MVlPMWtzTmtUOFpiSDAvSHErcUhSQzF6L1g4cVZNK3hlSGh4Ull6Cml6MEx2bytYZGMvNDUwRUEx\n" +
                "dkRhNTRyM3Z5MUFIT0xhWDRpcmFzQ0I4N3NLV0YxcUp6UTQ5Zkw5SnRxZWVDOFAKYUtVbmlmQi9h\n" +
                "UXNHdER2cGVVVWt6NDRPRjB5R2pjRTg3b1NHTTdWSEJxZmVKb0xubStzYmgyWkZaSnZEZWVJWAph\n" +
                "ZzJSS3hpakJhcGlmR0xCcGkvc0p6c3pDekUrOFhFRDBCVEJBQkVCQUFHMEprTnNZWFZrYVc4Z1Ey\n" +
                "aGxjblZpCmFXNXZJRHhqYkdGMVpHbHZRR2R2YjJkc1pTNWpiMjAraVFFNEJCTUJBZ0FpQlFKTVJa\n" +
                "bk9BaHNEQmdzSkNBY0QKQWdZVkNBSUpDZ3NFRmdJREFRSWVBUUlYZ0FBS0NSRGJmeldDc0dtQWUw\n" +
                "SzRCLzlZaEpGdXN3NGE5Q1JEYXU2dgpDVnJNRTlrVko4UmxocEpCZEY2V1pndGRPZlhsbzJycEVt\n" +
                "Q1FRZ0lCRGJEeS9aQ3JHRWZDWlRIa0VLeXQrVVNpCndnUWY3NFRZZ0NzMTR0WmF5WHZKT3dENkIz\n" +
                "QW1NYkRtQVFVM0ppdVRaMXIzZEZYV3BnUTE4RDI0YUEwcGVCOWMKbmcwbXc0enhGUW15b29paG14\n" +
                "NWwvZmZ4UDFQUHNrL1kvV3F5ck5HQVhDUGxmRUFRdFN3bWRGYXNoVjYyZElEdwpOZXBMeTZSeE15\n" +
                "TFRTL2ZvMExmSnEreWVjWjZkck91bTlkUnA3T0ZUOERSWmNqSTQ4eVM5VFNMd1Rtc0hHUm1uCkNO\n" +
                "Nk1BWnBaK2lkVks5VEkveXVhOG4xQndNU3kwU3NGSjVpSG8wUFFHbSt5MHZxcDdGN2RCUlVCYWFw\n" +
                "MGc0K3QKOTEyRQo9aFpYYwotLS0tLUVORCBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCg==";

            try {
                // Upload public key
                Console.WriteLine("\n-----------Uploading public key-----------");
                AppsExtendedEntry keyEntry = service.UploadPublicKey(sampleKey);

                // Setting the parameters for a MailMonitor request
                MailMonitor monitor = new MailMonitor();
                monitor.BeginDate = new DateTime(2011, 6, 15);
                monitor.EndDate = new DateTime(2011, 6, 30, 23, 20, 0);
                monitor.IncomingEmailMonitorLevel = MonitorLevel.FULL_MESSAGE;
                monitor.OutgoingEmailMonitorLevel = MonitorLevel.HEADER_ONLY;
                monitor.DraftMonitorLevel = MonitorLevel.FULL_MESSAGE;
                monitor.ChatMonitorLevel = MonitorLevel.FULL_MESSAGE;
                monitor.DestinationUserName = destUsername;

                // Send the MailMonitor creation request
                Console.WriteLine("\n-----------Creating mail monitor-----------");
                MailMonitor monitorEntry = service.CreateMailMonitor(srcUsername, monitor);

                // Retrieve all MailMonitors for the source user
                Console.WriteLine("\n-----------Retrieving all mail monitors-----------");
                GenericFeed<MailMonitor> monitors = service.RetrieveMailMonitors(srcUsername);
                foreach (MailMonitor m in monitors.Entries) {
                    Console.WriteLine(m.DestinationUserName);
                }

                // Delete MailMonitor
                Console.WriteLine("\n-----------Deleting mail monitor-----------");
                service.DeleteMailMonitor(srcUsername, destUsername);

                // Create Account Info request
                Console.WriteLine("\n-----------Creating account info request-----------");
                AccountInfo accountInfoRequest = service.CreateAccountInfoRequest(srcUsername);
                Console.WriteLine("Request ID: " + accountInfoRequest.RequestId);

                // Retrieve Account Info request
                Console.WriteLine("\n-----------Retrieving account info request-----------");
                AccountInfo accountInfo = service.RetrieveAccountInfoRequest(srcUsername, accountInfoRequest.RequestId);
                Console.WriteLine("Status: " + accountInfo.Status);

                // Retrieve all Account Info requests from April 1st 2011
                Console.WriteLine("\n-----------Retrieving all account info requests-----------");
                GenericFeed<AccountInfo> accountInfoRequests = service.RetrieveAllAccountInfoRequests(new DateTime(2011, 4, 1));
                foreach (AccountInfo info in accountInfoRequests.Entries) {
                    Console.WriteLine(info.RequestId + " - " + info.Status);
                }

                // Delete Account Info request
                // This can only be done when the Status is COMPLETED or MARKED_DELETE
                //Console.WriteLine("\n-----------Deleting the account info request-----------");
                //service.DeleteAccountInfoRequest(srcUsername, accountInfoRequest.RequestId);

                // Setting the parameters for a MailboxDump request
                MailboxDumpRequest mailboxDumpRequest = new MailboxDumpRequest();
                mailboxDumpRequest.BeginDate = new DateTime(2009, 6, 15);
                mailboxDumpRequest.EndDate = new DateTime(2009, 6, 30, 23, 20, 0);
                mailboxDumpRequest.SearchQuery = "in:chat";
                mailboxDumpRequest.PackageContent = MonitorLevel.FULL_MESSAGE;

                // Create Mailbox Dump request
                Console.WriteLine("\n-----------Creating mailbox dump request-----------");
                MailboxDumpRequest dumpRequest = service.CreateMailboxDumpRequest(srcUsername, mailboxDumpRequest);
                Console.WriteLine("Request ID: " + dumpRequest.RequestId);

                // Retrieve Mailbox Dump request
                Console.WriteLine("\n-----------Retrieving mailbox dump request-----------");
                MailboxDumpRequest checkRequest = service.RetrieveMailboxDumpRequest(srcUsername, dumpRequest.RequestId);
                Console.WriteLine("Status: " + dumpRequest.Status);

                // Retrieve all Mailbox Dump requests
                Console.WriteLine("\n-----------Retrieving all mailbox dump requests-----------");
                GenericFeed<MailboxDumpRequest> dumpRequests = service.RetrieveAllMailboxDumpRequests();
                foreach (MailboxDumpRequest dump in dumpRequests.Entries) {
                    Console.WriteLine(dump.RequestId + " - " + dump.Status);
                }

                // Delete Mailbox Dump request
                // This can only be done when the Status is COMPLETED or MARKED_DELETE
                //Console.WriteLine("\n-----------Deleting the mailbox dump request-----------");
                //service.DeleteMailboxDumpRequest(srcUsername, dumpRequest.RequestId);

            } catch (AppsException a) {
                Console.WriteLine("A Google Apps error occurred.");
                Console.WriteLine();
                Console.WriteLine("Error code: {0}", a.ErrorCode);
                Console.WriteLine("Invalid input: {0}", a.InvalidInput);
                Console.WriteLine("Reason: {0}", a.Reason);
            }
        }