Exchange 2010 SP2 Exchange Web Services (EWS) 404 Not Found Issue
-
8 สิงหาคม 2555 9:25
Hi,
I'm trying to use EWS from a C# application in VS 2005 to add a contact to a users mailbox in Exchange 2010. VS 2005 is running on Server 2008 R2 64-bit. IT have configured Exchange impersonation for the account whose credentials I'm supplying.
I've created a Web Service reference to 'https://mail.<domain>.co.uk/ews/Services.wsdl'</domain> in my application so I know that I can see this end point.
I'm establishing a connection to Exchange using the following code:
_Conn = new ExchangeServiceBinding(); _Conn.RequestServerVersionValue = new RequestServerVersion(); _Conn.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2010_SP2; _Conn.Url = https://mail.<domain>.co.uk/ews/Services.asmx
_Conn.Credentials = new NetworkCredential("<username>", "<password>", "<domain>");I'm specifying the mailbox using the following code:
_Conn.ExchangeImpersonation = new ExchangeImpersonationType(); _Conn.ExchangeImpersonation.ConnectingSID = new ConnectingSIDType(); _Conn.ExchangeImpersonation.ConnectingSID.ItemElementName = ItemChoiceType.PrimarySmtpAddress; _Conn.ExchangeImpersonation.ConnectingSID.Item "user@domain.co.uk";I then create an instance of type ContactItemType called createItem and configure it with the details of the contact I want to add then try and add it to Exchange using the following code:
// Set File Name createItem.FileAs = "fileName"; createItem.FileAsMapping = FileAsMappingType.None; createItem.FileAsMappingSpecified = true; // Build request CreateItemType request = new CreateItemType(); request.Items = new NonEmptyArrayOfAllItemsType(); request.Items.Items = new ItemType[] { createItem }; // Create Contact in Exchange by sending request CreateItemResponseType createItemResponse = _Conn.CreateItem(request);
It's at this point that I get the '404 Not Found' error.
I have a version of this code working against Exchange 2007. The difference, which might account for the error, is in how I specify the mailbox. The Exchange 2007 code reads:
_Conn.ExchangeImpersonation = new ExchangeImpersonationType(); _Conn.ExchangeImpersonation.ConnectingSID = new ConnectingSIDType(); _Conn.ExchangeImpersonation.ConnectingSID.PrimarySmtpAddress = "user@domain.co.uk";Certainly if I specify a nonsense primary SMTP address I get the '404 Not Found' error but I'm happy with the address I'm specifying.
Likewise if I specify a nonsense Exchange EWS URL I get the '404 Not Found' error but hopefully I'm getting it right since I've used the same address I used when I set up the EWS web reference in VS 2005 except I'm specifying '.asmx' instead of '.wsdl'.
I hope that someone can help.
Regards,
Craig
- แก้ไขโดย Craig Harrison GB 8 สิงหาคม 2555 9:50
ตอบทั้งหมด
-
8 สิงหาคม 2555 18:13ผู้ดูแล
Hello Craig,
The purpose of this forum is to support the Open Specifications documentation. You can read about the Microsoft Open Specifications program from http://www.microsoft.com/openspecifications/en/us/default.aspx
The library of Open Specification documents can be accessed from http://msdn.microsoft.com/en-us/library/dd208104(PROT.10).aspx. Your question may be more applicable to this forum http://social.technet.microsoft.com/Forums/da/exchangesvrdevelopment/threads
Regards,
Sreekanth Nadendla
Microsoft Windows Open Specifications