How do I interface with Exchange Server using C#? - 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.

Related

Application Insight on premises without Internet Access

I've to develop a WPF application in an intranet environment with no internet access for security reason. I was wondering if it's possible to collect data locally (on a server) then to FTP them or even better to have the application insight alternative installed on a Server.
Has anyone faced a similar situation and have been able to solve it?
You could do something like that yourself if you really needed to. Instead of using the built in InMemoryChannel or ServerChannel classes to send telemetry, you'd create your own implementation to store them somewhere else. (or you could change the endpoint that the default channels point to to a web service inside the intranet.
you could then collect those files up and ftp them outside, and write another service to read those files and send the telemetry to app insights. Though it seems less like a good idea given the intranet with no internet for security reasons.
Or, better yet, you could simply write internal service to parse and store all that telemetry and show it on that web service inside the intranet and use appinsights only as an sdk and schema, and don't send any of your data outside your intranet at all.
More likely: upvote adding AI to azure stack, (https://feedback.azure.com/forums/357324-application-insights/suggestions/11683746-bring-application-insights-to-azure-stack) and then get an azure stack implementation inside your intranet? then you get all the other goodies of Azure from Azure stack as well.

C# console application that sends a google calendar invitation

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

Active directory ADWS WSDL vs C# implementation

So I'm trying to find a "Best" way to interact(create a interface) with Active Directory read/write mode. So I'm deciding between this two aproaches:
Try and use the ADWS.
C# Implementation.
Apparently for ADWS is not that easy even though there is a full WSDL I'v not been able to locate it, to try to do some test via SOAPui...
Now fort the C# Implementation there are few implementations
but still I'm not sure if its 100% doable to have full READ/WRITE to AD i.e. creating accounts users, query for users info, etc. from lets say REST WS.
So My questions are
Is there a way of getting a WSDL from the AD server so that I can use that as a starting point? ( I don't want to get me into PowerShell stuff or the like)
Are there any good articles for the latest versions C# ,libs, etc... to help me implement this?
Is there a better way of doing this?
As an example This is what we're trying to do:
Scenario 1:
Create a Web Service (INTERFACE) that expose AD information
The Web Service could be REST or SOAP
The WS should read/Query/Write the AD
Any Application inside the network can consume the WS
Scenario 2 (What we currently plan to do):
Sharepoint Reads AD Information
Job should copy AD to DB
Applications can read this data
There should exist some replication between the DB and AD
Any suggestions will be more than welcome
I'm Using server 2008R2 ,Sharepoint foundations 2010
I'm assuming this is related to your previous question which mentioned Exchange.
My personal suggestion is to host a WCF service in IIS. You can set this service up to do whatever you want to suite your needs for the apps accessing it. You can probably do most of what you need to do through the System.DirectoryServices.AccountManagement namespace when it comes to User and Groups.
System.DirectoryServices will give you more granular control at the cost of more work. However, it is a little easier and reading and writing from/to custom attributes here.
If you're going to interact with Exchange 2010 you'll need to mess with Powershell. And you could use Powershell to do core AD work as well.
And of course if you're going to write your own web service you could make it REST.
Here is a link to MSDN with info about System.DirectoryServices and the various namespaces. I personally find AD to be a lot of fun to work with. There are many ways to do the same thing in it so I don't think there's one right answer for you. Go with what you're comfortable with or challenge yourself to do something new!

Using MVC 5 web page to get data from outlook server?

I've had a look around and can't seem to find what I'm looking for (unless I have and didn't realise...)
I have been tasked with creating a basic CRM web based app so that it can be used on any device.
I am using MVC 5 to do this using SQL server to store all the required tables.
What I need to do know is be able to sync with an outlook exchange server so that the user can log in and their list of contacts/scheduled tasks are taken from the outlook information as well as be able to create/edit/delete etc the contacts + scheduled tasks and be able to post them back to the outlook server. ie without having to open a local Microsoft Outlook application.
Is this possible and if so does anyone know where I may be able to find a good enough source to help me learn this further.
thanks...
Tewr's comment is right on the spot as this is a scenario suited for EWS (Exchange Web Services).
If you're using MVC 5 to develop this application, it may be the most helpful to use EWS Managed API to access the Exchange server as it allows you to all of it in C#.
Managed API - http://msdn.microsoft.com/en-us/library/office/jj220499(v=exchg.80).aspx
Working with contacts - http://msdn.microsoft.com/en-us/library/office/ee693004(v=exchg.80).aspx

Callback URL in Skydrive API to localhost

I am trying to implement SkyDrive API into my Asp.net mvc3 application.I tried to create app in Microsoft using this tutorial for implementing user authentication , but I am facing a problem in Callback Url, because Microsoft forces me to add a real domain and I want to use my localhost in order to develop it right now.
Alternatively you could add a fake domain to your
/etc/hosts (Linux)
C:\Windows\System32\drivers\etc\hosts (windows)
file. Just add the following lines:
127.0.0.1 www.yourfakedomain.de
After adding that line you can choose in Microsoft OneDrive App-Center something like
http://www.yourfakedomain.de/blabla.php
as your redirect uri.
Since your operating system thinks that domain belongs to localhost you will be able to get your authentication code just normally at your local test domain ;-)
How would SkyDrive call code on your local machine?
One way to do it is to first mock SkyDrive in your application -- that is, you don't call the real SkyDrive, just a service that you have running locally that acts as if it is SkyDrive. You can use that to develop and debug your application to some extent.
Then you can deploy your application to a test server on the Internet, so that SkyDrive can do the callback, and you can test it there and make the necessary modifications before you deploy to an actual production server.
I find a solution for my problem, I used pageKite to solve my problem. pagekite gave me an alternative to my localhost by mapping my localhost to a real domain. so I added that domain to my app in Microsoft and its working.

Categories

Resources