/// <remarks/> public void CreateItemAsync(CreateItemType CreateItem1, object userState) { if ((this.CreateItemOperationCompleted == null)) { this.CreateItemOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateItemOperationCompleted); } this.InvokeAsync("CreateItem", new object[] { CreateItem1}, this.CreateItemOperationCompleted, userState); }
/******************************************************************** * REPLY AN EMAIL WITH THE ITEMID AND THE REPLYBODY ********************************************************************/ private static void Reply(String itemID, String replyBody) { ItemIdType iit = new ItemIdType(); iit.Id = itemID; CreateItemType request = new CreateItemType(); request.MessageDisposition = MessageDispositionType.SendAndSaveCopy; request.MessageDispositionSpecified = true; request.SavedItemFolderId = new TargetFolderIdType(); request.SavedItemFolderId.Item = new DistinguishedFolderIdType(); (request.SavedItemFolderId.Item as DistinguishedFolderIdType).Id = DistinguishedFolderIdNameType.sentitems; ReplyToItemType reply = new ReplyToItemType(); // Id of the message to which to reply reply.ReferenceItemId = iit; reply.NewBodyContent = new LogicLayer.ExchangeWebServices.BodyType(); reply.NewBodyContent.BodyType1 = BodyTypeType.HTML; reply.NewBodyContent.Value = replyBody; // Set additional properties on the reply object if you wish... CreateItemResponseType response = service.CreateItem(request); if (response.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Success) { // Success, the reply was sent and saved in the SentItems folder. // NB: Since sending a message is an asynchronous operation, NO ITEM ID IS RETURNED. // To obtain the Id of the reply message, set the MessageDisposition flag above to SaveOnly. // The Id can be found in the response: // ItemIdType replyId = ((ItemInfoResponseMessageType)response.ResponseMessages.Items[0]).Items.Items[0].ItemId; // You can then call SendItem to send the message. } else { // An error has occurred } }
/// <remarks/> public void CreateItemAsync(CreateItemType CreateItem1) { this.CreateItemAsync(CreateItem1, null); }