Partager via


ForwardItemType Class

The ForwardItemType class represents a forward item response object that is used to forward meeting messages to another recipient.

Inheritance Hierarchy

System.Object
  ExchangeWebServices.ItemType
    ExchangeWebServices.MessageType
      ExchangeWebServices.ResponseObjectCoreType
        ExchangeWebServices.ResponseObjectType
          ExchangeWebServices.SmartResponseBaseType
            ExchangeWebServices.SmartResponseType
              ExchangeWebServices.ForwardItemType

Namespace:  ExchangeWebServices
Assembly:  EWS (in EWS.dll)

Syntax

'Declaration
<SerializableAttribute> _
Public Class ForwardItemType _
    Inherits SmartResponseType
'Usage
Dim instance As ForwardItemType
[SerializableAttribute]
public class ForwardItemType : SmartResponseType

Remarks

The ReferenceItemId property must be set on the ForwardItemType object to identify the meeting message that is forwarded. ToRecipients, CcRecipients, or BccRecipients must be set to the recipients of the forwarded meeting message. One recipient must be set if the message is sent. You do not have to set a recipient if the message disposition is to save.

The following are the only properties that are valid for the ForwardItemType:

Examples

The following example shows you how to forward a meeting request to a single recipient and add content to the message body. The item identifier of the meeting request is used in the ReferenceItemId property.

static void ForwardItem(ExchangeServiceBinding esb)
{
    // Create the request.
    CreateItemType request = new CreateItemType();

    // Set the message disposition on the request.
    request.MessageDisposition = MessageDispositionType.SendAndSaveCopy;
    request.MessageDispositionSpecified = true;
    
    // Create the ForwardItem response object.
    ForwardItemType forwardItem = new ForwardItemType();
    forwardItem.ToRecipients = new EmailAddressType[1];
    forwardItem.ToRecipients[0] = new EmailAddressType();
    forwardItem.ToRecipients[0].EmailAddress=  "someone@example.com";
    forwardItem.NewBodyContent = new BodyType();
    forwardItem.NewBodyContent.BodyType1 = BodyTypeType.Text;
    forwardItem.NewBodyContent.Value = "You may want to attend this meeting.";

    // Identify the meeting request to forward.
    forwardItem.ReferenceItemId = new ItemIdType();
    forwardItem.ReferenceItemId.Id = "AAArAG1za2lubmVyQG1haW5lcmNvbnRvc28";
    forwardItem.ReferenceItemId.ChangeKey = "CwAAABYAAAAMoHzy8/QATr21q";

    // Add the ForwardItem response object to the request.
    request.Items = new NonEmptyArrayOfAllItemsType();
    request.Items.Items = new ItemType[1];
    request.Items.Items[0] = forwardItem;

    // Send the request and get the response.
    CreateItemResponseType response = esb.CreateItem(request);

    ArrayOfResponseMessagesType aormt = response.ResponseMessages;
    ResponseMessageType[] rmta = aormt.Items;

    foreach (ResponseMessageType rmt in rmta)
    {
        ItemInfoResponseMessageType iirmt = (rmt as ItemInfoResponseMessageType);
        if (iirmt.ResponseClass == ResponseClassType.Success)
        {
            Console.WriteLine("Successfully forwarded meeting.");
        }
    }
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.