Exchange Web服务创建会议请求的工作示例 [英] Exchange Web Services Create Meeting Request Working Example

查看:44
本文介绍了Exchange Web服务创建会议请求的工作示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在任何地方都存在一个可行的示例,说明如何使用EWS for C 2007为Exchange 2007创建会议请求?需要哪些属性?我已经添加了Web服务参考,并且可以连接以创建和发送各种项目,但是仍然会收到错误消息设置操作对属性无效。在响应消息上。它永远不会说什么属性无效

Is there a working example anywhere of how to create a meeting request using EWS for Exchange 2007 using C#? Which properties are required? I have added a web service reference and can connect to create and send various items but keep getting the error "Set action is invalid for property." on the response messages. It never says what property is invalid

var ews = new ExchangeServiceBinding {
    Credentials = new NetworkCredential("user", "pass"),
    Url = "https://servername/ews/exchange.asmx", 
    RequestServerVersionValue = new RequestServerVersion {
        Version = ExchangeVersionType.Exchange2007}
};
var startDate = new DateTime(2010, 9, 18, 16, 00, 00);
var meeting = new CalendarItemType {
    IsMeeting = true,
    IsMeetingSpecified = true,
    Subject = "test EWS",
    Body = new BodyType {Value = "test body", BodyType1 = BodyTypeType.HTML},
    Start = startDate,
    StartSpecified = true,
    End = startDate.AddHours(1),
    EndSpecified = true,
    MeetingTimeZone = new TimeZoneType{
        TimeZoneName = TimeZone.CurrentTimeZone.StandardName, BaseOffset = "PT0H"},
    Location = "Meeting",
    RequiredAttendees = new [] {
        new AttendeeType{Mailbox =new EmailAddressType{
                         EmailAddress ="test1@domain.com",RoutingType = "SMTP"}},
        new AttendeeType{Mailbox =new EmailAddressType{
                         EmailAddress ="test2@domain.com",RoutingType = "SMTP"}}
    }
};
var request = new CreateItemType {
    SendMeetingInvitations =
        CalendarItemCreateOrDeleteOperationType.SendToAllAndSaveCopy,
    SendMeetingInvitationsSpecified = true,
    SavedItemFolderId = new TargetFolderIdType{Item = new DistinguishedFolderIdType{
                                        Id=DistinguishedFolderIdNameType.calendar}},
    Items = new NonEmptyArrayOfAllItemsType {Items = new ItemType[] {meeting}}
};
CreateItemResponseType response = ews.CreateItem(request);
var responseMessage = response.ResponseMessages.Items[0];

Microsoft在 http://msdn.microsoft.com/en-us/library/aa494190(EXCHG.140).aspx 消息项目的外观。仅设置这些属性似乎还不够。有人可以告诉我我所缺少的内容,还是可以向我指出一些更好的示例或文档?

Microsoft provides an XML example at http://msdn.microsoft.com/en-us/library/aa494190(EXCHG.140).aspx of what the message item should look like. Just setting these properties does not seem to be enough. Can someone tell me what I'm missing or point me to some better examples or documentation?

<CreateItem
       xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
       SendMeetingInvitations="SendToAllAndSaveCopy" >
  <SavedItemFolderId>
    <t:DistinguishedFolderId Id="calendar"/>
  </SavedItemFolderId>
  <Items>
    <t:CalendarItem>
      <t:Subject>Meeting with attendee0, attendee1, attendee2</t:Subject>
      <t:Body BodyType="Text">CalendarItem:TextBody</t:Body>
      <t:Start>2006-06-25T10:00:00Z</t:Start>
      <t:End>2006-06-25T11:00:00Z</t:End>
      <t:Location>CalendarItem:Location</t:Location>
      <t:RequiredAttendees>
        <t:Attendee>
          <t:Mailbox>
            <t:EmailAddress>attendee0@example.com</t:EmailAddress>
          </t:Mailbox>
        </t:Attendee>
        <t:Attendee>
          <t:Mailbox>
            <t:EmailAddress>attendee1@example.com</t:EmailAddress>
          </t:Mailbox>
        </t:Attendee>
      </t:RequiredAttendees>
      <t:OptionalAttendees>
        <t:Attendee>
          <t:Mailbox>
            <t:EmailAddress>attendee2@example.com</t:EmailAddress>
          </t:Mailbox>
        </t:Attendee>
      </t:OptionalAttendees>
      <t:Resources>
        <t:Attendee>
          <t:Mailbox>
            <t:EmailAddress>room0@example.com</t:EmailAddress>
          </t:Mailbox>
        </t:Attendee>
      </t:Resources>
    </t:CalendarItem>
  </Items>
</CreateItem>


推荐答案

这对您来说可能为时已晚,但这对于

This is probably too late for you, but this for anyone else trying this.

问题似乎出在提供Is-Specified参数。我删除了IsMeetingSpecified,该请求成功了。这是修改后的CalendarItemType。

The issue seems to be with providing the Is-Specified params. I deleted the IsMeetingSpecified and the request worked. Here's the revised CalendarItemType.

var meeting = new CalendarItemType
{
    IsMeeting = true,
    Subject = "test EWS",
    Body = new BodyType { Value = "test body", BodyType1 = BodyTypeType.HTML },
    Start = startDate,
    StartSpecified = true,
    End = startDate.AddHours(1),
    EndSpecified = true,
    MeetingTimeZone = new TimeZoneType
    {
        TimeZoneName = TimeZone.CurrentTimeZone.StandardName,
        BaseOffset = "PT0H"
    },
    Location = "Room 1",
    RequiredAttendees = new[] {
        new AttendeeType
        {
            Mailbox =new EmailAddressType
            {     
                EmailAddress ="test@test.com"
            }
        },
    }
};

这篇关于Exchange Web服务创建会议请求的工作示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆