// Token: 0x06001AD2 RID: 6866 RVA: 0x00065C5C File Offset: 0x00063E5C
        private static void PostUploadMessage(string groupAddress, string userAddress, string userDisplayName, BaseItemId referenceItemId, string fileName, string contentUrl, string providerType, string endpointUrl, string sessionId)
        {
            BodyContentType bodyContentType = new BodyContentType();

            bodyContentType.Value = string.Format(Strings.ModernGroupAttachmentUploadNoticeBody, fileName, userDisplayName);
            ReferenceAttachmentType referenceAttachmentType = new ReferenceAttachmentType();

            referenceAttachmentType.AttachLongPathName  = contentUrl;
            referenceAttachmentType.ProviderEndpointUrl = endpointUrl;
            referenceAttachmentType.ProviderType        = providerType;
            referenceAttachmentType.Name = fileName;
            ReplyToItemType replyToItemType = new ReplyToItemType();

            replyToItemType.NewBodyContent  = bodyContentType;
            replyToItemType.Attachments     = new AttachmentType[1];
            replyToItemType.Attachments[0]  = referenceAttachmentType;
            replyToItemType.ReferenceItemId = referenceItemId;
            PostModernGroupItemJsonRequest postModernGroupItemJsonRequest = new PostModernGroupItemJsonRequest();

            postModernGroupItemJsonRequest.Body       = new PostModernGroupItemRequest();
            postModernGroupItemJsonRequest.Body.Items = new NonEmptyArrayOfAllItemsType();
            postModernGroupItemJsonRequest.Body.Items.Add(replyToItemType);
            postModernGroupItemJsonRequest.Body.ModernGroupEmailAddress = new EmailAddressWrapper();
            postModernGroupItemJsonRequest.Body.ModernGroupEmailAddress.EmailAddress = groupAddress;
            postModernGroupItemJsonRequest.Body.ModernGroupEmailAddress.MailboxType  = MailboxHelper.MailboxTypeType.GroupMailbox.ToString();
            OWAService owaservice = new OWAService();

            GetWacAttachmentInfo.PostUploadMessageAsyncState postUploadMessageAsyncState = new GetWacAttachmentInfo.PostUploadMessageAsyncState();
            postUploadMessageAsyncState.MailboxSmtpAddress = groupAddress;
            postUploadMessageAsyncState.LogonSmtpAddress   = userAddress;
            postUploadMessageAsyncState.OwaService         = owaservice;
            postUploadMessageAsyncState.SessionId          = sessionId;
            IAsyncResult asyncResult = owaservice.BeginPostModernGroupItem(postModernGroupItemJsonRequest, null, null);

            asyncResult.AsyncWaitHandle.WaitOne();
            PostModernGroupItemResponse body = owaservice.EndPostModernGroupItem(asyncResult).Body;
        }
예제 #2
0
        /********************************************************************
          * 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
            }
        }