C# console application that sends a google calendar invitation - c#

I'm a pretty new to C# and am much more familiar with Python. But interfacing with a couple programs is more straightforward with C# so I'm attempting to do what I want with it instead of Python.
I've created a Python application that uses SMTP, but I would really like to leverage the Google Calendar API. When I find C# code examples on how to write it, I'm confused as to what needs to be setup for it to work. Where does the authorization come from? A google app?
I would like a console application that can be run by another program which will send an email (or event invitation) to an Business Google account (in-house, co-workers). I'm lost as to where I need to start. What are the different things I need to accomplish this? I'm confused about whether I need to make a Google App and how to navigate what is involved in authentication, or whether I even need it. I didn't think authentication should be necessary except for the login in and password of the account I'm sending it from. Some direction would be appreciated...
Further Edit: Didn't know an iCal can accomplish an invite, most of the examples seemed to be for Outlook. That might work.
But knowing I can set it up through the business account it superb, thanks...

You don't need to make a Google app - if you have the account information for the Business account then you have the ability to use google's smtp server (your smtp server) to send email given that you have credentials - came concept as if you set up a desktop mail program to send and receive gmail.
Looks like this other stackoverflow question may help you out in the actual sending of the email:
Send e-mail via SMTP using C#.
Here is another article that looks more step by step:
http://forum.codecall.net/topic/65295-c-sending-email-through-smtp/
If it was me:
1. Get the credentials
2. Create .Net app to build and send an email - I would make the console app allow command line arguments as well. DotNetPearls is a great site for quick reference and has an introduction to cmd line with C#: http://www.dotnetperls.com/main
Hope this helps - just happened to see the question and realized I have been down this road before

Related

ASP.NET How can I open user's Outlook from a web app?

I'm currently working on a web application using C#. In the original application, one of the functionalities is to open Outlook and create a draft with an attached file to it -it was a desktop app-. Now, they want the same function in the new web application.
So that's my question. I've been reading and as far as I've seen it's not possible to do it from the server, but maybe I missed something?
And, if it's not possible, what would be the best alternative for this?
Thank you very much!
This is actually possible, as long as you are using Exchange, and own the user's mailbox/can pass their credentials.
The EWS Managed API will let you create an email message and save a draft with attachments, so that shouldn't be a problem. See EWS Managed API - Save Draft with inline Images.
If you're not using exchange/can't get that level of permission, you might have to come up with a different solution. Perhaps saving the draft as a .eml file? How to save MailMessage object to disk as *.eml or *.msg file.
There isn't a way to do this directly from a web app. The closest you are going to get is the mailto link protocol. That will allow you to specify the recipient, subject, and a text body. No attachment though. And there is no guarantee that Outlook is what will handle the link.
That being said, if you have control of the client computers, it is possible to create a client app that registers its own protocol for you to use instead of mailto. This would allow you to control Outlook in the same was as your original application. Here is a related question that explains this approach: how do I create my own URL protocol? (e.g. so://...)
You can either
use mailto protocol on the client side
If your user is using IE (other browsers do not support COM) and your app is trusted, you can create an instance of the Outlook.Application COM object and create a new message programmatically in your Java script.

What are my options for sending data from Windows app back to developer without using a webserver

I am writing a simple WPF quiz application for a family member and he would like users of this application to have the option to send him their scores once they have completed the quiz. I was hoping to do this without the need to create some kind of webservice for the app to talk back to.
My initial idea was to email the results back, but that runs into problems. What if there is no SMTP client on the user's machine? I don't want to embed a password for a public smtp server into the application. I could do a Process.Start("mailto:..."), but that requires their machine to have a handler for mailto: and for them to click submit on the generated email.
Another idea I had was that the app could add a line into a Google docs spreadsheet, but that would mean a google docs password would need to be embedded in the app.
So my question is, without me writing a separate application running on a webserver for my WPF app to talk to, is there a good way of my app sending data back to me that doesn't require a password? I'm guessing there must be some kind of public webservice I could use for this?
If you're happy with a third party service that can do this for you, consider Parse, or any other 'backend as a service' provider.
You should then be able to implement something else that reads the saved data from the service when required, without having to expose itself as an API.
Create a google doc forms and when you need the user to submit their score, launch a web browser with the doc url. You can auto-populate the fields by query parameters( ... &entry_0=Barney&entry_1=Google& ... )

Get contacts emails from Hotmail/Live

I've been tearing my hair out for a while now about the best way to get import a users email contacts from a variety of different services, I didn't manage to find a decent .net solution and have ended up creating an interface for the open source PHP OpenInviter. However this doesn't work with Hotmail/windows live anymore, so I thought I'd do that myself with the Live Connect API (using REST and OAuth2), however the contacts only return a email_hashes which is no use as I want their actual email addresses, as I'm trying to import them into a new email address book.
Any ideas at all on how to do this or if it's possible at all! OAuth, screen scraping, whatever I'm not fussed I'd just like to get it done.
Thanks
Apparently there is no official solution to this problem (see http://social.msdn.microsoft.com/Forums/en-US/messengerconnect/thread/c5bc9b10-6080-40bf-a7ce-951a60efdfcb/#c5bc9b10-6080-40bf-a7ce-951a60efdfcb).
And according to the forums trying to do it is against terms and conditions (trying things like screen scraping).
I had this problem too. But then I found out that Google Plus is capable of pulling contacts from Hotmail accounts so I just looked at how Google Plus does it.
Just go the the "circles" page and look for the "inviter"-like functionality. There you find Hotmail, and if you look at how it works, you see that you need to add wl.emails and wl.contacts_emails to the scope when you request authorization from the Hotmail user.
As far as I can see you are already familiar with OAUTH and probably just picked wl.basic as the scope?..

How to register the client who opened an email / a newsletter in ASP.net

For my internship I'm currently working on a web-based newsletter sending application in ASP.Net (C#). This application registers the open-rate of the send newsletters.
I'm using the one by one transparent image method, explained in the following article: http://www.pinpointe.com/blog/how-email-open-and-click-tracking-works to register the open-rate.
The applicaton can register the amount of opens, and the date/time an email was opened. The only thing missing is the client (program) the email was opened with. This information can help the design team to code proper HTML for the newsletter, that is readable in the most common email clients.
To track the client withs opened the email i'm currently using the user agent requesting the one by one image form our server. This information is stored in our database as shown below:
Records 12 and 13 in this example holds an user agent "Microsoft Office Protocol Discovery". This user agent was registered when opening a newsletter in Microsoft Outlook.
Is there a way to get more specific information about a client? E.g. "Microsoft Outlook 2007" as the client.
Seems it's hard to find a solution to this, but here what I have found so far:
Mailchimp seems to be doing this ( http://blog.mailchimp.com/see-what-email-programs-your-subscribers-use-with-user-agent-stats/ ) so it appears to be possible.
It might be worth your while to look into the X-Mailer header - http://msdn.microsoft.com/en-us/library/ms819781.aspx - Not Sure if it's put in the Header of the HTTP request but this field seems to contain the information you are looking for (as seen here - http://office.microsoft.com/en-us/outlook-help/view-e-mail-message-headers-HA001230300.aspx ).
Other than that all I can recommend is to do a few practice rounds from the different clients and check their request (Headers) for any identifying information.
Hope that helps a bit.

How do I interface with Exchange Server using C#?

We had a bit of a snafu on our e-mail server and the permissions went out of whack on our users e-mail folders.
Unfortunately our users are all on Outlook Web Access and do not have access to change the permissions on their e-mail folders.
What I've been tasked with is to expose the ability to change the permissions on exchange e-mail folders. My plan is to somehow interface with Exchange and put the relevant information in an ASP.Net webpage.
I see that there is an Exchange Web Services dll however I'm not sure if that is enabled on our installation. Is there another way to communicate with Exchange? Preferably using C#? Is it easy to turn on Web Services if it is off? How can I check if it is on?
Regards,
Edit : I tried connecting through EWS however I'm getting Error 102 (net::ERR_CONNECTION_REFUSED): Unknown error. This may be because I do not have permissions or the service isn't turned on. I'm going to look into that. Thanks for the suggestions.
Ok, it looks like I had the wrong URI. I'm now getting an "Exchange Server doesn't support the requested version." (I'm just trying to send a test e-mail)
The best way to check if it's up an running and everything working fine would probably be to create a simple sample app as described here: Creating an Exchange Web Services Client Application
As far as I know, this is the best way of accessing Exchange from C#. I think the old way was CDO but that's not supported by Microsoft for .Net I think.

Categories

Resources