How can i send a outlook invite to another user using exchange API? Actually i'm trying this.
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
service.Credentials = new WebCredentials("example#server.com", "example");
Appointment appointment = new Appointment(service);
But i need send invite to ANOTHER user, using his email.
I use appointment.RequiredAttendees.Add(new Attendee("example#server.com")); for send invite to the person.
Related
Using Google Calendars API /events/insert, I create an event in a user's calendar on their behalf and set them as the organizer. I also invite one guest.
I want the organizer to receive an email notification similar to what a guest might receive. I tried using the sendUpdates parameter but it only notifies guests.
Is there a way to notify the organizer that an event was created in their calendar on their behalf?
That is outside of what even Google Calendar can do. So this problem is unrelated to the API itself. Google calendar assumes that the organizer is the one creating the event so already knows it is being created so there is no reason to notify them.
You have access via Oauth2, there is no way the api knows that this is not the user themselves as your application has permission to preform actions on behalf of the user. So google calendar thinks you are the user so no reason to notify you.
Here's a work around I have used in the past.
As you already have write access on the calendar you should have access to see who the owner is by doing an acl.list this will get you their email address.
You could then have your application email them.
You can also invite them using an allies email address, however i have found some clients don't like this solution as they then appear twice.
One work around you can do is to add a another version of the owners email to the attendees. For example, if their normal email is test#gmail.com you can convert it to test+1#gmail.com. They'll receive an invite at their normal email. Keep in mind this will add an additional attendee to the event. When they click accept in the email it will mark their original email as accepted, not the one with +1 appended to it.
See this basic function for adding a +1 the email in JS:
function changeEmail(email) {
let splitEmail = email.split('#');
return splitEmail[0] + '+1#' + splitEmail[1];
}
Note you can add any text after the email. It doesn't have to be +1.
Answer:
As DaImTo has said, the API will not provide an email to the user who has created the event, which is exactly what your application is doing via OAuth2.
You can however take the event information from the response and manually send the user an Email using the Gmail API.
Example Code:
I do not know what language you are using, but as a python example, after getting the Gmail service with your service account credentials:
subject = "email#example.com"
delegated_credentials = service_account.Credentials.from_service_account_file(key_file_location, scopes=scopes, subject=subject)
gmail_service = discovery.build(api_name, api_version, credentials=delegated_credentials)
You can use the Sending Email tutorial to create and send an email on behalf of the user that created the event:
# Copyright 2020 Google LLC.
# SPDX-License-Identifier: Apache-2.0
def create_message(sender, to, subject, message_text):
message = MIMEText(message_text)
message['to'] = to
message['from'] = sender
message['subject'] = subject
return {'raw': base64.urlsafe_b64encode(message.as_string())}
def send_message(service, user_id, message):
try:
message = (service.users().messages().send(userId=user_id, body=message)
.execute())
print 'Message Id: %s' % message['id']
return message
except errors.HttpError, error:
print 'An error occurred: %s' % error
And then simply send the information to the user via email using the data already defined for the event insert call:
emailText = "Title: " + summary + "\nStart: " + startTime + "\nEnd: " + endTime
msg = create_message(subject, # the sub for the service account
subject, #to and from are the same
"A Calendar Event has been created on your behalf",
emailText)
send_message(gmail_service, calendar_response['creator']['email']
References:
Sending Email | Gmail API | Google Developers
I would like to open new conversations with users using the Microsoft Bot Builder on the Skype for Business channel. The only information I have is the user id (sip:user#domain.com)
In all the examples I could find, it is needed to save the conversation id/address of a user in a previous conversation to send a new message to this user.
How to create a new conversation as a bot to a user knowing only his id?
Thanks
Like you stated the userId is required to send a message to the user. A new conversation can be created by the framework but ultimately, you can't do anything without the userId and to obtain this the user has to contact your bot first. This is only true for channels like Skype. Other channels like E-mail just use the email address as an id. Skype uses a GUID as the id for their users. This is done so bots can't randomly add themselves to any user on Skype. Source
This doesn't mean you have to necessarily wait for the user to start a conversation. Whenever a user adds a bot to their contact list an event is send to the bot. This is the ContactRelationUpdate event. It warns the bot that a user has added the bot and the bot can then respond accordingly. Once this event is thrown you can obtain the userId from the activity and do whatever you want with it. Source
An external saas application "SocialNetwork" is using one of our office365 users to send the notification emails. Typically the saas app will send different notifications and will set the sender name to the author of a new content. But the sender name for the notifications is always the name of the Office365 user ("SocialNetwork").
e.g.:
John Doe posts a new file in the saas application "SocialNetwork". I should receive an email notification about that. The notification is sent via our Office365 user "SocialNetwork". Sadly the email I receive as a Office365 user comes from "SocialNetwork" and not as "John Doe", which is set when the notification email is sent.
How can we send notifications via an office365 user but still not have a fixed name for this user and rather send emails with it including varying sender names?
Exchange Server in general, and Office 365 in particular, will not let you spoof the sender address. It has to come from one of the SMTP aliases of the mailbox.
I am trying to build a bot that can address the requests placed by the user. However, the bot needs to ask permission of the user's manager for the same. So this is the flow:
User places a request to the bot.
Bot informs user's manager to either approve or reject the request
Based on the response from manager, bot either address the request or does not and informs the user.
I am able to make a 1:1 conversation between bot and user using the PromptDialog, and perform steps 1 and 3. However, I am not sure how to send message to another user for approval or rejection and continue the earlier conversation with the first user. I am using C# for this bot. Any ideas on how could I do this?
Thanks
Niyati
After sending the message to a second user using the following code and storing in the inbox of the first user, you can send the stored result, again using the above code, to the first user and follow their conversations.
string recipientId ="123456789"; // For Example
string serviceUrl = "https://telegram.botframework.com"; // For Example
var connector = new ConnectorClient(new Uri(serviceUrl));
IMessageActivity newMessage = Activity.CreateMessageActivity();
newMessage.Type = ActivityTypes.Message;
newMessage.From = new ChannelAccount("<BotId>", "<BotName>");
newMessage.Conversation = new ConversationAccount(false, recipientId);
newMessage.Recipient = new ChannelAccount(recipientId);
newMessage.Text = "<MessageText>";
await connector.Conversations.SendToConversationAsync((Activity)newMessage);
The code comes from here.
check this page, specifically the start conversation section.
You could keep a context stack for each user, pushing an item on top of the stack for each message sent by the bot and matching context in FIFO order for each message recieved. Now this context stack goes into a map identified by the userId/userKey.
Bot-context is a library which does exactly this. The related blog post.
I am able to create new emails using Exchange Web Service Managed API in a local desktop application. These messages contain quotes for products and services. What I want to do now is open the email before sending it so the user can edit and then send the email themselves. All users have Outlook 2013.
If you need web-client access, you should be looking at the interop libraries and not EWS. EWS is meant to be run headless without client interaction (and therefore cannot open dialogs in Outlook).
An example of doing so in the interop library would look something like:
Outlook.Application outlook = new Outlook.Application();
Outlook.MailItem email = outlook.CreateItem(Outlook.OlItemType.olMailItem)
as Outlook.MailItem;
email.To = "client#rfq.com";
email.Subject = "Your Quote";
email.Body = "Here is your quote.";
email.Attachments.Add(#"C:\quotes\quote.pdf", Outlook.OlAttachmentType.olByValue,
Type.Missing, Type.Missing);
email.Display(false);