コード例 #1
0
        // Token: 0x060019C5 RID: 6597 RVA: 0x0005BCD0 File Offset: 0x00059ED0
        private CalendarItem BindToItem(ItemId itemId)
        {
            StoreId id;

            try
            {
                id = StoreId.EwsIdToStoreObjectId(itemId.Id);
            }
            catch (InvalidIdMalformedException ex)
            {
                base.LogAndTraceError(string.Format("[GetCalendarItem] Invalid itemId '{0}' - exception: {1}", itemId.Id, UcwaConfigurationUtilities.BuildFailureLogString(ex)));
                return(null);
            }
            CalendarItem result = null;

            try
            {
                ExTraceGlobals.OnlineMeetingTracer.TraceInformation <string>(0, 0L, "[CreateOnlineMeeting.GetCalendarItem] Trying to bind to item with provided ItemId '{0}'", itemId.Id);
                result = CalendarItem.Bind(this.MailboxSession, id);
            }
            catch (ArgumentException ex2)
            {
                base.LogAndTraceError(string.Format("[GetCalendarItem] Unable to bind to item with provided ItemId '{0}'; Exception: {1}", itemId.Id, UcwaConfigurationUtilities.BuildFailureLogString(ex2)));
            }
            catch (ObjectNotFoundException ex3)
            {
                base.LogAndTraceError(string.Format("[GetCalendarItem] Unable to find item with provided ItemId '{0}'; Exception: {1}", itemId.Id, UcwaConfigurationUtilities.BuildFailureLogString(ex3)));
            }
            return(result);
        }
コード例 #2
0
        protected override void OnPreRender(EventArgs e)
        {
            NameValueCollection queryString = this.Context.Request.QueryString;

            if (!base.UseSetObject)
            {
                string text = null;
                if (!string.IsNullOrEmpty(queryString["id"]))
                {
                    text = queryString["id"];
                }
                else if (!string.IsNullOrEmpty(queryString["ewsid"]))
                {
                    string id = queryString["ewsid"].Replace(' ', '+');
                    text = StoreId.EwsIdToStoreObjectId(id).ToBase64String();
                }
                if (!string.IsNullOrEmpty(text))
                {
                    this.ruleObj = this.GetMessageInfo(text);
                }
                if (!base.UseSetObject && !string.IsNullOrEmpty(queryString["tplNames"]))
                {
                    this.templatePhraseNames = this.GetTemplatePhraseNameArray(queryString["tplNames"]);
                }
            }
            if (this.ruleObj != null && this.templatePhraseNames != null)
            {
                throw new BadRequestException(new Exception("Both Contextual and Template mode are not supported together."));
            }
            base.OnPreRender(e);
        }
コード例 #3
0
 private void CheckResultsOfGetFolder()
 {
     foreach (GetFolderRequest getFolderRequest in this.getFolderRequests)
     {
         BaseQuery query = getFolderRequest.Query;
         if (string.IsNullOrEmpty(getFolderRequest.ResultFolderId))
         {
             GetFolderAndProxyRequest.GetFolderRequestTracer.TraceDebug <object, EmailAddress>((long)this.GetHashCode(), "{0}: No ResultFolderId returned for mailbox {1}.", TraceContext.Get(), query.Email);
         }
         else
         {
             StoreObjectId storeObjectId      = StoreId.EwsIdToStoreObjectId(getFolderRequest.ResultFolderId);
             StoreObjectId associatedFolderId = query.RecipientData.AssociatedFolderId;
             if (!associatedFolderId.Equals(storeObjectId))
             {
                 GetFolderAndProxyRequest.GetFolderRequestTracer.TraceDebug((long)this.GetHashCode(), "{0}: Requested folder id {2} doesn't match default folder id {3} for mailbox {1}.", new object[]
                 {
                     TraceContext.Get(),
                     query.Email,
                     associatedFolderId,
                     storeObjectId
                 });
                 query.SetResultOnFirstCall(base.Application.CreateQueryResult(new NotDefaultCalendarException()));
             }
         }
     }
 }
コード例 #4
0
        // Token: 0x0600199D RID: 6557 RVA: 0x0005A534 File Offset: 0x00058734
        internal static AttachmentIdType CreateAttachmentAndSendPendingGetNotification(UserContext userContext, string itemId, byte[] bytes, string name, CreateAttachmentNotificationPayload result, IdConverter idConverter, string channelId)
        {
            AttachmentIdType result2 = null;

            if (!userContext.IsDisposed)
            {
                AttachmentBuilder attachmentBuilder = null;
                try
                {
                    userContext.LockAndReconnectMailboxSession();
                    if (result.ResultCode == AttachmentResultCode.Success)
                    {
                        IdAndSession       idAndSession       = new IdAndSession(StoreId.EwsIdToStoreObjectId(itemId), userContext.MailboxSession);
                        FileAttachmentType fileAttachmentType = new FileAttachmentType
                        {
                            Content  = bytes,
                            IsInline = false,
                            Name     = name,
                            Size     = bytes.Length
                        };
                        AttachmentHierarchy attachmentHierarchy = new AttachmentHierarchy(idAndSession, true, true);
                        attachmentBuilder = new AttachmentBuilder(attachmentHierarchy, new AttachmentType[]
                        {
                            fileAttachmentType
                        }, idConverter, true);
                        ServiceError serviceError;
                        using (Attachment attachment = attachmentBuilder.CreateAttachment(fileAttachmentType, out serviceError))
                        {
                            if (serviceError == null)
                            {
                                attachmentHierarchy.SaveAll();
                            }
                            result.Response = CreateAttachmentHelper.CreateAttachmentResponse(attachmentHierarchy, attachment, fileAttachmentType, idAndSession, serviceError);
                        }
                        if (result.Response.ResponseMessages.Items != null && result.Response.ResponseMessages.Items.Length > 0 && result.Response.ResponseMessages.Items[0].ResponseCode == ResponseCodeType.NoError)
                        {
                            ((AttachmentInfoResponseMessage)result.Response.ResponseMessages.Items[0]).Attachments[0].Size = fileAttachmentType.Size;
                            result2 = CreateAttachmentHelper.GetAttachmentIdFromCreateAttachmentResponse(result.Response);
                        }
                    }
                    CreateAttachmentHelper.SendPendingGetNotification(userContext, result, channelId);
                }
                finally
                {
                    userContext.UnlockAndDisconnectMailboxSession();
                    if (attachmentBuilder != null)
                    {
                        attachmentBuilder.Dispose();
                    }
                }
            }
            return(result2);
        }
		internal static CreateAttachmentResponse AttachReferenceAttachment(AttachmentDataProvider attachmentDataProvider, UserContext userContext, string location, string dataProviderItemId, string parentItemId, IdConverter idConverter, string dataProviderParentItemId = null, string providerEndpointUrl = null)
		{
			CreateAttachmentResponse result = null;
			if (!userContext.IsDisposed)
			{
				if (string.IsNullOrEmpty(providerEndpointUrl))
				{
					providerEndpointUrl = attachmentDataProvider.GetEndpointUrlFromItemLocation(location);
				}
				string linkingUrl = attachmentDataProvider.GetLinkingUrl(userContext, location, providerEndpointUrl, dataProviderItemId, dataProviderParentItemId);
				string text = Path.GetFileName(HttpUtility.UrlDecode(linkingUrl));
				if (OneDriveProUtilities.IsDurableUrlFormat(text))
				{
					text = text.Substring(0, text.LastIndexOf("?", StringComparison.InvariantCulture));
				}
				try
				{
					userContext.LockAndReconnectMailboxSession();
					IdAndSession idAndSession = new IdAndSession(StoreId.EwsIdToStoreObjectId(parentItemId), userContext.MailboxSession);
					ReferenceAttachmentType referenceAttachmentType = new ReferenceAttachmentType
					{
						Name = text,
						AttachLongPathName = linkingUrl,
						ProviderEndpointUrl = providerEndpointUrl,
						ProviderType = attachmentDataProvider.Type.ToString()
					};
					if (!userContext.IsGroupUserContext)
					{
						referenceAttachmentType.ContentId = Guid.NewGuid().ToString();
						referenceAttachmentType.ContentType = "image/png";
					}
					AttachmentHierarchy attachmentHierarchy = new AttachmentHierarchy(idAndSession, true, true);
					using (AttachmentBuilder attachmentBuilder = new AttachmentBuilder(attachmentHierarchy, new AttachmentType[]
					{
						referenceAttachmentType
					}, idConverter, true))
					{
						ServiceError serviceError;
						Attachment attachment = attachmentBuilder.CreateAttachment(referenceAttachmentType, out serviceError);
						if (serviceError == null)
						{
							attachmentHierarchy.SaveAll();
						}
						result = CreateAttachmentHelper.CreateAttachmentResponse(attachmentHierarchy, attachment, referenceAttachmentType, idAndSession, serviceError);
					}
				}
				finally
				{
					userContext.UnlockAndDisconnectMailboxSession();
				}
			}
			return result;
		}
コード例 #6
0
 public static bool TryParse(string id, out EwsStoreObjectId ewsStoreObjectId)
 {
     ewsStoreObjectId = null;
     try
     {
         StoreId.EwsIdToStoreObjectId(id);
     }
     catch (InvalidIdMalformedException)
     {
         return(false);
     }
     catch (InvalidIdNotAnItemAttachmentIdException)
     {
         return(false);
     }
     ewsStoreObjectId = new EwsStoreObjectId(id);
     return(true);
 }
コード例 #7
0
 public virtual StoreObjectId ToStoreObjectId(string id)
 {
     return(StoreId.EwsIdToStoreObjectId(id));
 }
コード例 #8
0
 // Token: 0x06000E82 RID: 3714 RVA: 0x00036E28 File Offset: 0x00035028
 public void SubscribeToRowNotification(string subscriptionId, SubscriptionParameters parameters, ExTimeZone timeZone, CallContext callContext, bool remoteSubscription)
 {
     if (parameters == null)
     {
         throw new ArgumentNullException("parameters");
     }
     if (parameters.FolderId == null)
     {
         throw new OwaInvalidOperationException("Folder Id must be specified when subscribing to row notifications");
     }
     if (subscriptionId == null)
     {
         throw new ArgumentNullException("subscriptionId");
     }
     if (timeZone == null)
     {
         throw new ArgumentNullException("timeZone");
     }
     lock (this.syncRoot)
     {
         if (!this.isDisposed)
         {
             ExTraceGlobals.NotificationsCallTracer.TraceDebug <UserContextKey, string, string>((long)this.GetHashCode(), "[OwaMapiNotificationManager::SubscribeToRowNotification] START userContextKey: {0} SubscriptionId: {1} ChannelId: {2}", this.userContext.Key, subscriptionId, parameters.ChannelId);
             RowNotificationHandler rowNotificationHandler = null;
             this.rowNotificationHandlerCache.TryGetHandler(subscriptionId, out rowNotificationHandler);
             if (rowNotificationHandler == null)
             {
                 StoreObjectId storeObjectId = StoreId.EwsIdToStoreObjectId(parameters.FolderId);
                 if (storeObjectId == null)
                 {
                     throw new OwaInvalidOperationException("Invalid Folder Id. Could not be converted to a storeFolderId");
                 }
                 if (parameters.NotificationType == NotificationType.CalendarItemNotification)
                 {
                     rowNotificationHandler = new CalendarItemNotificationHandler(subscriptionId, parameters, storeObjectId, this.userContext, this.userContext.ExchangePrincipal.MailboxInfo.MailboxGuid, timeZone, remoteSubscription);
                 }
                 else if (parameters.NotificationType == NotificationType.PeopleIKnowNotification)
                 {
                     rowNotificationHandler = new PeopleIKnowRowNotificationHandler(subscriptionId, parameters, storeObjectId, this.userContext, this.userContext.ExchangePrincipal.MailboxInfo.MailboxGuid, timeZone, callContext.ClientCulture);
                 }
                 else if (parameters.IsConversation)
                 {
                     UserContext fullUserContext = this.GetFullUserContext("Conversation row notification");
                     rowNotificationHandler = new ConversationRowNotificationHandler(subscriptionId, parameters, storeObjectId, this.userContext, this.userContext.ExchangePrincipal.MailboxInfo.MailboxGuid, timeZone, remoteSubscription, fullUserContext.FeaturesManager);
                 }
                 else
                 {
                     UserContext fullUserContext2 = this.GetFullUserContext("MessageItem row notification");
                     rowNotificationHandler = new MessageItemRowNotificationHandler(subscriptionId, parameters, storeObjectId, this.userContext, this.userContext.ExchangePrincipal.MailboxInfo.MailboxGuid, timeZone, fullUserContext2.FeaturesManager);
                 }
                 try
                 {
                     ExTraceGlobals.NotificationsCallTracer.TraceDebug <UserContextKey, string, string>((long)this.GetHashCode(), "[OwaMapiNotificationManager::SubscribeToRowNotification] userContextKey: {0} New subscription for subscriptionId: {1} ChannelId: {2}", this.userContext.Key, subscriptionId, parameters.ChannelId);
                     this.WireConnectionDroppedHandler(rowNotificationHandler);
                     rowNotificationHandler.Subscribe();
                     rowNotificationHandler.OnBeforeDisposed += this.BeforeDisposeRowNotificationHandler;
                     this.rowNotificationHandlerCache.AddHandler(subscriptionId, rowNotificationHandler, parameters.ChannelId);
                     rowNotificationHandler = null;
                     goto IL_319;
                 }
                 finally
                 {
                     if (rowNotificationHandler != null)
                     {
                         try
                         {
                             this.userContext.LockAndReconnectMailboxSession(3000);
                             rowNotificationHandler.Dispose();
                             rowNotificationHandler = null;
                         }
                         catch (OwaLockTimeoutException ex)
                         {
                             ExTraceGlobals.NotificationsCallTracer.TraceError <string>((long)this.GetHashCode(), "[OwaMapiNotificationManager::SubscribeToRowNotification] User context lock timed out in attempt to dispose handler. Exception: {0}", ex.Message);
                         }
                         finally
                         {
                             if (this.userContext.MailboxSessionLockedByCurrentThread())
                             {
                                 this.userContext.UnlockAndDisconnectMailboxSession();
                             }
                         }
                     }
                 }
             }
             ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), "[OwaMapiNotificationManager::SubscribeToRowNotification] userContextKey: {0} Reusing existing notification handler subscriptionId: {1} ChannelId: {2} Current RefCount: {3}. Setting MissedNotifications = false", new object[]
             {
                 this.userContext.Key,
                 subscriptionId,
                 parameters.ChannelId,
                 rowNotificationHandler.RefCount
             });
             rowNotificationHandler.MissedNotifications = false;
             if (rowNotificationHandler.NeedToReinitSubscriptions)
             {
                 ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), "[OwaMapiNotificationManager::SubscribeToRowNotification] userContextKey: {0} Need to re-init subscriptionId: {1} ChannelId: {2} Refcount: {3}", new object[]
                 {
                     this.userContext.Key,
                     subscriptionId,
                     parameters.ChannelId,
                     rowNotificationHandler.RefCount
                 });
                 rowNotificationHandler.Subscribe();
             }
             this.rowNotificationHandlerCache.AddHandler(subscriptionId, rowNotificationHandler, parameters.ChannelId);
         }
         IL_319 :;
     }
 }
コード例 #9
0
        private SortedResultPage ConvertToPreviewItems(SearchPreviewItem[] ewsPreviewItems)
        {
            if (ewsPreviewItems == null)
            {
                return(new SortedResultPage(new PreviewItem[0], base.PagingInfo));
            }
            List <PreviewItem> list = new List <PreviewItem>(ewsPreviewItems.Length);

            foreach (SearchPreviewItem searchPreviewItem in ewsPreviewItems)
            {
                try
                {
                    MailboxId   mailboxId;
                    VersionedId value       = WebServiceMailboxSearchGroup.EwsIdToVersionedId(searchPreviewItem.Id.UniqueId, searchPreviewItem.Id.ChangeKey, out mailboxId);
                    MailboxInfo mailboxInfo = this.FindMailboxInfoByAnyIdentifier(searchPreviewItem, searchPreviewItem.Mailbox.MailboxId, mailboxId.MailboxGuid, null);
                    if (mailboxInfo == null)
                    {
                        throw new WebServiceProxyInvalidResponseException(Strings.InvalidUnknownMailboxInPreviewResult(this.Uri.AbsoluteUri, searchPreviewItem.Mailbox.MailboxId, mailboxId.MailboxGuid));
                    }
                    Dictionary <PropertyDefinition, object> dictionary = new Dictionary <PropertyDefinition, object>();
                    dictionary.Add(ItemSchema.Id, value);
                    dictionary.Add(StoreObjectSchema.ParentItemId, StoreId.EwsIdToStoreObjectId(searchPreviewItem.ParentId.UniqueId));
                    dictionary.Add(StoreObjectSchema.ItemClass, searchPreviewItem.ItemClass);
                    dictionary.Add(MessageItemSchema.SenderDisplayName, searchPreviewItem.Sender);
                    dictionary.Add(ItemSchema.DisplayTo, this.GetSemicolonSeparated(searchPreviewItem.ToRecipients));
                    dictionary.Add(ItemSchema.DisplayCc, this.GetSemicolonSeparated(searchPreviewItem.CcRecipients));
                    dictionary.Add(ItemSchema.DisplayBcc, this.GetSemicolonSeparated(searchPreviewItem.BccRecipients));
                    dictionary.Add(StoreObjectSchema.CreationTime, WebServiceMailboxSearchGroup.CreateExDateTime(base.PagingInfo.TimeZone, searchPreviewItem.CreatedTime, this));
                    dictionary.Add(ItemSchema.ReceivedTime, WebServiceMailboxSearchGroup.CreateExDateTime(base.PagingInfo.TimeZone, searchPreviewItem.ReceivedTime, this));
                    dictionary.Add(ItemSchema.SentTime, WebServiceMailboxSearchGroup.CreateExDateTime(base.PagingInfo.TimeZone, searchPreviewItem.SentTime, this));
                    dictionary.Add(ItemSchema.Subject, searchPreviewItem.Subject);
                    dictionary.Add(ItemSchema.Size, (int)searchPreviewItem.Size);
                    dictionary.Add(ItemSchema.Importance, searchPreviewItem.Importance.ToString());
                    dictionary.Add(MessageItemSchema.IsRead, searchPreviewItem.Read);
                    dictionary.Add(ItemSchema.HasAttachment, searchPreviewItem.HasAttachment);
                    if (searchPreviewItem.OwaLink == null)
                    {
                        Factory.Current.GeneralTracer.TraceError <Guid, string, string>((long)this.GetHashCode(), "Correlation Id:{0}. Null OWA URI in item with Id {1} in mailbox {2}", base.ExecutingUser.QueryCorrelationId, searchPreviewItem.Id.UniqueId, searchPreviewItem.Mailbox.PrimarySmtpAddress);
                        throw new WebServiceProxyInvalidResponseException(Strings.InvalidOwaUrlInPreviewResult(string.Format("EDiscoveryError:E002::Mailbox:{0}::Item:{1}::", searchPreviewItem.Mailbox.PrimarySmtpAddress, searchPreviewItem.Subject), this.Uri.AbsoluteUri));
                    }
                    PreviewItem item = new PreviewItem(dictionary, mailboxInfo.MailboxGuid.Equals(Guid.Empty) ? Guid.Parse(mailboxId.MailboxGuid) : mailboxInfo.MailboxGuid, new Uri(searchPreviewItem.OwaLink), this.GetReferenceItem(searchPreviewItem.SortValue), this.GetUniqueItemHash(searchPreviewItem.UniqueHash))
                    {
                        MailboxInfo = mailboxInfo
                    };
                    list.Add(item);
                }
                catch (InvalidIdMalformedException ex)
                {
                    Factory.Current.GeneralTracer.TraceError((long)this.GetHashCode(), "Correlation Id:{0}. Error processing item with Id {1} in mailbox {2}: {3}", new object[]
                    {
                        base.ExecutingUser.QueryCorrelationId,
                        searchPreviewItem.Id.UniqueId,
                        searchPreviewItem.Mailbox.PrimarySmtpAddress,
                        ex.ToString()
                    });
                    throw new WebServiceProxyInvalidResponseException(Strings.InvalidIdInPreviewResult(this.Uri.AbsoluteUri), ex);
                }
                catch (UriFormatException ex2)
                {
                    Factory.Current.GeneralTracer.TraceError((long)this.GetHashCode(), "Correlation Id:{0}. Invalid OWA URI in item with Id {1} in mailbox {2}: {3}", new object[]
                    {
                        base.ExecutingUser.QueryCorrelationId,
                        searchPreviewItem.Id.UniqueId,
                        searchPreviewItem.Mailbox.PrimarySmtpAddress,
                        ex2.ToString()
                    });
                    throw new WebServiceProxyInvalidResponseException(Strings.InvalidOwaUrlInPreviewResult(string.Format("EDiscoveryError:E002::Mailbox:{0}::Item:{1}::", searchPreviewItem.Mailbox.PrimarySmtpAddress, searchPreviewItem.Subject), this.Uri.AbsoluteUri), ex2);
                }
            }
            return(new SortedResultPage(list.ToArray(), base.PagingInfo));
        }
コード例 #10
0
 public CreateResendDraft(CallContext callContext, string ndrMessageId, string draftsFolderId) : base(callContext)
 {
     this.ndrMessageId  = StoreId.EwsIdToStoreObjectId(ndrMessageId);
     this.draftFolderId = StoreId.EwsIdToFolderStoreObjectId(draftsFolderId);
 }
コード例 #11
0
        // Token: 0x06001ACF RID: 6863 RVA: 0x0006569C File Offset: 0x0006389C
        public static WacAttachmentType Execute(CallContext callContext, IStoreSession originalAttachmentSession, IItem originalAttachmentItem, IAttachment originalAttachment, string draftId, string ewsAttachmentId, bool isEdit)
        {
            MdbCache.GetInstance().BeginAsyncUpdate();
            UserContext userContext = UserContextManager.GetUserContext(callContext.HttpContext, callContext.EffectiveCaller, true);

            if (userContext == null)
            {
                throw new OwaInvalidRequestException("Unable to determine user context.");
            }
            if (!userContext.IsWacEditingEnabled)
            {
                isEdit = false;
            }
            ConfigurationContext configurationContext = new ConfigurationContext(userContext);
            AttachmentPolicy     attachmentPolicy     = configurationContext.AttachmentPolicy;
            bool isPublicLogon = userContext.IsPublicLogon;

            if (!attachmentPolicy.GetWacViewingEnabled(isPublicLogon))
            {
                throw new OwaOperationNotSupportedException("WAC viewing not enabled for the current user");
            }
            MailboxSession mailboxSession = null;
            StoreObjectId  draftObjectId  = null;

            if (draftId != null)
            {
                IdAndSession idAndSession = GetWacAttachmentInfo.GetIdAndSession(callContext, draftId, false);
                mailboxSession = (idAndSession.Session as MailboxSession);
                draftObjectId  = StoreId.EwsIdToStoreObjectId(draftId);
                if (mailboxSession == null)
                {
                    throw new OwaOperationNotSupportedException("We need a MailboxSession to create the draft, but this a " + idAndSession.Session.GetType().Name);
                }
            }
            string text = originalAttachmentSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString();
            string primarySmtpAddress        = callContext.EffectiveCaller.PrimarySmtpAddress;
            RequestDetailsLogger protocolLog = callContext.ProtocolLog;

            protocolLog.Set(GetWacAttachmentInfoMetadata.LogonSmtpAddress, primarySmtpAddress);
            protocolLog.Set(GetWacAttachmentInfoMetadata.MailboxSmtpAddress, text);
            protocolLog.Set(GetWacAttachmentInfoMetadata.Edit, isEdit);
            protocolLog.Set(GetWacAttachmentInfoMetadata.Extension, originalAttachment.FileExtension);
            protocolLog.Set(GetWacAttachmentInfoMetadata.DraftProvided, draftId != null);
            string                 displayName = callContext.AccessingPrincipal.MailboxInfo.DisplayName;
            XSOFactory             factory     = new XSOFactory();
            AttachmentDataProvider defaultUploadDataProvider = new AttachmentDataProviderManager().GetDefaultUploadDataProvider(callContext);
            IReferenceAttachment   referenceAttachment       = originalAttachment as IReferenceAttachment;

            if (referenceAttachment != null)
            {
                GetWacAttachmentInfo.LogReferenceAttachmentProperties(protocolLog, referenceAttachment.ProviderEndpointUrl, GetWacAttachmentInfoMetadata.OriginalReferenceAttachmentServiceUrl, referenceAttachment.AttachLongPathName, GetWacAttachmentInfoMetadata.OriginalReferenceAttachmentUrl);
            }
            if (defaultUploadDataProvider != null)
            {
                protocolLog.Set(GetWacAttachmentInfoMetadata.AttachmentDataProvider, defaultUploadDataProvider.ToString());
            }
            WacAttachmentType wacAttachmentType;

            try
            {
                using (GetWacAttachmentInfo.Implementation implementation = new GetWacAttachmentInfo.Implementation(defaultUploadDataProvider, factory, originalAttachmentSession, originalAttachmentSession.MailboxOwner.ModernGroupType, originalAttachmentItem, originalAttachment, ewsAttachmentId, mailboxSession, draftObjectId, isEdit, displayName, (IStoreSession session, StoreId itemId, AttachmentId attachmentId) => new IdAndSession(itemId, (StoreSession)session)
                {
                    AttachmentIds =
                    {
                        attachmentId
                    }
                }.GetConcatenatedId().Id))
                {
                    implementation.Execute();
                    protocolLog.Set(GetWacAttachmentInfoMetadata.OriginalAttachmentType, implementation.OriginalAttachmentType);
                    protocolLog.Set(GetWacAttachmentInfoMetadata.ResultAttachmentType, implementation.ResultAttachmentType);
                    protocolLog.Set(GetWacAttachmentInfoMetadata.ResultAttachmentCreation, implementation.ResultAttachmentCreation);
                    if (implementation.ResultAttachmentType == AttachmentType.Reference)
                    {
                        IMailboxInfo mailboxInfo       = originalAttachmentSession.MailboxOwner.MailboxInfo;
                        string       mailboxAddress    = mailboxInfo.PrimarySmtpAddress.ToString();
                        StoreId      id                = originalAttachmentItem.Id;
                        BaseItemId   itemIdFromStoreId = IdConverter.GetItemIdFromStoreId(id, new MailboxId(mailboxInfo.MailboxGuid));
                        string       exchangeSessionId = WacUtilities.GetExchangeSessionId(default(Guid).ToString());
                        protocolLog.Set(GetWacAttachmentInfoMetadata.ExchangeSessionId, exchangeSessionId);
                        wacAttachmentType = GetWacAttachmentInfo.GetResultForReferenceAttachment(callContext, userContext, implementation, defaultUploadDataProvider, mailboxAddress, itemIdFromStoreId, originalAttachment.FileName, isEdit, displayName, exchangeSessionId, protocolLog);
                    }
                    else
                    {
                        if (implementation.ResultAttachmentType != AttachmentType.Stream)
                        {
                            throw new OwaNotSupportedException("Unsupported attachment type " + implementation.ResultAttachmentType);
                        }
                        AttachmentIdType ewsAttachmentIdType = GetWacAttachmentInfo.GetEwsAttachmentIdType(callContext, implementation.ResultItemId, implementation.ResultAttachmentId);
                        wacAttachmentType = GetWacAttachmentInfo.GetResultForStreamAttachment(callContext, userContext, configurationContext, attachmentPolicy, isPublicLogon, Thread.CurrentThread.CurrentCulture.Name, isEdit, (IStreamAttachment)implementation.ResultAttachment, implementation.ResultAttachmentExtension, ewsAttachmentIdType, implementation.ResultIsInDraft, implementation.ResultStoreSession, text, originalAttachmentSession.MailboxOwner.MailboxInfo.IsArchive);
                    }
                }
            }
            catch (ServerException exception)
            {
                wacAttachmentType = GetWacAttachmentInfo.HandleException(protocolLog, isEdit, exception, WacAttachmentStatus.UploadFailed);
            }
            catch (GetWacAttachmentInfo.AttachmentUploadException exception2)
            {
                wacAttachmentType = GetWacAttachmentInfo.HandleException(protocolLog, isEdit, exception2, WacAttachmentStatus.UploadFailed);
            }
            catch (RightsManagementPermanentException exception3)
            {
                wacAttachmentType = GetWacAttachmentInfo.HandleException(protocolLog, isEdit, exception3, WacAttachmentStatus.ProtectedByUnsupportedIrm);
            }
            catch (AttachmentProtectionException exception4)
            {
                wacAttachmentType = GetWacAttachmentInfo.HandleException(protocolLog, isEdit, exception4, WacAttachmentStatus.ProtectedByUnsupportedIrm);
            }
            catch (ObjectNotFoundException exception5)
            {
                wacAttachmentType = GetWacAttachmentInfo.HandleException(protocolLog, isEdit, exception5, WacAttachmentStatus.NotFound);
            }
            catch (OwaInvalidRequestException exception6)
            {
                wacAttachmentType = GetWacAttachmentInfo.HandleException(protocolLog, isEdit, exception6, WacAttachmentStatus.InvalidRequest);
            }
            catch (WacDiscoveryFailureException exception7)
            {
                wacAttachmentType = GetWacAttachmentInfo.HandleException(protocolLog, isEdit, exception7, WacAttachmentStatus.WacDiscoveryFailed);
            }
            catch (WebException exception8)
            {
                wacAttachmentType = GetWacAttachmentInfo.HandleException(protocolLog, isEdit, exception8, WacAttachmentStatus.AttachmentDataProviderError);
            }
            if (wacAttachmentType == null)
            {
                throw new OwaInvalidOperationException("There is no reason known for code to reach here without throwing an unhandled exception elsewhere");
            }
            protocolLog.Set(GetWacAttachmentInfoMetadata.Status, wacAttachmentType.Status.ToString());
            return(wacAttachmentType);
        }
コード例 #12
0
        // Token: 0x06000767 RID: 1895 RVA: 0x00029340 File Offset: 0x00027540
        protected override int InternalExecute(int count)
        {
            string[] array = HttpUtility.UrlDecode(base.FileReference).Split(new char[]
            {
                ':'
            });
            if (array.Length != 2)
            {
                throw new AirSyncPermanentException(StatusCode.Sync_TooManyFolders, false)
                      {
                          ErrorStringForProtocolLogger = "InvalidEntityAttachemtnId"
                      };
            }
            StoreObjectId itemId = StoreId.EwsIdToStoreObjectId(array[0]);
            IEvents       events = EntitySyncItem.GetEvents(this.CalendaringContainer, base.Session, itemId);

            if (events == null)
            {
                throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, false)
                      {
                          ErrorStringForProtocolLogger = "EventsNotFound"
                      };
            }
            IAttachments attachments = events[array[0]].Attachments;

            if (attachments == null)
            {
                throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, false)
                      {
                          ErrorStringForProtocolLogger = "EntityNotFound"
                      };
            }
            IAttachment attachment = attachments.Read(array[1], null);

            if (attachment == null)
            {
                throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, false)
                      {
                          ErrorStringForProtocolLogger = "EntityAttachementNotFound"
                      };
            }
            base.ContentType = attachment.ContentType;
            FileAttachment fileAttachment = attachment as FileAttachment;
            ItemAttachment itemAttachment = attachment as ItemAttachment;

            if (fileAttachment != null)
            {
                if (!base.MaxAttachmentSize.IsUnlimited && fileAttachment.Content.Length > (int)base.MaxAttachmentSize.Value.ToBytes())
                {
                    throw new DataTooLargeException(StatusCode.AttachmentIsTooLarge);
                }
                count = ((count == -1) ? fileAttachment.Content.Length : Math.Min(count, fileAttachment.Content.Length - base.MinRange));
                base.OutStream.Write(fileAttachment.Content, base.MinRange, count);
                return(count);
            }
            else
            {
                if (itemAttachment != null)
                {
                    int result;
                    AttachmentHelper.GetAttachment(base.Session, itemId, attachment.Id, base.OutStream, base.MinRange, count, base.MaxAttachmentSize, base.RightsManagementSupport, out result);
                    return(result);
                }
                throw new AirSyncPermanentException(StatusCode.Sync_InvalidWaitTime, new LocalizedString(string.Format("Attachment type \"{0}\" is not supported.", attachment.GetType().FullName)), false)
                      {
                          ErrorStringForProtocolLogger = "UnsupportedEntityAttachementType"
                      };
            }
        }
コード例 #13
0
 // Token: 0x0600047E RID: 1150 RVA: 0x0002029E File Offset: 0x0001E49E
 internal FolderTupleCrossServerArchive(Folder folder, FolderId folderId, FolderId parentId, string displayName, object[] extendedProps, bool isRoot) : base(StoreId.EwsIdToStoreObjectId(folderId.UniqueId), StoreId.EwsIdToStoreObjectId(parentId.UniqueId), displayName, extendedProps, isRoot)
 {
     this.ewsFolder   = folder;
     this.ewsFolderId = folderId;
     this.ewsParentId = parentId;
 }
コード例 #14
0
 // Token: 0x0600047D RID: 1149 RVA: 0x00020250 File Offset: 0x0001E450
 internal FolderTupleCrossServerArchive(Folder folder, FolderId folderId, FolderId parentId, string displayName, object[] extendedProps) : base((folderId != null) ? StoreId.EwsIdToStoreObjectId(folderId.UniqueId) : null, (parentId != null) ? StoreId.EwsIdToStoreObjectId(parentId.UniqueId) : null, displayName, extendedProps)
 {
     this.ewsFolder   = folder;
     this.ewsFolderId = folderId;
     this.ewsParentId = parentId;
 }
コード例 #15
0
 // Token: 0x06000484 RID: 1156 RVA: 0x0002035E File Offset: 0x0001E55E
 internal FolderTupleRemoteArchive(BaseFolderType folder, FolderIdType folderId, FolderIdType parentId, string displayName, object[] extendedProps, bool isRoot) : base(StoreId.EwsIdToStoreObjectId(folderId.Id), StoreId.EwsIdToStoreObjectId(parentId.Id), displayName, extendedProps, isRoot)
 {
     this.ewsFolder   = folder;
     this.ewsFolderId = folderId;
     this.ewsParentId = parentId;
 }
コード例 #16
0
 // Token: 0x06000483 RID: 1155 RVA: 0x00020310 File Offset: 0x0001E510
 internal FolderTupleRemoteArchive(BaseFolderType folder, FolderIdType folderId, FolderIdType parentId, string displayName, object[] extendedProps) : base((folderId != null) ? StoreId.EwsIdToStoreObjectId(folderId.Id) : null, (parentId != null) ? StoreId.EwsIdToStoreObjectId(parentId.Id) : null, displayName, extendedProps)
 {
     this.ewsFolder   = folder;
     this.ewsFolderId = folderId;
     this.ewsParentId = parentId;
 }