TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
aravind sasi
NA
113
2.7k
Gmail API to access, read/modify the delegated emails
May 2 2019 7:46 AM
Hi,
I can read/modify gmails from my own Gmail account via Gmail API using its credentials
using Google.Apis.Auth.OAuth2;
using Google.Apis.Gmail.v1;
But now, IT operation provide me a shared Gmail or delegate. So I want to access, read/modify from that delegate email. So I have to access that delegate email (
[email protected]
).
How can I access delegate email using Gmail API?
Is there any example?
Most of the code in Gmail API sites are in Python and Java which I don't understand.
please shed some lights..
I can access, read my own mail by using Gmail API -
private
static
string
[] Scopes = { GmailService.Scope.GmailModify };
private
UserCredential _credential;
private
string
credPath =
"token.json"
;
public
UserCredential GetCredential()
{
using
(var stream =
new
FileStream(
"credentials.json"
, FileMode.Open, FileAccess.Read))
{
_credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
Scopes,
"user"
,
CancellationToken.None,
new
FileDataStore(credPath,
true
)).Result;
}
return
_credential;
}
GmailCredentials Info =
new
GmailCredentials();
private
static
string
ApplicationName =
"xxxxx"
;
var service =
new
GmailService(
new
BaseClientService.Initializer()
{
HttpClientInitializer = GetCredential(),
ApplicationName = ApplicationName,
});
UsersResource.MessagesResource.ListRequest request = service.Users.Messages.List(
"me"
);
request.Q = ConfigurationManager.AppSettings[
"filter"
];
request.MaxResults = Convert.ToInt64(ConfigurationManager.AppSettings[
"maxCount"
]);
//5;
messages = request.Execute().Messages;
List<
string
> lstRemove =
new
List<
string
>() {
"UNREAD"
};
/// Read the individual message and output as List<Email>
for
(
int
index = 0; index < messages.Count; index++)
{
//... Do the code...
}
Reply
Answers (
4
)
How can i repeat the below design using a repeater control ?
how to display textbox values in grid view