Solved

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

Posted on 2011-03-07
10
857 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
  • 5
  • 4
10 Comments
 
LVL 22

Expert Comment

by:plusone3055
Comment Utility
0
 
LVL 2

Expert Comment

by:pchui
Comment Utility
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
Comment Utility
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
 
LVL 2

Expert Comment

by:pchui
Comment Utility
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
Comment Utility
Yes it is. Is there anything else I can do to try to get this to work?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

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

Expert Comment

by:pchui
Comment Utility
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
Comment Utility
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
Comment Utility
It should be pretty similar to the AssemblyInfo.cs in your project. AssemblyInfo.cs
0
 

Author Comment

by:joein610
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
XML to SQL Table using c# 5 44
LINQ question 7 20
Default parameter problem in C# 3 25
fomat Json objects 6 15
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now