Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / Exchange 2007 Web Services / 2 сообщений из 2, страница 1 из 1
01.06.2009, 17:38
    #36019694
Alex_BBB
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Exchange 2007 Web Services
В Visual Studio 2008 выбрал Add Web Reference и указал http://mail-cas.firma.lan/ews/exchange.asmx
С помощью следующего кода пытаюсь отправить сообщение на почту:
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
using (ExchangeServiceBinding esb = new ExchangeServiceBinding())
{
    esb.Credentials = new NetworkCredential("ivanov", "pass", "firma");
    esb.Url = "http://mail-cas.firma.lan/ews/exchange.asmx";

    // Create a CreateItem request object
    CreateItemType request = new CreateItemType();

    // Setup the request:
    // Indicate that we only want to send the message. No copy will be saved.
    request.MessageDisposition = MessageDispositionType.SendOnly;
    request.MessageDispositionSpecified = true;

    // Create a message object and set its properties
    MessageType message = new MessageType();
    message.Subject = "TEST SOAP";
    message.Body = new BodyType();
    message.Body.BodyType1 = BodyTypeType.Text;
    message.Body.Value = "TEST SOAP";
    message.ToRecipients = new EmailAddressType[1];
    message.ToRecipients[0] = new EmailAddressType();
    message.ToRecipients[0].EmailAddress = "ivanov@firma.ru";//toEmailAddress;
    message.ToRecipients[0].RoutingType = "SMTP";

    //There are some more properties in MessageType object 
    //you can set all according to your requirement
    // Construct the array of items to send
    request.Items = new NonEmptyArrayOfAllItemsType();
    request.Items.Items = new ItemType[1];
    request.Items.Items[0] = message;

    // Call the CreateItem EWS method.
    CreateItemResponseType response = esb.CreateItem(request); // ОШИБКА
    //this.ThrowOnError("SendMessage", response.ResponseMessages.Items[0]);
}
На отмеченной строчке возникает "информативное" сообщение об ошибке:
An internal server error occurred. The operation failed.

С чем может быть связано?

(Если же указывать неверный пароль пользователя то возвращает реальную ошибку "The request failed with HTTP status 401: Unauthorized.")
...
Рейтинг: 0 / 0
02.06.2009, 13:39
    #36021141
Alex_BBB
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Exchange 2007 Web Services
Может кому еще пригодится - ошбка возникала из-за того что ящик пользователя
new NetworkCredential("ivanov", "pass", "firma")
небыл перенесен на Exchange 2007, а находился на Exchange 2003.

Ошибка была вот такая:

The operation failed.Exchange Web Services are not currently available for this mailbox because it could not determine the Client Access Services Server to use for the mailbox.ErrorProxyServiceDiscoveryFailed0
...
Рейтинг: 0 / 0
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / Exchange 2007 Web Services / 2 сообщений из 2, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]