Solved

How do I create outlook appointments with c# in exchange?

Posted on 2011-03-07
10
869 Views
Last Modified: 2013-12-17
What is the easiest way to get it to work? I've been playing with Microsoft.Exchange.WebServices.Data; and it seems like this is the way to go.

0
Comment
Question by:joein610
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 22

Expert Comment

by:plusone3055
ID: 35059037
0
 
LVL 2

Expert Comment

by:pchui
ID: 35065869
This is the documentation for creating appointments with the EWS Managed API:
http://msdn.microsoft.com/en-us/library/dd633661(v=exchg.80).aspx#Y100

I assume that you are writing a server app, so you'll need to to create appointments for other users. In which case, you'll also need to incorporate impersonation:
http://msdn.microsoft.com/en-us/library/dd633680(EXCHG.80).aspx

If you are writing a client app, just use the Outlook Object Model. This example is VB.NET, but you get the idea... http://support.microsoft.com/kb/313788
0
 

Author Comment

by:joein610
ID: 35070122
Thank you for all the info. I'm trying to get it to work but it gets me an error all the time. I attached the API dll file but it seems like it doesn't work properly. Take a look at the screen shots
3-8-2011-8-58-55-AM.png
3-8-2011-8-59-45-AM.png
0
Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

 
LVL 2

Expert Comment

by:pchui
ID: 35078671
Looks like you added the reference correctly, so I don't see why Visual Studio is complaining. Is Microsoft.Exchange.WebServices in the Object Browser (like in my screen shot)?
objectbrowser.JPG
0
 

Author Comment

by:joein610
ID: 35082768
Yes it is. Is there anything else I can do to try to get this to work?
0
 

Author Comment

by:joein610
ID: 35082812
This is how it looks like..
3-9-2011-8-52-29-AM.png
0
 
LVL 2

Expert Comment

by:pchui
ID: 35089999
Try building my project file. It assumes that the Microsoft.Exchange.WebServices.dll is in a subfolder named "EWS".

 EwsManagedTest.csproj Program.cs
0
 

Author Comment

by:joein610
ID: 35129085
Good Morning, I tried yours but  I got another error. I'm attaching my project + the screen shoot of the error.

The whole project is located here: http://www.nerdalert.biz/exchange.rar



3-14-2011-10-41-20-AM.png
0
 
LVL 2

Accepted Solution

by:
pchui earned 500 total points
ID: 35135669
It should be pretty similar to the AssemblyInfo.cs in your project. AssemblyInfo.cs
0
 

Author Comment

by:joein610
ID: 35141855
It worked. Thank you very much for your help. This is my code for any future reference:

using System;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Exchange.WebServices.Data;

namespace EwsManagedTest
{
    class Program
    {
        static void Main(string[] args)
        {
            ServicePointManager.ServerCertificateValidationCallback +=
            delegate(
                object sender,
                X509Certificate certificate,
                X509Chain chain,
                SslPolicyErrors sslPolicyErrors)
            {
                return true;
            };


            string userName = "login";
            string password = "password";
            string domain = "domain.com";
            string exchangeWebServiceUrl = "IPADDRESS/ews/exchange.asmx";
            ExchangeService service = new ExchangeService();
            service.Credentials = new WebCredentials(userName, password, domain);
            service.Url = new Uri(exchangeWebServiceUrl);

            Appointment appointment = new Appointment(service);
            appointment.Subject = "Testing";
            appointment.Start = DateTime.Now;
            appointment.End = appointment.Start.AddHours(1);
            appointment.Save();
           
        }
    }
}

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Visual Studio 2015 auto inserted code 12 85
Visual C# Windows Project - Clone Form 4 35
c# ftp code 3 52
Timeouts during development 3 25
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

742 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question