how can i get avatar (profile picture) of email id in gmail addon - google-workspace

I want to read a particular thread of email and get its email ids, in to,from,cc.
also I want to get their profile pictures and name to display in the addon.
I tried to get using metadata but was not able to get it
Note : I am able to get the email ids.
but for some I am not getting the names.
I am not able to get profile pictures for all
so i need a way by which i can get profile picture and name of all email ids

It’s only possible to get your own profile picture
as you do not have permission to access someone else’s. So if you’re deploying an
addon, the user will be able to see their own
profile pic.
As far as getting the name, not quite sure what you mean. The full name of a contact? The name of the the person sending you the email?
To get the name of someone that’s sent you an email that’s not one of your contacts, it’s not possible. For a contact that emails you, it’s quite simple. Here is the reference for the ContactsApp: first grab the contact by the email address, and then on the contact object, there is a method to get the fullName.
https://developers.google.com/apps-script/reference/contacts/contacts-app

So far it's not possible to get the profile picture. However, it's easy to get the contact name.
Here an example:
function onGmailMessage(e) {
var messageId = e.gmail.messageId;
var accessToken = e.gmail.accessToken;
GmailApp.setCurrentMessageAccessToken(accessToken);
var message = GmailApp.getMessageById(messageId);
var name = message.getFrom(); // This function return the name of the sender
}
If you need more information about all methods that you can use just have a look to the official documentation.

Related

Is this possible to retrieve public informations from facebook without access token?

I've got a simple question, but can't find out any real solution/answer.
Is that possible to retrieve Public informations about someone's facebook profile, just by typing its firstname and lastname?
Eg. I'm typing for John Doe, and some "API" return to me his first/last name, gender, age range, localisation…
Since now, I only could get Invalid OAuth access token when using application's access_token, and This action can be taken only on the current user and the param 'id' (if any) must be the current session user. if I directly query /{the-user-id}/?fields=xxxxxx
From far I've read, that's not possible (especially now that columbia analytica stolen data !)
(also pointed out by #WizKid)

Moodle - Custom Email Notifications ?

I'm trying to modify the email that a student receives when he finish a quiz.
I want to add some information to the mail (like the feedbacks of each answer, the score ecc.) but, on moodle documentation, i read that there are only few information that i can add: (the $a strings): https://docs.moodle.org/20/en/Quiz_submission_email_notification
Do you know if there are more information that i can add? Or can you explain me how add manually those information, thanks.
The customisation can be done through the language module as I'm sure you've already worked out.
$a is just a variable carrier. In order to access full information you need to add a parameter like so:
$a->ParameterToPass
The parameters available to pass are:
$a->coursename
The name of the course
$a->courseshortname
The shortname of the course
$a->quizname
The name of the quiz
$a->quizreporturl
The URL of the results overview for this quiz (.../mod/quiz/report.php?q=quizid)
$a->quizreportlink
The URL of the results overview URL and quiz name as a HTML link
$a->quizreviewurl
The URL of the review page for this attempt (.../mod/quiz/review.php?attempt=attemptid)
$a->quizreviewlink
The attempt review URL and quiz name as a HTML link
$a->quizurl
The URL of the main page of the quiz (.../mod/quiz/view.php?q=quizid)
$a->quizlink
The URL of the quiz and the quiz name as a HTML link
$a->attemptsubmissiontime
The time the attempt was submitted, formatted using userdate().
$a->timetaken
How long the quiz attempt lasted.
$a->studentname
The name of the person who submitted the quiz.
$a->studentidnumber
The idnumber of the person who submitted the quiz.
$a->studentusername
The username of the person who submitted the quiz.
$a->username
The name of the user the email is being sent to.
$a->useridnumber
The idnumber of the user the email is being sent to.
$a->userusername
The username of the user the email is being sent to.
(Taken from https://docs.moodle.org/30/en/Quiz_submission_email_notification)
This is for Moodle 3.0 - for future reference, you can get a more accurate response if you let us know which Moodle version you're operating.
The reason you can't pass score/outcome as a parameter is because not all review modes on Moodle quizzes enable users to view score - especially if manual marking is enabled (e.g. in the presence of essay-type questions). Instead, you can pass a URL to the review. This ensures that if a review is not available, the user is informed when they click on the link, rather than having a blank statement in the email which may be confusing.

Change the displayname of the sender when sending mail via o365?

Is it possible to control the display name of the sender when sending mails with the office 365 OutlookServicesClient?
I.e., I want to use, say mailer#domain.com as the sender which is configured with the name some name#domain.com in office 365. But for a given mail I want the from name to instead be some other name#domain.com.
I've tried this:
Message draftMessage = new Message
{
Subject = subject,
Body = body,
ToRecipients = toRecip,
CcRecipients = ccRecip,
From = new Recipient()
{
EmailAddress = new EmailAddress() { Address = "mailer#domain.com", Name = "Some other name#domain.com" }
}
};
But the mail is still sent with the preconfigured name of some name#domain.com.
So, is what I want possible?
According to the reference documentation for the Message object, what you want to do is possible. However, logic tells me that shouldn't be possible, and furthermore, the testing I did showed me it wasn't possible (or isn't working). I will follow up on this and update this answer when I get a definitive answer, but at this time, it appears like you can't change the name of the sender (or it's broken).
UPDATE: The From property is writable. I've tested this using pure REST, so I can't speak exactly to what the client library you are using is doing, but I think the request is being transformed to prevent spoofing.
It is possible to control the display name of the sender, but you can only do so with other users in your Office 365 tenant. To do this, sign in to the Office 365 Admin Portal, go to Users, then Active Users, then select the user (User A) that you want to send on behalf of. Click Edit and select Mailbox Permissions. Add the alias or email address of the user (User B) who is running the code (the user authenticated with your app) to the first box under Send email from this mailbox. This will allow you to set the From property of a message sent by User B as User A.
I understand this isn't exactly what you were after, but having the ability to send email as any email address can lead to some bad stuff. Hope this helped!

Stream.publish won't translate {*actor*} using Facebook Connect for iPhone

I am able to successfully publish a stream to my account using Stream.publish via Facebook Connect for iPhone. However, the {*actor*} token does not appear to get translated. I though this was a token that Facebook automatically translates to the user. Is this not the case? Here is my attachment JSON array.
attachment = "{"name":"Join {*actor*} PocketBracket Pool - The Pool Name
pool","href":"http://www.pocketbracket.com/pools/1741",
"media":[{"type":"image",
"src":"http://www.pocketbracket.com/library/images/icon_facebook_post.png","href":"http://www.pocketbracket.com"}],"description":"Get
ready for the 2010 Men's College Basketball Tournament! Fill out your own
bracket and challenge your friends with PocketBracket."}";
Otherwise, I am only setting message and action_links. Do I need to set uid? Again everything shows up correctly, but {*actor*} is still literally within my stream.
Thanks,
Jason
RTFM, Looks like actor can only go in the caption:
caption: A subtitle for the post that should describe why the user posted the item or the action the user took. This field can contain plain text only, as well as the {actor} token, which gets replaced by a link to the profile of the session user. The caption should fit on one line in a user's stream; make sure you account for the width of any thumbnail.
Please let me know if this is not correct.
You can use the tag {actor} only in caption, tested :)

Is it possible to get user id by userName?

I am building a small facebook application, in which I am performing the following:
The user fills out his friend's names (using friend selector), What I want to do next is retrieve the friend's user ID based on their user name. Is it possible? Can I query a user by its name and receive his id?
That's not true! usernames ARE unique too, but the actual name isn't unique!
The username itself is the part from the url e.g.: www.facebook.com/zuck (Page from Mark Zuckerberg) his username is zuck BUT not all user have set a username. For them it shows an userid e.g.: www.facebook.com/profile.php?id=123
No because names aren't unique. What you could do though is capture the UIDs that the friend is submitting, because even though it looks like names, what he's really doing is picking out UID's. Then, even without your app being approved, you can query some basic data (first, last, locale, profile url)