I've added a Web Reference of the Exchange Server which is like this
"https://<Server Name>/EWS/Services.wsdl".
and i tried to use method "FindFolder()" while i tried to get response
from the server, i got an error
"The request failed with HTTP status 405: Method Not Allowed".
I've no idea what is wrong where. I googled the exception and i found
that some ppl had same problem when they referred web reference that
ends with "WSDL". but didnt find any usefull solution to get rid of
the problem.
I'm using,
Development Tools:
c#.net 2005
Exchange Server Web Service.
Please let me know if someone has any solution, i would really
appreciate any help.
Thanks
Cheers
Glen
"lucky" <tushar....@gmail.com> wrote in message
news:1187808180....@e9g2000prf.googlegroups.com...
here is the code that i'm using.
Web Reference:
"https://<server name>/EWS/Services.wsdl"
Method:
public static void GetFolder()
{
ExchangeServiceBinding esb = new ExchangeServiceBinding();
esb.Credentials = new NetworkCredential("username",
"password", "domain");
esb.Url = @"https://<server name>/EWS/Services.wsdl";
// Identify the folders to get.
FolderIdType folder1 = new FolderIdType();
DistinguishedFolderIdType sentitems = new
DistinguishedFolderIdType();
folder1.Id = "Processed";
sentitems.Id = DistinguishedFolderIdNameType.sentitems;
// Identify the folder properties to return.
FolderResponseShapeType properties = new
FolderResponseShapeType();
PathToUnindexedFieldType ptuft = new
PathToUnindexedFieldType();
ptuft.FieldURI =
UnindexedFieldURIType.folderManagedFolderInformation;
PathToUnindexedFieldType[] ptufts = new
PathToUnindexedFieldType[1] { ptuft };
properties.AdditionalProperties = ptufts;
properties.BaseShape =
DefaultShapeNamesType.AllProperties;
// Form the get folder request.
GetFolderType request = new GetFolderType();
request.FolderIds = new BaseFolderIdType[] { folder1};
request.FolderShape = properties;
try
{
// Send the request and get the response.
GetFolderResponseType response =
esb.GetFolder(request);
ArrayOfResponseMessagesType aormt =
response.ResponseMessages;
ResponseMessageType[] rmta = aormt.Items;
foreach (ResponseMessageType rmt in rmta)
{
if (rmt.ResponseClass ==
ResponseClassType.Success)
{
FolderInfoResponseMessageType firmt;
firmt = (rmt as
FolderInfoResponseMessageType);
BaseFolderType[] folders = firmt.Folders;
foreach (BaseFolderType folder in folders)
{
if (folder is CalendarFolderType)
{
CalendarFolderType calendar;
calendar = (folder as
CalendarFolderType);
}
else if (folder is ContactsFolderType)
{
// Handle the contacts folder.
}
else
{
// Handle SearchFolderType,
TasksFolderType,
// and FolderType.
}
}
}
}
}
catch (WebException ex)
{
throw ex;
}
}
Exception:
The request failed with HTTP status 405: Method Not Allowed
I'm not able to resolve this problem. Please let me know if it make
any sense to you.
I would welcom any other way as well.
thanks
Lucky
Web Reference:
"https://<server name>/EWS/Services.wsdl"
Method:
public static void GetFolder()
{
ExchangeServiceBinding esb = new ExchangeServiceBinding();
esb.Credentials = new NetworkCredential("username",
"password", "domain");
esb.Url = @"https://<server name>/EWS/Exchange.asmx";
Solution :
Adding reference is correct. but when u assign Url to
ExchangeServiceBinding, use "Exchange.asmx" instead of
"Services.wsdl".
and u will be able to you all methods.
Cheers,
Lucky
> On Wednesday, August 22, 2007 2:43 PM lucky wrote:
> Hi all,
> I'm newbie with Exchange Server 2007 Web Service.
> Problem :
>
> I've added a Web Reference of the Exchange Server which is like this
> "https://<Server Name>/EWS/Services.wsdl".
> and i tried to use method "FindFolder()" while i tried to get response
> from the server, i got an error
> "The request failed with HTTP status 405: Method Not Allowed".
>
> I've no idea what is wrong where. I googled the exception and i found
> that some ppl had same problem when they referred web reference that
> ends with "WSDL". but didnt find any usefull solution to get rid of
> the problem.
>
> I'm using,
> Development Tools:
> c#.net 2005
> Exchange Server Web Service.
>
> Please let me know if someone has any solution, i would really
> appreciate any help.
>
> Thanks
>> On Wednesday, August 22, 2007 8:49 PM Glen Scales [MVP] wrote:
>> You might want to try posting some of the code your trying to use. I would
>> also recommend having a read of
>> http://msdn2.microsoft.com/en-us/library/bb508825.aspx this describes about
>> the proxy objects and has some links to detailed instructions on who to
>> create a proper visual studio project.
>>
>> Cheers
>> Glen
>>
>> "lucky" <tushar....@gmail.com> wrote in message
>> news:1187808180....@e9g2000prf.googlegroups.com...
>>> On Thursday, August 23, 2007 3:34 AM lucky wrote:
>>> Hi Glen,
>>> Thanks for the URL, it was very informative.
>>>
>>> here is the code that i'm using.
>>>
>>> Web Reference:
>>> "https://<server name>/EWS/Services.wsdl"
>>>
>>> Method:
>>>
>>> public static void GetFolder()
>>> {
>>> ExchangeServiceBinding esb = new ExchangeServiceBinding();
>>> esb.Credentials = new NetworkCredential("username",
>>> "password", "domain");
>>>> Submitted via EggHeadCafe - Software Developer Portal of Choice
>>>> ASP.NET MaskedTextBox Custom Control
>>>> http://www.eggheadcafe.com/tutorials/aspnet/39a071cd-9f96-4e81-9346-4e445181d645/aspnet-maskedtextbox-custom-control.aspx