public new static ContactsFolder Create(StoreSession session, StoreId parentFolderId, StoreObjectType folderType, string displayName, CreateMode createMode) { EnumValidator.ThrowIfInvalid <CreateMode>(createMode, "createMode"); EnumValidator.ThrowIfInvalid <StoreObjectType>(folderType, StoreObjectType.ContactsFolder); return((ContactsFolder)Folder.Create(session, parentFolderId, StoreObjectType.ContactsFolder, displayName, createMode)); }
public void Sort(ConversationTreeSortOrder sortOrder) { EnumValidator.ThrowIfInvalid <ConversationTreeSortOrder>(sortOrder, "sortOrder"); this.sortOrder = sortOrder; this.rootNode.SortChildNodes(sortOrder); }
public new static ContactsFolder Create(StoreSession session, StoreId parentFolderId, StoreObjectType folderType) { EnumValidator.ThrowIfInvalid <StoreObjectType>(folderType, StoreObjectType.ContactsFolder); return(ContactsFolder.Create(session, parentFolderId)); }
public ConversionFailedException(ConversionFailureReason reason, LocalizedString message, Exception innerException) : base(message, innerException) { EnumValidator.ThrowIfInvalid <ConversionFailureReason>(reason, "reason"); this.reason = reason; }
public void GroupOperation(COWSettings settings, IDumpsterItemOperations dumpster, COWTriggerAction operation, FolderChangeOperationFlags flags, StoreSession sourceSession, StoreSession destinationSession, StoreObjectId destinationFolderId, StoreObjectId[] itemIds, GroupOperationResult result, bool onBeforeNotification, CallbackContext callbackContext) { EnumValidator.ThrowIfInvalid <COWTriggerAction>(operation, "operation"); EnumValidator.ThrowIfInvalid <FolderChangeOperationFlags>(flags, "flags"); Util.ThrowOnNullArgument(dumpster, "dumpster"); if (itemIds == null) { return; } if (dumpster.IsDumpsterOverCalendarLoggingQuota(callbackContext.SessionWithBestAccess, settings)) { ExTraceGlobals.CalendarLoggingTracer.Information <string, string>((long)sourceSession.GetHashCode(), "User {0} has exceeded the calendar logging quota of {1}", sourceSession.UserLegacyDN, settings.CalendarLoggingQuota.Value.ToString("A")); StorageGlobals.EventLogger.LogEvent(StorageEventLogConstants.Tuple_COWCalendarLoggingStopped, sourceSession.UserLegacyDN, new object[] { sourceSession.UserLegacyDN }); return; } if (dumpster.IsDumpsterOverWarningQuota(settings)) { ExTraceGlobals.CalendarLoggingTracer.Information <string, string>((long)sourceSession.GetHashCode(), "Disabling calendar logging for user {0}, since it has exceeded the dumpster warning quota of {1}", sourceSession.UserLegacyDN, settings.DumpsterWarningQuota.Value.ToString("A")); dumpster.DisableCalendarLogging(); return; } foreach (StoreObjectId storeObjectId in itemIds) { ICoreItem coreItem = null; StoragePermanentException ex = null; try { if (CalendarLoggingHelper.ShouldBeCopiedOnWrite(storeObjectId)) { if (CalendarLoggingHelper.ShouldLogInitialCheck(storeObjectId, operation)) { try { coreItem = CoreItem.Bind(callbackContext.SessionWithBestAccess, storeObjectId, CalendarLoggingHelper.RequiredOriginalProperties); if (!CalendarLoggingHelper.ShouldLog(coreItem, operation)) { goto IL_25A; } if (coreItem.PropertyBag.GetValueOrDefault <bool>(InternalSchema.HasBeenSubmitted)) { ExTraceGlobals.CalendarLoggingTracer.TraceWarning <ICoreItem, COWTriggerAction>((long)callbackContext.SessionWithBestAccess.GetHashCode(), "Save Item for Calendar Logging skipped as the item.HasBeenSubmitted is true (item {0}, operation {1}.", coreItem, operation); goto IL_25A; } switch (operation) { case COWTriggerAction.Move: case COWTriggerAction.MoveToDeletedItems: case COWTriggerAction.SoftDelete: if (!this.PerformFolderCopyOnWrite(settings, dumpster, coreItem, callbackContext.SessionWithBestAccess, operation, flags, false)) { goto IL_25A; } break; case COWTriggerAction.HardDelete: { StoreObjectId parentIdFromMessageId = IdConverter.GetParentIdFromMessageId(storeObjectId); if (DumpsterFolderHelper.IsAuditFolder(callbackContext.SessionWithBestAccess, parentIdFromMessageId)) { goto IL_25A; } if (DumpsterFolderHelper.IsDumpsterFolder(callbackContext.SessionWithBestAccess, parentIdFromMessageId)) { this.PerformCopyOnWrite(callbackContext.SessionWithBestAccess, dumpster, storeObjectId); goto IL_25A; } if (!this.PerformFolderCopyOnWrite(settings, dumpster, coreItem, callbackContext.SessionWithBestAccess, operation, flags, !settings.HoldEnabled())) { goto IL_25A; } break; } } } catch (ObjectNotFoundException ex2) { ex = ex2; } catch (VirusDetectedException ex3) { ex = ex3; } catch (VirusMessageDeletedException ex4) { ex = ex4; } catch (VirusException ex5) { ex = ex5; } if (ex != null) { ExTraceGlobals.CalendarLoggingTracer.TraceWarning <StoreObjectId, StoragePermanentException, COWTriggerAction>((long)callbackContext.SessionWithBestAccess.GetHashCode(), "Item ({0}) processing for Calendar Logging failure {1} (operation {2}).", storeObjectId, ex, operation); } } } } finally { if (coreItem != null) { coreItem.Dispose(); } } IL_25A :; } }
public void SetRemotingOptions(RemotingOptions remotingOptions) { EnumValidator <RemotingOptions> .ThrowIfInvalid(remotingOptions); this.remotingOptions = remotingOptions; }
public static RetentionAndArchiveFlags SetPendingRescan(RetentionAndArchiveFlags flags) { EnumValidator.ThrowIfInvalid <RetentionAndArchiveFlags>(flags, "flags"); return(flags | RetentionAndArchiveFlags.PendingRescan); }
private static void Fill(ExchangeMailboxAuditBaseRecord record, MailboxSession session, MailboxAuditOperations operation, OperationResult result, LogonType logonType, bool externalAccess) { EnumValidator.ThrowIfInvalid <MailboxAuditOperations>(operation); EnumValidator.ThrowIfInvalid <OperationResult>(result, "result"); EnumValidator.ThrowIfInvalid <LogonType>(logonType, "logonType"); Util.ThrowOnNullArgument(session, "session"); record.Operation = string.Format(CultureInfo.InvariantCulture, "{0}", new object[] { operation }); record.OperationResult = AuditRecordFactory.GetOperationResult(result); record.LogonType = AuditRecordFactory.GetLogonType(logonType); record.ExternalAccess = externalAccess; record.CreationTime = DateTime.UtcNow; record.InternalLogonType = AuditRecordFactory.GetLogonType(session.LogonType); record.MailboxGuid = session.MailboxOwner.MailboxInfo.MailboxGuid; OrganizationId organizationId = session.OrganizationId; record.OrganizationId = ((organizationId == null || organizationId.OrganizationalUnit == null || organizationId.ConfigurationUnit == null) ? null : Convert.ToBase64String(organizationId.GetBytes(Encoding.UTF8))); record.OrganizationName = AuditRecordFactory.GetOrgNameFromOrgId(organizationId); record.MailboxOwnerUPN = session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(); if (session.MailboxOwner.Sid != null) { record.MailboxOwnerSid = string.Format(CultureInfo.InvariantCulture, "{0}", new object[] { session.MailboxOwner.Sid }); if (session.MailboxOwner.MasterAccountSid != null) { record.MailboxOwnerMasterAccountSid = string.Format(CultureInfo.InvariantCulture, "{0}", new object[] { session.MailboxOwner.MasterAccountSid }); } } IdentityPair userIdentityPair = AuditRecordFactory.GetUserIdentityPair(session, logonType); if (userIdentityPair.LogonUserSid != null) { record.LogonUserSid = string.Format(CultureInfo.InvariantCulture, "{0}", new object[] { userIdentityPair.LogonUserSid }); record.UserId = record.LogonUserSid; } else { record.UserId = session.MailboxOwner.MailboxInfo.MailboxGuid.ToString("D", CultureInfo.InvariantCulture); } if (userIdentityPair.LogonUserDisplayName != null) { record.LogonUserDisplayName = string.Format(CultureInfo.InvariantCulture, "{0}", new object[] { userIdentityPair.LogonUserDisplayName }); } string text = (session.RemoteClientSessionInfo == null) ? session.ClientInfoString : session.RemoteClientSessionInfo.ClientInfoString; if (!string.IsNullOrEmpty(text)) { record.ClientInfoString = text; } record.ClientIPAddress = string.Format(CultureInfo.InvariantCulture, "{0}", new object[] { session.ClientIPAddress }); if (!string.IsNullOrEmpty(session.ClientMachineName)) { record.ClientMachineName = session.ClientMachineName; } if (!string.IsNullOrEmpty(session.ClientProcessName)) { record.ClientProcessName = session.ClientProcessName; } if (session.ClientVersion != 0L) { record.ClientVersion = AuditRecordFactory.GetVersionString(session.ClientVersion); } record.OriginatingServer = string.Format(CultureInfo.InvariantCulture, "{0} ({1})\r\n", new object[] { AuditRecordFactory.MachineName, "15.00.1497.012" }); }
public bool SeekToCondition(SeekReference reference, QueryFilter seekFilter) { this.CheckDisposed(null); EnumValidator.ThrowIfInvalid <SeekReference>(reference, "reference"); throw new NotSupportedException(); }
public static bool DoesFolderNeedRescan(int flags) { EnumValidator.ThrowIfInvalid <RetentionAndArchiveFlags>((RetentionAndArchiveFlags)flags, "flags"); return((flags & 384) != 0); }
public static RetentionAndArchiveFlags ClearNeedRescan(RetentionAndArchiveFlags flags) { EnumValidator.ThrowIfInvalid <RetentionAndArchiveFlags>(flags, "flags"); return(flags & ~RetentionAndArchiveFlags.NeedsRescan); }
public static RetentionAndArchiveFlags ClearExplicitArchiveFlag(RetentionAndArchiveFlags flags) { EnumValidator.ThrowIfInvalid <RetentionAndArchiveFlags>(flags, "flags"); return(flags & ~RetentionAndArchiveFlags.ExplictArchiveTag); }
public static RetentionAndArchiveFlags ClearAllArchiveFlags(RetentionAndArchiveFlags flags) { EnumValidator.ThrowIfInvalid <RetentionAndArchiveFlags>(flags, "flags"); return(flags & ~(RetentionAndArchiveFlags.ExplictArchiveTag | RetentionAndArchiveFlags.KeepInPlace)); }
public static RetentionAndArchiveFlags ClearAllRetentionFlags(RetentionAndArchiveFlags flags) { EnumValidator.ThrowIfInvalid <RetentionAndArchiveFlags>(flags, "flags"); return(flags & ~(RetentionAndArchiveFlags.ExplicitTag | RetentionAndArchiveFlags.UserOverride | RetentionAndArchiveFlags.Autotag | RetentionAndArchiveFlags.PersonalTag)); }
public DelegateUserValidationException(LocalizedString message, DelegateValidationProblem problem) : base(message) { EnumValidator.ThrowIfInvalid <DelegateValidationProblem>(problem, "problem"); this.problem = problem; }
public object[][] GetRows(int rowCount, QueryRowsFlags flags, out bool mightBeMoreRows) { this.CheckDisposed(null); EnumValidator.ThrowIfInvalid <QueryRowsFlags>(flags, "flags"); List <object[]> list = new List <object[]>(); int num = 0; int num2 = 0; while (num2 < rowCount && this.currentRowIndex + num < this.tableEntries.Count) { object[] array = new object[this.columns.Count]; for (int i = 0; i < this.columns.Count; i++) { if (this.columns[i] == InternalSchema.InstanceKey) { array[i] = BitConverter.GetBytes(this.tableEntries[this.currentRowIndex + num].MemberId); } else if (this.columns[i] == PermissionSchema.MemberId) { array[i] = this.tableEntries[this.currentRowIndex + num].MemberId; } else if (this.columns[i] == PermissionSchema.MemberEntryId) { array[i] = this.tableEntries[this.currentRowIndex + num].MemberEntryId; } else if (this.columns[i] == PermissionSchema.MemberRights) { MemberRights memberRights = this.tableEntries[this.currentRowIndex + num].MemberRights; if (this.removeFreeBusyRights) { array[i] = (int)(memberRights & ~(MemberRights.FreeBusySimple | MemberRights.FreeBusyDetailed)); } else { array[i] = (int)memberRights; } } else if (this.columns[i] == PermissionSchema.MemberName) { array[i] = this.tableEntries[this.currentRowIndex + num].MemberName; } else if (this.columns[i] == PermissionSchema.MemberSecurityIdentifier) { if (!this.allowExtendedPermissionInformationQuery) { throw new InvalidOperationException("QueryResult doesn't support MemberSecurityIdentifier property"); } SecurityIdentifier securityIdentifier = this.tableEntries[this.currentRowIndex + num].SecurityIdentifier; byte[] array2 = new byte[securityIdentifier.BinaryLength]; securityIdentifier.GetBinaryForm(array2, 0); array[i] = array2; } else if (this.columns[i] == PermissionSchema.MemberIsGroup) { if (!this.allowExtendedPermissionInformationQuery) { throw new InvalidOperationException("QueryResult doesn't support MemberIsGroup property"); } array[i] = this.tableEntries[this.currentRowIndex + num].IsGroup; } } list.Add(array); num++; num2++; } if ((flags & QueryRowsFlags.NoAdvance) != QueryRowsFlags.NoAdvance) { this.currentRowIndex += num; } mightBeMoreRows = (list.Count > 0); return(list.ToArray()); }
public AggregateOperationResult(OperationResult operationResult, GroupOperationResult[] groupOperationResults) { EnumValidator.ThrowIfInvalid <OperationResult>(operationResult, "operationResult"); this.OperationResult = operationResult; this.GroupOperationResults = groupOperationResults; }
public ConversionFailedException(ConversionFailureReason reason, Exception innerException) : base(ConversionFailedException.GetReasonDescription(reason), innerException) { EnumValidator.ThrowIfInvalid <ConversionFailureReason>(reason, "reason"); this.reason = reason; }
protected Condition(ConditionType conditionType, Rule rule) { EnumValidator.ThrowIfInvalid <ConditionType>(conditionType, "conditionType"); this.conditionType = conditionType; this.rule = rule; }
internal static CoreItem CoreItemBind(StoreSession session, StoreId storeId, ItemBuilder.MapiMessageCreator mapiMessageCreator, ItemBindOption itemBindOption, ICollection <PropertyDefinition> propertiesToLoad, ref StoreObjectType storeObjectType) { Util.ThrowOnNullArgument(session, "session"); EnumValidator.ThrowIfInvalid <ItemBindOption>(itemBindOption); Util.ThrowOnNullArgument(propertiesToLoad, "propertiesToLoad"); bool flag = false; MapiProp mapiProp = null; PersistablePropertyBag persistablePropertyBag = null; AcrPropertyBag acrPropertyBag = null; CoreItem coreItem = null; CoreItem result2; using (CallbackContext callbackContext = new CallbackContext(session)) { try { session.OnBeforeItemChange(ItemChangeOperation.ItemBind, session, storeId, coreItem, callbackContext); StoreObjectId storeObjectId; byte[] array; StoreId.SplitStoreObjectIdAndChangeKey(storeId, out storeObjectId, out array); session.CheckSystemFolderAccess(storeObjectId); if (storeObjectId != null && !IdConverter.IsMessageId(storeObjectId)) { throw new ArgumentException(ServerStrings.ExInvalidItemId); } bool flag2 = false; OccurrenceStoreObjectId occurrenceStoreObjectId = storeObjectId as OccurrenceStoreObjectId; IPropertyBagFactory propertyBagFactory; if (occurrenceStoreObjectId != null) { persistablePropertyBag = Item.CreateOccurrencePropertyBag(session, occurrenceStoreObjectId, propertiesToLoad); storeObjectType = StoreObjectType.CalendarItemOccurrence; flag2 = true; propertyBagFactory = new OccurrenceBagFactory(session, occurrenceStoreObjectId); } else { if (mapiMessageCreator != null) { mapiProp = mapiMessageCreator(); } else if ((itemBindOption & ItemBindOption.SoftDeletedItem) == ItemBindOption.SoftDeletedItem) { mapiProp = session.GetMapiProp(storeObjectId, OpenEntryFlags.BestAccess | OpenEntryFlags.DeferredErrors | OpenEntryFlags.ShowSoftDeletes); } else { mapiProp = session.GetMapiProp(storeObjectId); } persistablePropertyBag = new StoreObjectPropertyBag(session, mapiProp, propertiesToLoad); StoreObjectType storeObjectType2 = ItemBuilder.ReadStoreObjectTypeFromPropertyBag(persistablePropertyBag); if (storeObjectType2 == storeObjectType) { flag2 = true; } else { storeObjectType = storeObjectType2; } propertyBagFactory = new RetryBagFactory(session); if (storeObjectId != null && storeObjectId.ObjectType != storeObjectType) { storeObjectId = StoreObjectId.FromProviderSpecificId(storeObjectId.ProviderLevelItemId, storeObjectType); } } ItemBuilder.CheckPrivateItem(session, persistablePropertyBag); ItemCreateInfo itemCreateInfo = ItemCreateInfo.GetItemCreateInfo(storeObjectType); if (flag2) { propertiesToLoad = null; } else { propertiesToLoad = ItemBuilder.GetPropertiesToLoad(itemBindOption, itemCreateInfo.Schema, propertiesToLoad); } acrPropertyBag = new AcrPropertyBag(persistablePropertyBag, itemCreateInfo.AcrProfile, storeObjectId, propertyBagFactory, array); coreItem = new CoreItem(session, acrPropertyBag, storeObjectId, array, Origin.Existing, ItemLevel.TopLevel, propertiesToLoad, itemBindOption); flag = true; ConflictResolutionResult result = flag ? ConflictResolutionResult.Success : ConflictResolutionResult.Failure; session.OnAfterItemChange(ItemChangeOperation.ItemBind, session, storeId, coreItem, result, callbackContext); result2 = coreItem; } finally { if (!flag) { Util.DisposeIfPresent(coreItem); Util.DisposeIfPresent(acrPropertyBag); Util.DisposeIfPresent(persistablePropertyBag); Util.DisposeIfPresent(mapiProp); } } } return(result2); }