css.img
Exchaneg Web Services
Hi All
A newbie to this site, so apologies if I don't do it right the first time
I need help with Exchange Web Services. I have managed to connect and send an email. Simple
But my goal is to create an apsx page that will have information input and then have it sent into exchange contacts so they can be sync to my phone. Currently having to enter contact details into a number of different systems . Hence my goal to try to enter the information once.
My code is below and my problem is the line
Contact contact = new Contact(service);
I get an error as follows
Error CS1729 'Contact' does not contain a constructor that takes 1 arguments
I am using the following name space
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Net;
using System.Security;
using Microsoft.Exchange.WebServices.Data;
using System.Web.Services;
with the code below
// Connect to Exchange Web Services as user1 at contoso.com.
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1, TimeZoneInfo.Utc);
service.Credentials = new WebCredentials("user@keyman .com", "password");
service.AutodiscoverUrl("user@keyman .com", RedirectionCallback);
System.Diagnostics.Debug.WriteLine("EWS Endpoint: {0}", service.Url);
Contact contact = new Contact(service);
I know it is probably a simple thing but, I just cannot find anything anywhere to help me sort this out. if I cannot clear this error none of the fields are recognised in the rest of the code to create the contact
SO, I hope someone can help
Thanks in advance
4 answers
Sort by: Newest
-
-
-
Newman 1 Reputation point
2021-07-02T02:35:54.92+00:00 Yes, I figured it out. It was confusing itself with another bit of code. Once I isolated it. It worked like a dream
Thanks
-
Glen Scales 4,431 Reputation points
2021-07-01T23:44:46.283+00:00 That should work there is nothing wrong with your syntax, is this in a separate method or class ? is it possibly resolving to a different Contact class the name is generic so you could try fully qualifying it to see if that makes a difference eg (you shouldn't have to do this but its worth trying)
Microsoft.Exchange.WebServices.Data.Contact contact = new Microsoft.Exchange.WebServices.Data.Contact(service);