// Token: 0x060010AA RID: 4266 RVA: 0x0005CE4C File Offset: 0x0005B04C protected ConversionException(SerializationInfo info, StreamingContext context) : base(info, context) { AirSyncDiagnostics.TraceError(ExTraceGlobals.CommonTracer, this, "ConversionException is being deserialized"); this.httpStatusCode = (HttpStatusCode)info.GetValue("httpStatusCode", typeof(HttpStatusCode)); this.airSyncStatusCode = (int)info.GetValue("airSyncStatusCode", typeof(int)); this.httpStatusCodeIsSet = (bool)info.GetValue("isHttpStatusCodeSet", typeof(bool)); }
public static string LookupEmailAddressString(Participant participant, IExchangePrincipal exchangePrincipal, bool addBrackets) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.CommonTracer, null, "Calling EmailAddressConverter.LookupEmailAddressString()"); if (null == participant) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.CommonTracer, null, "participant is null."); throw new ArgumentNullException("participant null"); } if (exchangePrincipal == null) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.CommonTracer, null, "value of exchange principal is null."); throw new ArgumentNullException("exchangePrincipal null"); } if (string.IsNullOrEmpty(participant.EmailAddress)) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.CommonTracer, null, "participant's emailAddress is null. Returning Display name instead."); return(EmailAddressConverter.AddBrackets(participant.DisplayName, "<{0}>", addBrackets)); } if (participant.RoutingType == "EX") { Participant cachedParticipant = EmailAddressConverter.GetCachedParticipant(participant.EmailAddress); if (cachedParticipant != null) { participant = cachedParticipant; } } if (participant.RoutingType == "SMTP") { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.CommonTracer, null, "participant's is already of Routing Type SMTP. return participant's email address."); return(EmailAddressConverter.AddBrackets(participant.EmailAddress, "<{0}>", addBrackets)); } Participant participant2 = null; try { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.CommonTracer, null, "Fetching SmtpAddress property from MAPI"); object obj = participant.TryGetProperty(ParticipantSchema.SmtpAddress); if (obj != null && obj is string) { return(EmailAddressConverter.AddBrackets((string)obj, "<{0}>", addBrackets)); } AirSyncDiagnostics.TraceDebug(ExTraceGlobals.CommonTracer, null, "calling TryConveryTo to convert Participant to SMTP"); participant2 = EmailAddressConverter.DoADLookup(exchangePrincipal, participant); } catch (StoragePermanentException) { AirSyncDiagnostics.TraceError(ExTraceGlobals.CommonTracer, null, "StorePermanentException during ADLookUp while converting Participant to SMTP"); } if (participant2 != null) { AirSyncDiagnostics.TraceDebug <string, string>(ExTraceGlobals.CommonTracer, null, "Convert to SMTP successful. Returned EmailAddress {0} , Format {1}", participant2.EmailAddress, "<{0}>"); if (participant.RoutingType == "EX") { EmailAddressConverter.CacheParticipant(participant.EmailAddress, participant2); } return(EmailAddressConverter.AddBrackets(participant2.EmailAddress, "<{0}>", addBrackets)); } AirSyncDiagnostics.TraceDebug <string, string, string>(ExTraceGlobals.CommonTracer, null, "Could not convert participant to SMTP routing type. Returned RoutingType:{0}, EmailAddress:{1} and Format: {2}", participant.RoutingType, participant.EmailAddress, "[{0}]"); return(EmailAddressConverter.AddBrackets(participant.RoutingType + ":" + participant.EmailAddress, "[{0}]", addBrackets)); }
// Token: 0x060013D3 RID: 5075 RVA: 0x00072048 File Offset: 0x00070248 protected virtual void InternalSetToDefault(IProperty srcProperty) { if (this.PropertyDef is NativeStorePropertyDefinition) { try { this.XsoItem.DeleteProperties(new PropertyDefinition[] { this.PropertyDef }); } catch (NotSupportedException ex) { AirSyncDiagnostics.TraceError(ExTraceGlobals.XsoTracer, this, "Error trying to delete properties in XsoProperty.InternalSetToDefault\r\nType of XsoProperty: {0}\r\nType of XsoItem: {1}\r\nClass of XsoItem: {2}\r\nPropertyDef: {3}\r\nError: {4}", new object[] { base.GetType(), this.XsoItem.GetType(), this.XsoItem.ClassName, this.PropertyDef, ex }); throw; } } }
// Token: 0x06001479 RID: 5241 RVA: 0x00076460 File Offset: 0x00074660 private MessageItem CreateSubstituteDelegatedMeetingRequestMessage() { MessageItem messageItem = null; bool flag = false; try { MeetingMessage meetingMessage = base.XsoItem as MeetingMessage; messageItem = MessageItem.CreateInMemory(StoreObjectSchema.ContentConversionProperties); if (messageItem == null) { AirSyncDiagnostics.TraceError(ExTraceGlobals.XsoTracer, null, "CreateSubstituteDelegatedMeetingRequestMessage failed to create in memory message item"); return(null); } Item.CopyItemContent(meetingMessage, messageItem); messageItem.ClassName = "IPM.Note"; messageItem.AttachmentCollection.RemoveAll(); int num = meetingMessage.Body.PreviewText.IndexOf("*~*~*~*~*~*~*~*~*~*"); string value; if (num == -1) { ExTimeZone promotedTimeZoneFromItem = TimeZoneHelper.GetPromotedTimeZoneFromItem(meetingMessage); value = CalendarItemBase.CreateWhenStringForBodyPrefix(meetingMessage, promotedTimeZoneFromItem); } else { value = meetingMessage.Body.PreviewText.Substring(0, num + "*~*~*~*~*~*~*~*~*~*".Length); } using (TextWriter textWriter = messageItem.Body.OpenTextWriter(BodyFormat.TextPlain)) { textWriter.Write(value); } } catch (Exception ex) { AirSyncDiagnostics.TraceError <string>(ExTraceGlobals.XsoTracer, null, "CreateSubstituteDelegatedMeetingRequestMessage: exception thrown: {0}", ex.Message); if (messageItem != null) { flag = true; } throw; } finally { if (flag) { messageItem.Dispose(); messageItem = null; } } return(messageItem); }
protected override void InternalCopyFromModified(IProperty srcProperty) { Item item = base.XsoItem as Item; if (item == null) { AirSyncDiagnostics.TraceError(ExTraceGlobals.RequestsTracer, null, "XSO16AttachmentProperty:InternalCopyFromModified. msgItem can not be null."); throw new UnexpectedTypeException("Item", base.XsoItem); } IAttachments12Property attachments12Property = srcProperty as IAttachments12Property; if (attachments12Property == null) { throw new UnexpectedTypeException("IAttachments12Property", srcProperty); } new List <IAttachment>(attachments12Property.Count); List <string> list = new List <string>(); foreach (Attachment12Data attachment12Data in attachments12Property) { Attachment16Data attachment16Data = attachment12Data as Attachment16Data; if (attachment16Data == null) { throw new UnexpectedTypeException("Attachment16Data", attachment12Data); } if (attachment16Data.ChangeType == AttachmentAction.Delete) { list.Add(attachment16Data.FileReference); } } if (list.Count > 0) { AttachmentHelper.DeleteAttachments(item, list); } foreach (Attachment12Data attachment12Data2 in attachments12Property) { Attachment16Data attachment16Data2 = attachment12Data2 as Attachment16Data; if (attachment16Data2 == null) { throw new UnexpectedTypeException("Attachment16Data", attachment12Data2); } if (attachment16Data2.ChangeType == AttachmentAction.Add) { AttachmentHelper.CreateAttachment(item, attachment16Data2); } } }
private string RetrieveOrganizerInfo(Item item) { if (item == null) { AirSyncDiagnostics.TraceError(ExTraceGlobals.XsoTracer, this, "Organizer could not be set. No item found."); return(null); } string text = null; string text2 = null; string text3 = null; try { text = item.GetValueOrDefault <string>(CalendarItemBaseSchema.OrganizerEmailAddress); AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.XsoTracer, this, "OrganizerEmailAddress: {0}", text); text2 = item.GetValueOrDefault <string>(CalendarItemBaseSchema.OrganizerType); AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.XsoTracer, this, "OrganizerType: {0}", text2); text3 = item.GetValueOrDefault <string>(CalendarItemBaseSchema.OrganizerDisplayName); AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.XsoTracer, this, "OrganizerDisplayName: {0}", text3); } catch (PropertyErrorException ex) { AirSyncDiagnostics.TraceError <string>(ExTraceGlobals.XsoTracer, this, "PropertyErrorException retrieving Organizer info: {0}", ex.Message); } if (string.IsNullOrEmpty(text)) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.XsoTracer, this, "Organizer could not be set. OrganizerEmailAddress could not be retrieved"); return(null); } if (SmtpAddress.IsValidSmtpAddress(text) && !string.Equals(text2, "SMTP".ToString(), StringComparison.InvariantCultureIgnoreCase)) { AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.XsoTracer, this, "Meeting Request Organizer Type is invalid: OrganizerType:{0}. Defaulting to Smtp RoutingType", text2); text2 = "SMTP".ToString(); } Participant participant = new Participant(text3, text, text2); string participantString = EmailAddressConverter.GetParticipantString(participant, item.Session.MailboxOwner); AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.XsoTracer, this, "Meeting Request Organizer: {0}", participantString); return(participantString); }
// Token: 0x06001875 RID: 6261 RVA: 0x0008F8F8 File Offset: 0x0008DAF8 public void CopyStream(Stream outputStream) { if (this.stream == null) { return; } if (this.stream.CanSeek) { this.stream.Seek(0L, SeekOrigin.Begin); } else { AirSyncDiagnostics.TraceError <Type>(ExTraceGlobals.ConversionTracer, this, "this.streamis of {0} type.", this.stream.GetType()); } AirSyncStream airSyncStream = this.stream as AirSyncStream; if (airSyncStream != null) { airSyncStream.CopyStream(outputStream, (int)this.StreamDataSize); return; } StreamHelper.CopyStream(this.stream, outputStream, (int)this.StreamDataSize); }
// Token: 0x060010A5 RID: 4261 RVA: 0x0005CD84 File Offset: 0x0005AF84 public ConversionException(HttpStatusCode httpStatusCode, string message, Exception innerException) : base(new LocalizedString(message), innerException) { AirSyncDiagnostics.TraceError <HttpStatusCode, string, string>(ExTraceGlobals.CommonTracer, this, "ConversionException has been thrown. HttpStatusCode:'{0}', Message:'{1}', InnerException: '{2}'", httpStatusCode, (message != null) ? message : string.Empty, (innerException != null) ? innerException.Message : string.Empty); this.httpStatusCode = httpStatusCode; this.httpStatusCodeIsSet = true; }
public Stream GetData(BodyType type, long truncationSize, out long totalDataSize, out IEnumerable <AirSyncAttachmentInfo> attachments) { Item item = base.XsoItem as Item; attachments = null; if (item == null) { totalDataSize = 0L; return(null); } Stream stream; if (string.Equals(item.ClassName, "IPM.Note.SMIME", StringComparison.OrdinalIgnoreCase) && truncationSize != 0L) { string smimenotSupportedBodyHtml = XsoBodyPartProperty.GetSMIMENotSupportedBodyHtml(item.Session); stream = new MemoryStream(Encoding.UTF8.GetBytes(smimenotSupportedBodyHtml)); totalDataSize = stream.Length; return(stream); } switch (type) { case BodyType.None: case BodyType.PlainText: case BodyType.Rtf: case BodyType.Mime: throw new ConversionException(string.Format("Invalid body type requested: {0}", type)); case BodyType.Html: { ConversationId valueOrDefault = item.GetValueOrDefault <ConversationId>(ItemSchema.ConversationId, null); if (valueOrDefault == null) { throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, null, false) { ErrorStringForProtocolLogger = "NoConversationIdForItem" }; } Conversation conversation; bool orCreateConversation = Command.CurrentCommand.GetOrCreateConversation(valueOrDefault, true, out conversation); if (conversation == null) { throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, null, false) { ErrorStringForProtocolLogger = "ConversationObjectLoadFailedForItem" }; } if (orCreateConversation) { conversation.LoadItemParts(new List <StoreObjectId> { item.StoreObjectId }); } IConversationTreeNode conversationTreeNode = null; if (!conversation.ConversationTree.TryGetConversationTreeNode(item.StoreObjectId, out conversationTreeNode)) { AirSyncDiagnostics.TraceError <StoreObjectId>(ExTraceGlobals.AirSyncTracer, this, "Cannot find itemId {0} in conversation tree!", item.StoreObjectId); totalDataSize = 0L; return(null); } bool flag = false; AirSyncDiagnostics.FaultInjectionTracer.TraceTest <bool>(3970313533U, ref flag); if (flag) { totalDataSize = 0L; return(null); } ItemPart itemPart = conversation.GetItemPart(item.StoreObjectId); if (!itemPart.DidLoadSucceed) { AirSyncDiagnostics.TraceError(ExTraceGlobals.AirSyncTracer, this, "ItemPart.DidLoadSucceed is false!"); stream = null; totalDataSize = 0L; return(stream); } using (AirSyncStream airSyncStream = new AirSyncStream()) { try { using (HtmlWriter htmlWriter = new HtmlWriter(airSyncStream, Encoding.UTF8)) { itemPart.WriteUniquePart(htmlWriter); htmlWriter.Flush(); } } catch (TextConvertersException innerException) { throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, null, innerException, false); } airSyncStream.Seek(0L, SeekOrigin.Begin); stream = new AirSyncStream(); uint streamHash; StreamHelper.CopyStream(airSyncStream, stream, Encoding.UTF8, (int)truncationSize, true, out streamHash); ((AirSyncStream)stream).StreamHash = (int)streamHash; totalDataSize = ((truncationSize < 0L || airSyncStream.Length < truncationSize) ? stream.Length : airSyncStream.Length); Dictionary <AttachmentId, AirSyncAttachmentInfo> dictionary = null; if (itemPart.Attachments != null && itemPart.Attachments.Count > 0) { dictionary = itemPart.Attachments.ToDictionary((AttachmentInfo x) => x.AttachmentId, (AttachmentInfo x) => new AirSyncAttachmentInfo { AttachmentId = x.AttachmentId, IsInline = x.IsInline, ContentId = x.ContentId }); } Dictionary <AttachmentId, string> dictionary2; Command.CurrentCommand.InlineAttachmentContentIdLookUp.TryGetValue(item.Id.ObjectId, out dictionary2); if (dictionary2 != null) { if (dictionary != null) { foreach (KeyValuePair <AttachmentId, string> keyValuePair in dictionary2) { AirSyncAttachmentInfo airSyncAttachmentInfo; if (dictionary.TryGetValue(keyValuePair.Key, out airSyncAttachmentInfo) && airSyncAttachmentInfo != null) { airSyncAttachmentInfo.IsInline = true; airSyncAttachmentInfo.ContentId = keyValuePair.Value; } else { dictionary[keyValuePair.Key] = new AirSyncAttachmentInfo { AttachmentId = keyValuePair.Key, IsInline = true, ContentId = keyValuePair.Value }; } } attachments = dictionary.Values; } else { attachments = from inlineAttachment in dictionary2 select new AirSyncAttachmentInfo { AttachmentId = inlineAttachment.Key, IsInline = true, ContentId = inlineAttachment.Value }; } } else { attachments = ((dictionary != null) ? dictionary.Values : null); } return(stream); } break; } } stream = null; totalDataSize = 0L; return(stream); }
// Token: 0x0600144F RID: 5199 RVA: 0x00075120 File Offset: 0x00073320 private MessageItem CreateIrmErrorMessage() { RightsManagedMessageItem rightsManagedMessageItem = ((Item)base.XsoItem) as RightsManagedMessageItem; if (rightsManagedMessageItem == null) { return(null); } bool flag = false; MessageItem messageItem = MessageItem.CreateInMemory(StoreObjectSchema.ContentConversionProperties); if (messageItem == null) { AirSyncDiagnostics.TraceError(ExTraceGlobals.XsoTracer, null, "Failed to create in memory message item"); return(null); } try { Item.CopyItemContent(rightsManagedMessageItem, messageItem); using (TextWriter textWriter = messageItem.Body.OpenTextWriter(Microsoft.Exchange.Data.Storage.BodyFormat.TextPlain)) { RightsManagementFailureCode failureCode = rightsManagedMessageItem.DecryptionStatus.FailureCode; if (failureCode > RightsManagementFailureCode.PreLicenseAcquisitionFailed) { switch (failureCode) { case RightsManagementFailureCode.FailedToExtractTargetUriFromMex: case RightsManagementFailureCode.FailedToDownloadMexData: textWriter.Write(Strings.IRMReachNotConfiguredBodyText.ToString(rightsManagedMessageItem.Session.PreferedCulture)); goto IL_1F7; case RightsManagementFailureCode.GetServerInfoFailed: goto IL_1AF; case RightsManagementFailureCode.InternalLicensingDisabled: case RightsManagementFailureCode.ExternalLicensingDisabled: break; default: switch (failureCode) { case RightsManagementFailureCode.ServerRightNotGranted: textWriter.Write(Strings.IRMServerNotConfiguredBodyText.ToString(rightsManagedMessageItem.Session.PreferedCulture)); goto IL_1F7; case RightsManagementFailureCode.InvalidLicensee: goto IL_149; case RightsManagementFailureCode.FeatureDisabled: break; case RightsManagementFailureCode.NotSupported: case RightsManagementFailureCode.MissingLicense: case RightsManagementFailureCode.InvalidLicensingLocation: goto IL_1AF; case RightsManagementFailureCode.CorruptData: textWriter.Write(Strings.IRMCorruptProtectedMessageBodyText.ToString(rightsManagedMessageItem.Session.PreferedCulture)); goto IL_1F7; case RightsManagementFailureCode.ExpiredLicense: textWriter.Write(Strings.IRMLicenseExpiredBodyText.ToString(rightsManagedMessageItem.Session.PreferedCulture)); goto IL_1F7; default: goto IL_1AF; } break; } flag = true; goto IL_1F7; } if (failureCode == RightsManagementFailureCode.UserRightNotGranted) { textWriter.Write(Strings.IRMNoViewRightsBodyText.ToString(rightsManagedMessageItem.Session.PreferedCulture)); goto IL_1F7; } if (failureCode != RightsManagementFailureCode.PreLicenseAcquisitionFailed) { goto IL_1AF; } IL_149: textWriter.Write(Strings.IRMPreLicensingFailureBodyText.ToString(rightsManagedMessageItem.Session.PreferedCulture)); goto IL_1F7; IL_1AF: AirSyncDiagnostics.TraceError <string>(ExTraceGlobals.XsoTracer, null, "IRM decryption status {0}", rightsManagedMessageItem.DecryptionStatus.FailureCode.ToString()); textWriter.Write(Strings.IRMServerNotAvailableBodyText.ToString(rightsManagedMessageItem.Session.PreferedCulture)); IL_1F7 :; } } catch (Exception) { if (messageItem != null) { flag = true; } throw; } finally { if (flag) { messageItem.Dispose(); messageItem = null; } } return(messageItem); }