private static OutlookModule GetModuleForObjectClass(string objectClass) { if (objectClass == null) { return(OutlookModule.None); } if (ObjectClass.IsCalendarFolder(objectClass) || ObjectClass.IsCalendarItem(objectClass)) { return(OutlookModule.Calendar); } if (ObjectClass.IsContactsFolder(objectClass) || ObjectClass.IsContact(objectClass) || ObjectClass.IsDistributionList(objectClass)) { return(OutlookModule.Contacts); } if (ObjectClass.IsJournalFolder(objectClass) || ObjectClass.IsJournalItem(objectClass)) { return(OutlookModule.Journal); } if (ObjectClass.IsNotesFolder(objectClass) || ObjectClass.IsNotesItem(objectClass)) { return(OutlookModule.Notes); } if (ObjectClass.IsTaskFolder(objectClass) || ObjectClass.IsTask(objectClass)) { return(OutlookModule.Tasks); } if (ObjectClass.IsMessageFolder(objectClass) || ObjectClass.IsMessage(objectClass, false) || ObjectClass.IsMeetingMessage(objectClass) || ObjectClass.IsTaskRequest(objectClass) || ObjectClass.IsReport(objectClass)) { return(OutlookModule.Mail); } return(OutlookModule.None); }
protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value) { CalendarItemBase calendarItemBase = propertyBag.Context.StoreObject as CalendarItemBase; if (calendarItemBase != null) { calendarItemBase.LocationIdentifierHelperInstance.SetLocationIdentifier(42869U, LastChangeAction.ModifyReminder); } propertyBag.SetValueWithFixup(InternalSchema.ReminderDueByInternal, value); if (ObjectClass.IsMessage(propertyBag.GetValue(InternalSchema.ItemClass) as string, false)) { propertyBag.SetValueWithFixup(InternalSchema.ReplyTime, (ExDateTime)value); } Reminder.Adjust(propertyBag.Context.StoreObject); }
private COWProcessorState InspectNotification(COWTriggerAction operation, StoreSession session, CoreItem item, bool onBeforeNotification, bool onDumpster) { if (onDumpster) { return(COWProcessorState.DoNotProcess); } if (operation != COWTriggerAction.Create) { COWGroupMessageWSPublishing.Tracer.TraceDebug((long)this.GetHashCode(), "COWGroupMessageWSPublishing.InspectNotification: not an Create operation."); return(COWProcessorState.DoNotProcess); } if (!onBeforeNotification) { return(COWProcessorState.DoNotProcess); } if (item == null) { return(COWProcessorState.Unknown); } if (item.Id != null) { COWGroupMessageWSPublishing.Tracer.TraceDebug((long)this.GetHashCode(), "COWGroupMessageWSPublishing.InspectNotification: ItemId is non-null, so this is not a new item. Do not process."); return(COWProcessorState.DoNotProcess); } MailboxSession mailboxSession = session as MailboxSession; if (mailboxSession == null) { COWGroupMessageWSPublishing.Tracer.TraceDebug((long)this.GetHashCode(), "COWGroupMessageWSPublishing.InspectNotification: not a mailbox session. Do not process."); return(COWProcessorState.DoNotProcess); } int?num = mailboxSession.Mailbox.TryGetProperty(MailboxSchema.MailboxTypeDetail) as int?; if (num == null) { COWGroupMessageWSPublishing.Tracer.TraceDebug((long)this.GetHashCode(), "COWGroupMessageWSPublishing.InspectNotification: mailbox type not found. Try to inspect later."); return(COWProcessorState.Unknown); } if (!StoreSession.IsGroupMailbox(num.Value)) { COWGroupMessageWSPublishing.Tracer.TraceDebug((long)this.GetHashCode(), "COWGroupMessageWSPublishing.InspectNotification: Mailbox isn't a GroupMailbox. Do not process."); return(COWProcessorState.DoNotProcess); } string valueOrDefault = item.PropertyBag.GetValueOrDefault <string>(StoreObjectSchema.ItemClass, string.Empty); if (string.IsNullOrEmpty(valueOrDefault)) { COWGroupMessageWSPublishing.Tracer.TraceDebug((long)this.GetHashCode(), "COWGroupMessageWSPublishing.InspectNotification: item class not found. Try to inspect later."); return(COWProcessorState.Unknown); } if (!ObjectClass.IsMessage(valueOrDefault, false)) { COWGroupMessageWSPublishing.Tracer.TraceDebug((long)this.GetHashCode(), "COWGroupMessageWSPublishing.InspectNotification: item class is not a message. Do not process."); return(COWProcessorState.DoNotProcess); } if (ObjectClass.IsMeetingForwardNotification(valueOrDefault)) { COWGroupMessageWSPublishing.Tracer.TraceDebug((long)this.GetHashCode(), "COWGroupMessageWSPublishing.InspectNotification: item class is meeting forward notification. Do not process."); return(COWProcessorState.DoNotProcess); } if (ObjectClass.IsMeetingResponse(valueOrDefault)) { COWGroupMessageWSPublishing.Tracer.TraceDebug((long)this.GetHashCode(), "COWGroupMessageWSPublishing.InspectNotification: item class is meeting response. Do not process."); return(COWProcessorState.DoNotProcess); } bool flag = ClientInfo.OWA.IsMatch(mailboxSession.ClientInfoString); bool flag2 = ClientInfo.HubTransport.IsMatch(mailboxSession.ClientInfoString); if (!flag && !flag2) { COWGroupMessageWSPublishing.Tracer.TraceDebug((long)this.GetHashCode(), "COWGroupMessageWSPublishing.InspectNotification: This isn't either a post or a delivery. Do not process."); return(COWProcessorState.DoNotProcess); } StoreObjectId storeObjectId = item.PropertyBag.TryGetProperty(StoreObjectSchema.ParentItemId) as StoreObjectId; if (storeObjectId == null) { COWGroupMessageWSPublishing.Tracer.TraceDebug((long)this.GetHashCode(), "COWGroupMessageWSPublishing.InspectNotification: parent folder id not found. Try to inspect later."); return(COWProcessorState.Unknown); } StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox); if (defaultFolderId == null) { COWGroupMessageWSPublishing.Tracer.TraceDebug((long)this.GetHashCode(), "COWGroupMessageWSPublishing.InspectNotification: inbox folder id not found. Try to inspect later."); return(COWProcessorState.Unknown); } if (!storeObjectId.Equals(defaultFolderId)) { COWGroupMessageWSPublishing.Tracer.TraceDebug((long)this.GetHashCode(), "COWGroupMessageWSPublishing.InspectNotification: This message isn't located on the inbox folder. Do not process."); return(COWProcessorState.DoNotProcess); } return(COWProcessorState.ProcessAfterSave); }
public static Stream OpenRestrictedAttachment(StreamAttachment sourceAttachment, OrganizationId orgId, string userIdentity, SecurityIdentifier userSid, RecipientTypeDetails userType, out UseLicenseAndUsageRights validatedUseLicenseAndUsageRights, out bool acquiredNewLicense) { StreamAttachment.< > c__DisplayClass2 CS$ < > 8__locals1 = new StreamAttachment.< > c__DisplayClass2(); CS$ < > 8__locals1.sourceAttachment = sourceAttachment; CS$ < > 8__locals1.orgId = orgId; CS$ < > 8__locals1.userIdentity = userIdentity; CS$ < > 8__locals1.userSid = userSid; CS$ < > 8__locals1.userType = userType; Util.ThrowOnNullArgument(CS$ < > 8__locals1.sourceAttachment, "sourceAttachment"); Util.ThrowOnNullArgument(CS$ < > 8__locals1.orgId, "orgId"); Util.ThrowOnNullArgument(CS$ < > 8__locals1.userIdentity, "userIdentity"); Util.ThrowOnNullArgument(CS$ < > 8__locals1.userSid, "userSid"); if (!Enum.IsDefined(typeof(RecipientTypeDetails), CS$ < > 8__locals1.userType)) { throw new EnumArgumentException("userType"); } CS$ < > 8__locals1.cachedServerUseLicense = null; if (!PropertyError.IsPropertyNotFound(CS$ < > 8__locals1.sourceAttachment.TryGetProperty(AttachmentSchema.DRMServerLicenseCompressed))) { using (Stream stream = CS$ < > 8__locals1.sourceAttachment.OpenPropertyStream(AttachmentSchema.DRMServerLicenseCompressed, PropertyOpenMode.ReadOnly)) { CS$ < > 8__locals1.cachedServerUseLicense = DrmEmailCompression.DecompressUseLicense(stream); } } StreamAttachment.< > c__DisplayClass2 CS$ < > 8__locals2 = CS$ < > 8__locals1; int?valueAsNullable = CS$ < > 8__locals1.sourceAttachment.PropertyBag.GetValueAsNullable <int>(AttachmentSchema.DRMRights); CS$ < > 8__locals2.cachedUsageRights = ((valueAsNullable != null) ? new ContentRight?((ContentRight)valueAsNullable.GetValueOrDefault()) : null); CS$ < > 8__locals1.cachedExpiryTime = CS$ < > 8__locals1.sourceAttachment.PropertyBag.GetValueAsNullable <ExDateTime>(AttachmentSchema.DRMExpiryTime); CS$ < > 8__locals1.cachedDrmPropsSignature = CS$ < > 8__locals1.sourceAttachment.PropertyBag.GetValueOrDefault <byte[]>(AttachmentSchema.DRMPropsSignature); CS$ < > 8__locals1.item = CS$ < > 8__locals1.sourceAttachment.CoreAttachment.ParentCollection.ContainerItem; if (string.IsNullOrEmpty(CS$ < > 8__locals1.cachedServerUseLicense) || CS$ < > 8__locals1.cachedUsageRights == null || CS$ < > 8__locals1.cachedExpiryTime == null || CS$ < > 8__locals1.cachedDrmPropsSignature == null) { string valueOrDefault = CS$ < > 8__locals1.item.PropertyBag.GetValueOrDefault <string>(StoreObjectSchema.ItemClass, string.Empty); if (ObjectClass.IsMessage(valueOrDefault, false)) { CS$ < > 8__locals1.cachedServerUseLicense = CS$ < > 8__locals1.item.PropertyBag.GetValueOrDefault <string>(MessageItemSchema.DRMServerLicense, string.Empty); StreamAttachment.< > c__DisplayClass2 CS$ < > 8__locals3 = CS$ < > 8__locals1; int?valueAsNullable2 = CS$ < > 8__locals1.item.PropertyBag.GetValueAsNullable <int>(MessageItemSchema.DRMRights); CS$ < > 8__locals3.cachedUsageRights = ((valueAsNullable2 != null) ? new ContentRight?((ContentRight)valueAsNullable2.GetValueOrDefault()) : null); CS$ < > 8__locals1.cachedExpiryTime = CS$ < > 8__locals1.item.PropertyBag.GetValueAsNullable <ExDateTime>(MessageItemSchema.DRMExpiryTime); CS$ < > 8__locals1.cachedDrmPropsSignature = CS$ < > 8__locals1.item.PropertyBag.GetValueOrDefault <byte[]>(MessageItemSchema.DRMPropsSignature); } } CS$ < > 8__locals1.unprotectionSuccess = false; CS$ < > 8__locals1.useLicenseAndUsageRights = null; CS$ < > 8__locals1.validCachedLicense = false; Stream unprotectedAttachment; using (DisposeGuard disposeGuard = default(DisposeGuard)) { StreamAttachment.< > c__DisplayClass4 CS$ < > 8__locals4 = new StreamAttachment.< > c__DisplayClass4(); CS$ < > 8__locals4.unprotectedAttachment = disposeGuard.Add <Stream>(Streams.CreateTemporaryStorageStream()); CS$ < > 8__locals4.decryptorHandle = null; using (Stream inputStream = CS$ < > 8__locals1.sourceAttachment.GetContentStream(PropertyOpenMode.ReadOnly)) { try { MsgToRpMsgConverter.CallRM(delegate { CS$ < > 8__locals1.unprotectionSuccess = ProtectorsManager.Instance.Unprotect(delegate(string protectedDocumentIssuanceLicense) { string valueOrDefault2 = CS$ < > 8__locals1.item.PropertyBag.GetValueOrDefault <string>(ItemSchema.InternetMessageId, string.Empty); bool flag = string.IsNullOrEmpty(valueOrDefault2); RmsClientManagerContext context = new RmsClientManagerContext(CS$ < > 8__locals1.orgId, flag ? RmsClientManagerContext.ContextId.AttachmentFileName : RmsClientManagerContext.ContextId.MessageId, flag ? CS$ < > 8__locals1.sourceAttachment.FileName : valueOrDefault2, null); if (!string.IsNullOrEmpty(CS$ < > 8__locals1.cachedServerUseLicense) && CS$ < > 8__locals1.cachedUsageRights != null && CS$ < > 8__locals1.cachedExpiryTime != null && CS$ < > 8__locals1.cachedDrmPropsSignature != null) { try { CS$ < > 8__locals4.decryptorHandle = RmsClientManager.VerifyDRMPropsSignatureAndGetDecryptor(context, CS$ < > 8__locals1.userSid, CS$ < > 8__locals1.userType, CS$ < > 8__locals1.userIdentity, CS$ < > 8__locals1.cachedUsageRights.Value, CS$ < > 8__locals1.cachedExpiryTime.Value, CS$ < > 8__locals1.cachedDrmPropsSignature, CS$ < > 8__locals1.cachedServerUseLicense, protectedDocumentIssuanceLicense, UsageRightsSignatureVerificationOptions.LookupSidHistory, StreamAttachment.EmptySidList); CS$ < > 8__locals1.validCachedLicense = true; Uri licensingUri = null; XmlNode[] array = null; bool flag2; RmsClientManager.GetLicensingUri(CS$ < > 8__locals1.orgId, protectedDocumentIssuanceLicense, out licensingUri, out array, out flag2); CS$ < > 8__locals1.useLicenseAndUsageRights = new UseLicenseAndUsageRights(CS$ < > 8__locals1.cachedServerUseLicense, CS$ < > 8__locals1.cachedUsageRights.Value, CS$ < > 8__locals1.cachedExpiryTime.Value, CS$ < > 8__locals1.cachedDrmPropsSignature, CS$ < > 8__locals1.orgId, protectedDocumentIssuanceLicense, licensingUri); } catch (BadDRMPropsSignatureException) { } } if (CS$ < > 8__locals1.useLicenseAndUsageRights == null) { CS$ < > 8__locals1.useLicenseAndUsageRights = RmsClientManager.AcquireUseLicenseAndUsageRights(context, protectedDocumentIssuanceLicense, CS$ < > 8__locals1.userIdentity, CS$ < > 8__locals1.userSid, CS$ < > 8__locals1.userType); if (CS$ < > 8__locals4.decryptorHandle != null) { CS$ < > 8__locals4.decryptorHandle.Close(); CS$ < > 8__locals4.decryptorHandle = null; } RmsClientManager.BindUseLicenseForDecryption(context, CS$ < > 8__locals1.useLicenseAndUsageRights.LicensingUri, CS$ < > 8__locals1.useLicenseAndUsageRights.UseLicense, CS$ < > 8__locals1.useLicenseAndUsageRights.PublishingLicense, out CS$ < > 8__locals4.decryptorHandle); } return(CS$ < > 8__locals4.decryptorHandle); }, CS$ < > 8__locals1.sourceAttachment.FileName, inputStream, CS$ < > 8__locals4.unprotectedAttachment); }, ServerStrings.FailedToUnprotectAttachment(CS$ < > 8__locals1.sourceAttachment.FileName)); }
private bool CanExtractReplyTo(PropertyBag.BasicPropertyStore propertyBag) { string text = propertyBag.GetValue(InternalSchema.ItemClass) as string; return(!string.IsNullOrEmpty(text) && ObjectClass.IsMessage(text, false)); }
private static bool CanExtractRecipients(string itemClass) { return(!string.IsNullOrEmpty(itemClass) && (ObjectClass.IsMessage(itemClass, true) || ObjectClass.IsCalendarItem(itemClass))); }