问题标签 [google-email-migration]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
84 浏览

google-email-migration - Google 电子邮件迁移 API 面临的问题

我正在使用 Google 电子邮件迁移 API 将邮件从 Yahoo 邮箱迁移到 Gmail。

使用 Google 电子邮件迁移 API,我获得了特定用户的访问令牌,并且我正在使用以下 API 来迁移邮件:

https://www.googleapis.com/upload/email/v2/users/somemailid@gmail.com/mail?uploadType=multipart

我正在向上述 API 发送一个 Multipart 请求,我收到的响应如下:

包含 0 个 mime 部分的无效多部分请求。

请让我知道如何解决这个问题。

0 投票
1 回答
780 浏览

google-api - Google.Apis.Email_Migration_v2

我正在尝试从每个 UploadAsync 方法调用中检索 HttpStatusCode。我需要状态码来正确执行指数退避算法以重试失败的上传,在不重试上传时向用户显示错误消息并报告上传成功。我不在乎它是如何接收的,只要它是干净的并且没有像 Tor Jonsson 在下面提供的链接中建议的那样从 Exception.Message (字符串)属性中解析出来。

为了强制“错误请求错误 [400]”,我只是在 MailResource.InsertMediaUpload 的构造函数中提供了一个无效的用户密钥(电子邮件)。
例如 MailResource.InsertMediaUpload(mailItem, "invalidEmail@domain.com" , stream, "message/rfc822")

问题

1) GoogleApiException.HttpStatusCode 始终为 0(不可用)。即使 Exception.Message 似乎在括号中包含状态代码。例如[400]
2) 找不到 GoogleApiRequestException。

问题
1) 执行指数退避算法的最佳方法是什么???
2)在这种情况下,这是该属性的预期行为吗?
3) GoogleApiRequestException 是否仍然存在,如果存在,在哪里?

旁注:
我还注意到 GoogleApiRequestException 类不再与 GoogleApiException 类在同一个文件中。它是否已被移动到另一个命名空间或被删除?因为我想尝试捕获一个 GoogleApiRequestException 对象并获取它的 RequestError 对象。

我为我的意思添加了两个差异的链接:

之前:http

://code.google.com/p/google-api-dotnet-client/source/browse/Src/GoogleApis/GoogleApiException.cs?r=a8e27790f8769c1d6aaae030bb46c79daa7cdbad 之后:http ://code.google.com/p/google-api-dotnet-client/source/browse/Src/GoogleApis/GoogleApiException.cs?r=d6f06e92d90b635c179013e2c287b42b82909c09

来源

我正在使用来自 NuGet 的最新二进制文件(1.6.0.8-beta)

我发现与我的问题有关的唯一问题:(只能发布两个链接......继承人原始) stackoverflow.com/questions/18985306/httpstatuscode-not-set-in-exceptions-when-using-google-net-apis

代码:(使用自定义记录器写入调试视图)

输出片段
[5224] (T101) VSLLC:例外!!!类型:Google.GoogleApiException
[5224] (T101) VSLLC:GoogleApiException-> 消息:Google.Apis.Requests.RequestError
[5224] 错误请求 [400]
[5224] 错误 [
[5224] 消息[错误请求] 位置 [-]原因 [badRequest] 域 [全局]
[5224] ]
[5224] (T101) VSLLC: GoogleApiException->状态代码: 0
[5224] (T101) VSLLC: 上传完成...状态: 异常失败?:服务管理员有抛出异常:Google.GoogleApiException: Google.Apis.Requests.RequestError
[5224] 错误请求 [400]
[5224] 错误 [
[5224] 消息[错误请求] 位置 [-] 原因 [badRequest] 域 [全局]
[5224 ] ]
[5224]
[5224] 在 Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
[5224] 在 Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(任务任务)
[5224] 在 Microsoft.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (任务任务)
[5224] 在 c:\code\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release 中的 Google.Apis.Upload.ResumableUpload`1.d__0.MoveNext() \bin\Debug\output\default\Src\GoogleApis\Apis[媒体]\Upload\ResumableUpload.cs:373 行


抱歉,这篇文章太宽泛了!谢谢你的时间!

0 投票
0 回答
71 浏览

google-apps-script - Google Apps 脚本和 Google 迁移 API

我是新手,我想在 Google Apps 脚本中创建一个代码,该代码将执行以下操作

我已经做到了step 3。我不知道如何4th part通过编码进行。任何人都可以建议

0 投票
3 回答
150 浏览

google-apps-script - 使用 Google Apps 脚本在 Google Apps 帐户中迁移邮件

我想使用 Google Apps 脚本将我的邮件从一个 Google Apps 帐户迁移到另一个 Google Apps 帐户,如果有人知道我们如何实现这一点,请告诉我。

0 投票
2 回答
441 浏览

google-apps-script - Email Migration API v2: Google Apps Script

I am trying to write a GAS to migrate some emails which are stored in Google Drive but I am really struggling to get the POST correct to do this and was hoping someone could help me out and steer me in the right direction.

What I have so far is ..

This obviously doesn't work and I get a 400 error code. Do you know what could be wrong ?

0 投票
2 回答
168 浏览

google-api - 是否可以将电子邮件迁移到 gmail 帐户

我想开发办公应用程序,我想将 Outlook 中的电子邮件同步到 Google 帐户。然后,

我使用哪个范围?

如何将电子邮件数据传递到 URL 以及在哪个 URL 上?

如果可能的话给我一个例子

我使用这两个范围进行身份验证或获取用户信息。

我指的是这个堆栈溢出链接: 链接

另一个问题是我可以将电子邮件迁移到example@gmail.com(gmail 帐户)吗?我使用Google Playground来检查电子邮件迁移范围,然后如果我使用example@domain.com迁移电子邮件,它会给 API 的无效访问错误,并且它可以正常工作。

0 投票
1 回答
130 浏览

google-admin-sdk - 在当前帐户之外添加带有域名的 Send-As 电子邮件(请求)

由于合并,我们在一个 Google Apps 帐户下拥有域 A,在另一个帐户下拥有域 B。我可以为域 B 中的所有用户创建帐户到域 A,然后开始迁移。在账户 A 下添加具有域的别名是没有问题的。

但是,使用Admin SDK似乎无法以域 B 下的帐户发送电子邮件(用户可以使用其帐户手动请求,然后将向域 B 中的帐户发送邮件,询问他们是否要允许它):

作为托管域上的用户或别名存在的任何电子邮件地址。

当手动请求允许以其他用户/电子邮件地址发送邮件时,是否有任何方法可以启动用户将进入的流程?

首先将域迁移到它是不可能的,因为显然,在允许将域添加到另一个 Google Apps 帐户之前,必须完全关闭域。

0 投票
0 回答
164 浏览

google-api - 电子邮件迁移 API v2。多部分插入返回 503

我使用 google 客户端 api 为 ruby​​ 版本 0.7.1 测试电子邮件迁移 API V2 对于分段上传,我总是从服务器收到以下响应:

这是我的代码:

一些日志信息

调试 18:58:13 rails [pid=6311]:Google::APIClient::Request 发送 API 请求发布https://www.googleapis.com/upload/email/v2/users/name@domain.com/mail? uploadType=multipart {"User-Agent"=>"My app/1.1.0 google-api-ruby-client/0.7.1 Mac OS X/10.9.4\n (gzip)", "Content-Type"=> "multipart/related;boundary=---------RubyApiMultipartPost", "Content-Length"=>"682", "Accept-Encoding"=>"gzip", "Authorization"=>"Bearer xxxxx", "缓存控制"=>"无存储"}

帖子正文:

请帮助我了解为什么 google 会以 503 响应。以及如何解决它。我确定我没有达到 API 配额。

更新1:

看起来 Content-Disposition 标头是 503 错误的原因,因为没有它上传工作正常!

0 投票
2 回答
552 浏览

c# - Google.Apis.Admin.Email_Migration_v2 [HTTP Status Code 412 – Limit Reached]

Edit 2:

Client Library: After reviewing it is not easily suggested that this is for the .NET client library.

DLL: Google.Apis.Admin.email_migration_v2.dll


What steps will reproduce the problem?

  1. Generate a process which contains a Google.Apis.Admin.email_migration_v2.AdminService instance for each unique Google Apps Gmail mailbox that will have messages sent to it. All of the AdminService objects generated use the same OAuth2.0 credentials and application name. Each AdminService object generated will only send messages to one Google Apps user’s mailbox. For example, if we were sending messages to five different Google Apps Gmail mailboxes we would generate five AdminService objects to send messages; one for each user’s mailbox.

    • Biggest thing to note is that each AdminService object created is created on a separate process.

    • AdminService objects were given a FileDataStore object to change the location of where the refresh token is stored; C:\ProgramData\SomeFile\SomeFile.

    • Supplied appropriate scopes to the credentials.

  2. Begin sending mail messages on each process. Using one thread to send messages in each process, so only one message is sent at a time to each user’s mailbox.

    • Each message sent gets its own instance of MailItem and MailResource.InsetMedia

    • The MailResource.InsertMedia object is generated for each item by calling AdminService.Mail.Insert(MailItem, string, Stream, string) method.

  3. When our code makes the call to MailResource.InsertMediaUpload.UploadAsync(CancellationTokenSource).Result is where we can receive the error.

    • The error is caught and handled (logged) from the return type of the aforementioned call; the type is Google.Apis.Upload.IUploadProgress. The exception is handled using the IUploadProgress.Exception property.

What is the expected output? What do you see instead?

  • The expected output would be a successful message response or the exception property of the IUploadProgress to be null after the return of the task. Instead we are receiving the following error message:

    The service admin has thrown an exception: Google.GoogleApiException:Google.Apis.Requests.RequestError

    Limit reached. [412] Errors [Message[Limit reached.] Location[If-Match - header] Reason[conditionNotMet] Domain[global]]

    at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

    at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)

    at Google.Apis.Upload.ResumableUpload`1.d__e.MoveNext()

What version of the product are you using?

  • Google.Apis.Admin.Email_Migration_v2 (1.8.1.20)

What is your operating system?

  • Windows Server 2008 R2 Enterprise (SP1)

What is your IDE?

  • Visual Studio 2013 Premium

What is the .NET framework version?

  • 4.0.30319

Please provide any additional information below.

  • Non-consecutive messages can fail (with the 412 http status code provided above) during the process of sending the messages. Once we receive this error other messages sent after the failed message(s) can succeed. (Items can fail at any point during the process beginning, middle or end.)

  • Each message sent has nearly identical content. The size of the messages range from 1KB to 100KB including the size of all associated attachments, not all messages have attachments.

  • Reprocessing the failed items at a later time results in successful message responses and the appropriate items are sent to the user’s Google Apps Gmail Inbox.

  • The maximum number of Google Apps user’s mailboxes sent to at one time was ten.

  • After checking the quotas of our Google Developers Console project:

    • We were nowhere near the specified limit of 20 requests a second for the Email Migration API; maxed out at sending 7 requests a second.

    • Only 2% of the maximum daily requests had been reached.

  • All messages sent had the same label; the label was well under the 225 character limit. Actually all of the labels/sub-labels applied together only surmounted to 40 characters.

  • This error message can still be received when sending to only one Google Apps user’s mailbox; only using one process and one thread.

  • Each process is normally sending anywhere from 1000-5000 messages.

  • I have not found a lot of specific documentation to explain this particular error in enough detail to remedy the problem at hand.

Questions:

  1. So what exactly does this 412 http status code mean? What limit is being encountered that this message is referring to?
  2. Shouldn’t we be receiving some form of 5XX error from the server if we are hitting a limit? In which case wouldn’t the built in exponential back off policy kick in?
    • a. Unless the server is checking the POST request for a pre-condition about a server side limit then telling the client to back off which is what a 412 error seems to typically indicate. In that case please give as much detail as possible for question 1.

Sorry for the extensive post! Thanks for your time! I will also be creating a defect/issue in Google's .NET issue tracker and providing a link.


Edit 1:

For anyone interested in following this issue here is a link to the submitted item in Google's issue tracker for .NET. Submitted Issue

For reference it is issue 492.

0 投票
0 回答
198 浏览

c# - Google.Apis.Admin.Email_Migration_v2 针对 503 错误返回的 HTTP 410 状态代码

本质上,在使用 .NET 版本的 Email Migration v2 Google API 时,我们的应用程序每秒向单个 Google Apps 邮箱/用户发送太多请求;大于每秒 1 个请求。返回的 GoogleApiException 很好,并且是预期的,但是错误消息的正文指出发生了服务不可用 (503) 错误,但是同一 GoogleApiException 实例的“HttpStatusCode”属性等于 Http 状态代码走了(410),我将在下面包含一个代码片段和一些日志输出。此时,请参阅底部的问题部分或继续阅读以获取更多详细信息。

哪些步骤将重现该问题?

创建执行以下操作的进程/应用程序:

  1. 创建一个 Google.Apis.Admin.email_migration_v2.AdminService 对象,使用您的 OAuth2.0 凭据正确初始化它。
  2. 对于需要发送到 Google Apps 的每条消息,通过使用 AdminService.Mail.Insert() 提供适当的参数,使用上面的 AdminService 对象创建一个 Google.Apis.Admin.email_migration_v2.MailResource.InsertMediaUpload 实例。
  3. 在捕获发生的任何错误时调用 MailResource.InsertMediaUpload.UploadAsync。

请执行下列操作:

  1. 通过使用相同的 OAuth2.0 凭据假脱出数百个指向同一个用户的进程/应用程序实例,开始以指数速率发送消息。
  2. 坐下来啜饮你的山露,等待 [503] 错误出现......

一旦错误开始滚动关闭您的应用程序.. 除了测试应用程序异常处理之外,无需敲击糟糕的谷歌服务器..

什么是预期的输出?你看到了什么呢?

使用以下类型的实例:Google.GoogleApiException

人们会期望看到实例的 HttpStatusCode 属性等同于 System.Net.HttpStatusCode.ServiceUnavailable 而不是 System.Net.HttpStatusCode.Gone

您使用的是什么版本的产品?

Google.Apis.Admin.Email_Migration_v2 (1.8.1.20)

你的操作系统是什么?

Windows Server 2008 R2 企业版 (SP1)

你的IDE是什么?

Visual Studio 2013 高级版

.NET 框架版本是什么?

4.0.30319

请在下面提供任何附加信息。

以下是为上传目的而调用的方法的代码片段:

这是显示异常输出的方法的代码片段。


这是由 HandleUploadProgressException 方法处理的 GoogleApiException 的释义输出:(注意使用自定义日志记录类;输出到 DebugView)

** 上下文信息 **

尝试将项目写入 Gmail 时出错...

** 活动详情 **

VS-EventID: 30003(errGmailTryUpload) 在 GmailMessenger.HandleUploadProgressException 中处理的 GoogleApiException。 HttpStatusCode:消失

** 内部异常详细信息 **

服务管理员抛出异常:Google.GoogleApiException: Google.Apis.Requests.RequestError

暂停服务。请再试一次 [503]

错误[消息[服务不可用。请重试] Location[ - ] Reason[backendError] Domain[global] ]

在 Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)

在 Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(任务任务)

在 Google.Apis.Upload.ResumableUpload`1.d__e.MoveNext()

问题:

  1. 如果这是预期的行为还是错误,任何人都可以解释一下吗?
  2. 如果这是预期结果,应用程序应如何处理基于 410 的错误?我知道当遇到大多数(如果不是全部)400 错误时,该特定项目的处理应该停止,但这似乎不是本地问题,更多的是服务器端问题。

我很感激任何回复,我知道像这样具体的问题可能很难。