Download mbox after audit export request

63 views
Skip to first unread message

Olympic College

unread,
Oct 18, 2011, 12:56:50 PM10/18/11
to google-app...@googlegroups.com
So I followed the API docs for requesting an email export. The request went in fine, and I can query the status ect.
Now that it's done, and has a link to the URL to download the mailbox, how do I actually download it? When I visit the URL in browser (https://apps-apis.google.com/a/feeds/compliance/audit/mail/export/{domain}/{id}) it says:

Authorization required

Error 401


When I try to access it problematically though the API via the following code (using the .NET API):

FeedQuery query = new FeedQuery();
Service tservice = new Service(domain, appName);
tservice.setUserCredentials(userName, password);
query.Uri = new Uri(mboxURI);
AtomFeed mboxFeed = service.Query(query);

It says:

The remote server returned an error: (501) Not Implemented.


So... how do I actually download the file?
 

Jay Lee

unread,
Oct 18, 2011, 2:30:12 PM10/18/11
to google-app...@googlegroups.com
Hi OC_Portal,

  You should be able to just get each of the URLs in the FileURLX variables. Take a look at how Google Apps Manager (GAM) handles this:


you might also want to look at what the XML will look like once the status is COMPLETED:


it's the second example XML response. If the URL doesn't look like that, you're not using the right URL to get the file.

Jay

Olympic College

unread,
Oct 18, 2011, 6:11:26 PM10/18/11
to google-app...@googlegroups.com
Hum, the in the .NET API, the MailboxDumpRequest object does not have a FileURLX property although it does have a .getFileDownloadUrl(int) method which i'm assuming is the correct way to go. It also has a .Links property (which is a collection of AtomLinks), and is what I was using as it seemed to point to a valid URL (in the format already mentioned). 

However I now see that for all 4 of my test audit requests, the .NumerOfFiles property is 0 (and getFileDownloadUrl returns nulls) ... why does this happen and how do i get an audit request to actually contain something?

Jay Lee

unread,
Oct 18, 2011, 8:04:16 PM10/18/11
to google-app...@googlegroups.com
Hi OC_Portal,

  You would see zero files returned if you searched for something specific in the exported mailbox and nothing was returned (did you do a search as part of the export request?) or if the user had no mail (what is the user's quota at?).

Jay

Olympic College

unread,
Oct 19, 2011, 2:21:06 PM10/19/11
to google-app...@googlegroups.com
I think I did... following the example given on the API doc page, the request is set up like so:

        MailboxDumpRequest mailboxDumpRequest = new MailboxDumpRequest();
        mailboxDumpRequest.BeginDate = DateTime.Now.Subtract(new TimeSpan(60, 0, 0, 0));
        mailboxDumpRequest.EndDate = DateTime.Now;
        mailboxDumpRequest.IncludeDeleted = false;
        mailboxDumpRequest.SearchQuery = "in:chat";
        mailboxDumpRequest.PackageContent = MonitorLevel.FULL_MESSAGE;

I see that "SearchQuery" part, but I don't know what that means...Is that why?

Jay Lee

unread,
Oct 19, 2011, 2:49:41 PM10/19/11
to google-app...@googlegroups.com
Hi OC_Portal,

  So based on that you searched for IM messages (in:chat) for the user over the last 60 days. If the user doesn't use Google Talk or keeps all conversations off the record, that explains your lack of any results.

Jay

Olympic College

unread,
Oct 19, 2011, 4:32:32 PM10/19/11
to google-app...@googlegroups.com
OK thanks, I'll try a new request without a filter.
Reply all
Reply to author
Forward
0 new messages