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); }
private void Initialize() { base.Load(new PropertyDefinition[] { InternalSchema.ItemClass }); string itemClass = base.TryGetProperty(InternalSchema.ItemClass) as string; if (!ObjectClass.IsContact(itemClass)) { this[InternalSchema.ItemClass] = "IPM.Contact"; } this[ContactSchema.FileAsId] = -1; }
protected override object[][] TransformRow(object[] unfilteredRow) { this.unfilteredPropertyBag.SetQueryResultRow(unfilteredRow); List <Participant> list = new List <Participant>(); string valueOrDefault = this.unfilteredPropertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass); if (ObjectClass.IsDistributionList(valueOrDefault)) { list.Add(Microsoft.Exchange.Data.Storage.PropertyBag.CheckPropertyValue <Participant>(InternalSchema.DistributionListParticipant, base.PropertySets.TryGetProperty(unfilteredRow, InternalSchema.DistributionListParticipant), null)); } else if (ObjectClass.IsContact(valueOrDefault)) { foreach (ContactEmailSlotParticipantProperty contactEmailSlotParticipantProperty in ContactEmailSlotParticipantProperty.AllInstances.Values) { list.Add(Microsoft.Exchange.Data.Storage.PropertyBag.CheckPropertyValue <Participant>(contactEmailSlotParticipantProperty, base.PropertySets.TryGetProperty(unfilteredRow, contactEmailSlotParticipantProperty), null)); } } List <object[]> list2 = new List <object[]>(); foreach (Participant participant in list) { if (!(participant == null) && !(participant.IsRoutable(this.contacts.Session) == false)) { object[] array = (object[])unfilteredRow.Clone(); foreach (ContactEmailSlotParticipantProperty contactEmailSlotParticipantProperty2 in ContactEmailSlotParticipantProperty.AllInstances.Values) { base.PropertySets.DeleteProperty(array, contactEmailSlotParticipantProperty2); foreach (NativeStorePropertyDefinition propertyDefinition in contactEmailSlotParticipantProperty2.EmailSlotProperties) { base.PropertySets.DeleteProperty(array, propertyDefinition); } } base.PropertySets.SetProperty(array, InternalSchema.AnrViewParticipant, participant); base.PropertySets.SetProperty(array, ParticipantSchema.DisplayName, participant.DisplayName); base.PropertySets.SetProperty(array, ParticipantSchema.EmailAddress, participant.EmailAddress); base.PropertySets.SetProperty(array, ParticipantSchema.RoutingType, participant.RoutingType); this.unfilteredPropertyBag.SetQueryResultRow(array); if (this.filterCriteria(this.unfilteredPropertyBag)) { list2.Add(array); } } } return(list2.ToArray()); }
public bool UpdateProperties(ICorePropertyBag propertyBag) { string valueOrDefault = propertyBag.GetValueOrDefault <string>(StoreObjectSchema.ItemClass, null); if (string.IsNullOrEmpty(valueOrDefault)) { return(false); } if (!ObjectClass.IsContact(valueOrDefault) && !ObjectClass.IsDistributionList(valueOrDefault)) { return(false); } bool valueOrDefault2 = propertyBag.GetValueOrDefault <bool>(InternalSchema.ConversationIndexTracking, false); if (valueOrDefault2) { return(false); } propertyBag[InternalSchema.ConversationIndexTracking] = true; return(true); }
public bool SkipItemOperation(COWSettings settings, IDumpsterItemOperations dumpster, COWTriggerAction operation, COWTriggerActionState state, StoreSession session, StoreObjectId itemId, CoreItem item, bool onBeforeNotification, bool onDumpster, bool success, CallbackContext callbackContext) { if (!COWContactLogging.COWContactLoggingConfiguration.Instance.IsLoggingEnabled()) { return(true); } Util.ThrowOnNullArgument(session, "session"); EnumValidator.ThrowIfInvalid <COWTriggerAction>(operation, "operation"); EnumValidator.ThrowIfInvalid <COWTriggerActionState>(state, "state"); if (item == null) { COWContactLogging.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLogging.SkipItemOperation: Item is null"); return(true); } if (!onBeforeNotification) { COWContactLogging.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLogging.SkipItemOperation: Not onBeforeNotification"); return(true); } string valueOrDefault = item.PropertyBag.GetValueOrDefault <string>(StoreObjectSchema.ItemClass, string.Empty); COWContactLogging.Tracer.TraceDebug <string>((long)this.GetHashCode(), "COWContactLogging.SkipItemOperation: ItemClass: {0}", valueOrDefault); if (ObjectClass.IsPlace(valueOrDefault)) { return(true); } if (!ObjectClass.IsContact(valueOrDefault) && !ObjectClass.IsDistributionList(valueOrDefault) && !ObjectClass.IsContactsFolder(valueOrDefault)) { return(true); } foreach (IContactChangeTracker contactChangeTracker in COWContactLogging.ChangeTrackers) { if (contactChangeTracker.ShouldLoadPropertiesForFurtherCheck(operation, valueOrDefault, itemId, item)) { COWContactLogging.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLogging.SkipItemOperation: A tracker interested."); return(false); } } return(true); }
public IEnumerator <IStorePropertyBag> GetEnumerator() { using (IFolder folder = this.xsoFactory.BindToFolder(this.session, this.folder)) { using (IQueryResult query = folder.IItemQuery(ItemQueryType.None, null, OscFolderMigration.OscContactsEnumerator.SortByItemClassAscending, OscFolderMigration.OscContactsEnumerator.PropertiesToLoad)) { if (!query.SeekToCondition(SeekReference.OriginBeginning, OscFolderMigration.OscContactsEnumerator.ItemClassIsContact, SeekToConditionFlags.AllowExtendedFilters)) { OscFolderMigration.OscContactsEnumerator.Tracer.TraceDebug((long)this.GetHashCode(), "Contacts enumerator: no contacts in this folder."); yield break; } IStorePropertyBag[] contacts = query.GetPropertyBags(100); while (contacts.Length > 0) { foreach (IStorePropertyBag contact in contacts) { string itemClass = contact.GetValueOrDefault <string>(StoreObjectSchema.ItemClass, string.Empty); if (string.IsNullOrEmpty(itemClass)) { OscFolderMigration.OscContactsEnumerator.Tracer.TraceDebug((long)this.GetHashCode(), "Contacts enumerator: skipping item with blank item class."); } else { if (!ObjectClass.IsContact(itemClass)) { OscFolderMigration.OscContactsEnumerator.Tracer.TraceDebug((long)this.GetHashCode(), "Contacts enumerator: no further contacts in this folder."); yield break; } yield return(contact); } } contacts = query.GetPropertyBags(100); } } } yield break; }
public IEnumerator <IStorePropertyBag> GetEnumerator() { ContactFoldersEnumeratorOptions foldersEnumeratorOptions = ContactFoldersEnumeratorOptions.SkipHiddenFolders | ContactFoldersEnumeratorOptions.SkipDeletedFolders | ContactFoldersEnumeratorOptions.IncludeParentFolder; ContactFoldersEnumerator foldersEnumerator = new ContactFoldersEnumerator(this.session, new XSOFactory(), this.folderType, foldersEnumeratorOptions, new PropertyDefinition[0]); foreach (IStorePropertyBag folderPropertyBag in foldersEnumerator) { VersionedId folderId = folderPropertyBag.GetValueOrDefault <VersionedId>(FolderSchema.Id, null); IFolder folder; try { folder = this.xsoFactory.BindToFolder(this.session, folderId.ObjectId); } catch (ObjectNotFoundException) { RecursiveContactsEnumerator.Tracer.TraceError <VersionedId, Guid>((long)this.GetHashCode(), "Failed to bind to folder. FolderId: {0}. Mailbox: {1}.", folderId, this.session.MailboxOwner.MailboxInfo.MailboxGuid); continue; } try { using (IQueryResult contactsQuery = folder.IItemQuery(ItemQueryType.None, null, null, this.properties)) { IStorePropertyBag[] contacts = contactsQuery.GetPropertyBags(100); while (contacts.Length > 0) { foreach (IStorePropertyBag contactPropertyBag in contacts) { if (contactPropertyBag != null && !(contactPropertyBag.TryGetProperty(ItemSchema.Id) is PropertyError) && ObjectClass.IsContact(contactPropertyBag.GetValueOrDefault <string>(StoreObjectSchema.ItemClass, null))) { yield return(contactPropertyBag); } } contacts = contactsQuery.GetPropertyBags(100); } } } finally { folder.Dispose(); } } yield break; }
public void MoveNext() { this.CheckDisposed("MoveNext"); for (;;) { this.currentRow++; if (this.rows == null || this.currentRow >= this.rows.Length) { this.currentRow = 0; this.rows = this.query.GetPropertyBags(this.chunkSize); if (this.rows.Length == 0) { break; } this.chunkSize = Math.Min(this.chunkSize * 2, 1000); } IStorePropertyBag storePropertyBag = this.Current; object obj = storePropertyBag.TryGetProperty(StoreObjectSchema.ItemClass); if (storePropertyBag != null && !(storePropertyBag.TryGetProperty(ItemSchema.Id) is PropertyError) && !(obj is PropertyError) && (ObjectClass.IsContact((string)obj) || ObjectClass.IsDistributionList((string)obj))) { return; } AllContactsCursor.Tracer.TraceDebug(0L, "AllContactsCursor.MoveNext: Skipping bogus contact"); } this.rows = null; }
private ContactLinkingProcessingState InspectNotification(COWTriggerAction operation, StoreSession session, CoreItem item, bool onBeforeNotification, bool onDumpster) { if (onDumpster) { return(ContactLinkingProcessingState.DoNotProcess); } if (!onBeforeNotification) { return(ContactLinkingProcessingState.DoNotProcess); } if (item == null) { return(ContactLinkingProcessingState.Unknown); } if (!(session is MailboxSession)) { COWContactLinking.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLinking.InspectNotification: not a mailbox session."); return(ContactLinkingProcessingState.DoNotProcess); } if (operation != COWTriggerAction.Create && operation != COWTriggerAction.Update) { COWContactLinking.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLinking.InspectNotification: not an Create or Update operation."); return(ContactLinkingProcessingState.DoNotProcess); } PersistablePropertyBag persistablePropertyBag = CoreObject.GetPersistablePropertyBag(item); switch (persistablePropertyBag.Context.AutomaticContactLinkingAction) { case AutomaticContactLinkingAction.ClientBased: if (!this.IsClientAllowed(session.ClientInfoString)) { COWContactLinking.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLinking.InspectNotification: not allowed client session."); return(ContactLinkingProcessingState.DoNotProcess); } break; case AutomaticContactLinkingAction.Ignore: COWContactLinking.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLinking.InspectNotification: IgnoreAutomaticContactLinking=true."); return(ContactLinkingProcessingState.DoNotProcess); } if (session.LogonType != LogonType.Owner && session.LogonType != LogonType.Delegated) { COWContactLinking.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLinking.InspectNotification: logon session is not user or delegated."); return(ContactLinkingProcessingState.DoNotProcess); } string valueOrDefault = item.PropertyBag.GetValueOrDefault <string>(StoreObjectSchema.ItemClass, string.Empty); if (string.IsNullOrEmpty(valueOrDefault)) { return(ContactLinkingProcessingState.Unknown); } if (ObjectClass.IsPlace(valueOrDefault)) { COWContactLinking.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLinking.InspectNotification: place item class are not processed."); return(ContactLinkingProcessingState.DoNotProcess); } if (!ObjectClass.IsContact(valueOrDefault)) { COWContactLinking.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLinking.InspectNotification: item class is not contact."); return(ContactLinkingProcessingState.DoNotProcess); } if (operation == COWTriggerAction.Update && !Array.Exists <StorePropertyDefinition>(COWContactLinking.NotificationProperties, (StorePropertyDefinition property) => item.PropertyBag.IsPropertyDirty(property))) { COWContactLinking.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLinking.InspectNotification: no relevant properties changed"); return(ContactLinkingProcessingState.Unknown); } if (ClientInfo.MOMT.IsMatch(session.ClientInfoString)) { return(ContactLinkingProcessingState.ProcessAfterSave); } return(ContactLinkingProcessingState.ProcessBeforeSave); }