protected override byte[] MessageSaveChanges(StorageFxProxyPool.MessageEntry entry) { CoreItem referencedObject = entry.WrappedObject.ReferenceCoreItem.ReferencedObject; if (entry.MimeStream != null || entry.CachedItemProperties.Count > 0) { using (Item item = new Item(referencedObject, true)) { if (entry.MimeStream != null) { InboundConversionOptions scopedInboundConversionOptions = MapiUtils.GetScopedInboundConversionOptions(this.destMailbox.StoreSession.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid)); using (entry.MimeStream) { ItemConversion.ConvertAnyMimeToItem(item, entry.MimeStream, scopedInboundConversionOptions); } } foreach (ItemPropertiesBase itemPropertiesBase in entry.CachedItemProperties) { itemPropertiesBase.Apply((MailboxSession)this.destMailbox.StoreSession, item); } } } if (entry.CachedPropValues.Count > 0) { this.SetProps(entry.WrappedObject.PropertyBag, entry.CachedPropValues.ToArray()); } entry.WrappedObject.Save(); referencedObject.PropertyBag.Load(StorageFxProxyPool.EntryIdPropDef); return(referencedObject.PropertyBag[StorageFxProxyPool.EntryIdPropDef[0]] as byte[]); }
internal static T ConstructItem <T>(StoreSession session, StoreObjectId id, byte[] changeKey, ICollection <PropertyDefinition> propertiesToLoad, ItemBuilder.PropertyBagCreator propertyBagCreator, ItemCreateInfo.ItemCreator creator, Origin origin, ItemLevel itemLevel) where T : Item { PersistablePropertyBag persistablePropertyBag = null; CoreItem coreItem = null; T t = default(T); bool flag = false; T result; try { persistablePropertyBag = propertyBagCreator(); coreItem = new CoreItem(session, persistablePropertyBag, id, changeKey, origin, itemLevel, propertiesToLoad, ItemBindOption.None); t = (T)((object)creator(coreItem)); flag = true; result = t; } finally { if (!flag) { Util.DisposeIfPresent(t); Util.DisposeIfPresent(coreItem); Util.DisposeIfPresent(persistablePropertyBag); } } return(result); }
internal void CopyAttachmentContentFrom(CoreAttachment sourceAttachment) { this.CheckDisposed(null); sourceAttachment.PropertyBag.Load(InternalSchema.ContentConversionProperties); foreach (NativeStorePropertyDefinition property in sourceAttachment.PropertyBag.AllNativeProperties) { if (CoreAttachment.ShouldPropertyBeCopied(property, sourceAttachment.AttachmentType, this.AttachmentType)) { PersistablePropertyBag.CopyProperty(sourceAttachment.PropertyBag, property, this.PropertyBag); } } if (sourceAttachment.AttachmentType == AttachmentType.EmbeddedMessage && this.AttachmentType == AttachmentType.EmbeddedMessage) { bool noMessageDecoding = sourceAttachment.ParentCollection.ContainerItem.CharsetDetector.NoMessageDecoding; bool noMessageDecoding2 = this.parentCollection.ContainerItem.CharsetDetector.NoMessageDecoding; using (ICoreItem coreItem = sourceAttachment.PropertyBag.OpenAttachedItem(PropertyOpenMode.ReadOnly, InternalSchema.ContentConversionProperties, noMessageDecoding)) { using (ICoreItem coreItem2 = this.PropertyBag.OpenAttachedItem(PropertyOpenMode.Create, InternalSchema.ContentConversionProperties, noMessageDecoding2)) { CoreItem.CopyItemContent(coreItem, coreItem2); using (Item item = Item.InternalBindCoreItem(coreItem2)) { item.CharsetDetector.DetectionOptions.PreferredInternetCodePageForShiftJis = coreItem.PropertyBag.GetValueOrDefault <int>(ItemSchema.InternetCpid, 50222); item.LocationIdentifierHelperInstance.SetLocationIdentifier(64373U); item.SaveFlags = (((PersistablePropertyBag)coreItem.PropertyBag).SaveFlags | PropertyBagSaveFlags.IgnoreMapiComputedErrors | PropertyBagSaveFlags.IgnoreAccessDeniedErrors); item.Save(SaveMode.NoConflictResolution); } } } } this.PropertyBag.SaveFlags |= (PropertyBagSaveFlags.IgnoreMapiComputedErrors | PropertyBagSaveFlags.IgnoreUnresolvedHeaders); }
internal static T ItemBind <T>(StoreSession session, StoreId storeId, Schema expectedSchema, ItemBuilder.MapiMessageCreator mapiMessageCreator, ItemBindOption itemBindOption, ICollection <PropertyDefinition> propertiesToLoad) where T : Item { propertiesToLoad = ItemBuilder.GetPropertiesToLoad(itemBindOption, expectedSchema, propertiesToLoad); bool flag = false; CoreItem coreItem = null; Item item = null; T t = default(T); T result; try { StoreObjectType storeObjectType = StoreObjectType.Unknown; coreItem = ItemBuilder.CoreItemBind(session, storeId, mapiMessageCreator, itemBindOption, propertiesToLoad, ref storeObjectType); ItemCreateInfo itemCreateInfo = ItemCreateInfo.GetItemCreateInfo(storeObjectType); item = itemCreateInfo.Creator(coreItem); t = item.DownCastStoreObject <T>(); flag = true; result = t; } finally { if (!flag) { Util.DisposeIfPresent(t); Util.DisposeIfPresent(item); Util.DisposeIfPresent(coreItem); } } return(result); }
public ICoreItem OpenAttachedItem(ICollection <PropertyDefinition> propertiesToLoad, AttachmentPropertyBag attachmentBag, bool isNew) { this.CheckDisposed(null); CoreItem coreItem = null; int attachmentNumber = attachmentBag.AttachmentNumber; if (this.attachedItems.TryGetValue(attachmentNumber, out coreItem)) { string text = coreItem.PropertyBag.TryGetProperty(InternalSchema.ItemClass) as string; Schema schema = (text != null) ? ObjectClass.GetSchema(text) : MessageItemSchema.Instance; propertiesToLoad = InternalSchema.Combine <PropertyDefinition>(schema.AutoloadProperties, propertiesToLoad); coreItem.PropertyBag.Load(propertiesToLoad); } else { if (!isNew) { throw new ObjectNotFoundException(ServerStrings.MapiCannotOpenEmbeddedMessage); } string text2 = attachmentBag.TryGetProperty(InternalSchema.ItemClass) as string; Schema schema2 = (text2 != null) ? ObjectClass.GetSchema(text2) : MessageItemSchema.Instance; propertiesToLoad = InternalSchema.Combine <PropertyDefinition>(schema2.AutoloadProperties, propertiesToLoad); coreItem = new CoreItem(null, new InMemoryPersistablePropertyBag(propertiesToLoad) { ExTimeZone = this.ExTimeZone }, StoreObjectId.DummyId, null, Origin.New, ItemLevel.Attached, propertiesToLoad, ItemBindOption.LoadRequiredPropertiesOnly); if (text2 != null) { coreItem.PropertyBag[InternalSchema.ItemClass] = text2; } this.attachedItems.Add(attachmentNumber, coreItem); } return(new CoreItemWrapper(coreItem)); }
internal static void CoreObjectUpdateIsSilent(CoreItem coreItem) { if (((ICoreItem)coreItem).AreOptionalAutoloadPropertiesLoaded) { coreItem.PropertyBag[InternalSchema.IsSilent] = (coreItem.AttachmentCollection.Count == 0 && coreItem.Body.PreviewText.Trim().Length == 0); } }
private bool TryCreateNewItemActivity(CoreItem item, out Activity activity) { activity = null; ActivityId?activityId = null; Schema schema = ((IValidatable)item).Schema; if (schema is CalendarItemBaseSchema) { if (!item.PropertyBag.GetValueOrDefault <bool>(CalendarItemBaseSchema.IsMeeting, false)) { activityId = new ActivityId?(ActivityId.CreateAppointment); } } else if (schema is TaskSchema) { activityId = new ActivityId?(ActivityId.CreateTask); } if (activityId == null) { return(false); } activity = new Activity(activityId.Value, this.clientInfo.Id, ExDateTime.UtcNow, this.clientSessionId, this.clientInfo.Version, Interlocked.Increment(ref this.sequenceNumber), this.session, ((ICoreObject)item).InternalStoreObjectId, null, new Dictionary <string, string> { { "ItemClass", item.ClassName() } }); return(true); }
protected override void InternalDispose(bool disposing) { if (disposing) { foreach (KeyValuePair <int, PersistablePropertyBag> keyValuePair in this.newAttachmentList) { PersistablePropertyBag value = keyValuePair.Value; value.Dispose(); } foreach (KeyValuePair <int, PersistablePropertyBag> keyValuePair2 in this.savedAttachmentList) { PersistablePropertyBag value2 = keyValuePair2.Value; value2.Dispose(); } foreach (KeyValuePair <int, CoreItem> keyValuePair3 in this.attachedItems) { CoreItem value3 = keyValuePair3.Value; value3.Dispose(); } this.newAttachmentList.Clear(); this.savedAttachmentList.Clear(); this.attachedItems.Clear(); } base.InternalDispose(disposing); }
private bool TryCreateReplyActivity(CoreItem item, out Activity activity) { activity = null; if (item.Id == null) { return(false); } if (!item.PropertyBag.IsPropertyDirty(MessageItemSchema.LastVerbExecuted)) { return(false); } LastAction valueOrDefault = item.PropertyBag.GetValueOrDefault <LastAction>(MessageItemSchema.LastVerbExecuted); ActivityId id; if (valueOrDefault == LastAction.ReplyToSender || (valueOrDefault >= LastAction.VotingOptionMin && valueOrDefault <= LastAction.VotingOptionMax)) { id = ActivityId.Reply; } else if (valueOrDefault == LastAction.ReplyToAll) { id = ActivityId.ReplyAll; } else { if (valueOrDefault != LastAction.Forward) { return(false); } id = ActivityId.Forward; } activity = new Activity(id, this.clientInfo.Id, ExDateTime.UtcNow, this.clientSessionId, this.clientInfo.Version, Interlocked.Increment(ref this.sequenceNumber), this.session, item.Id.ObjectId, null, null); return(true); }
void IDestinationFolder.SetMessageProps(byte[] entryId, PropValueData[] propValues) { MrsTracer.Provider.Function("StorageDestinationFolder.SetMessageProps: {0}", new object[] { base.DisplayNameForTracing }); if (entryId == null || propValues == null || propValues.Length == 0) { return; } using (base.Mailbox.RHTracker.Start()) { StoreObjectId storeId = StoreObjectId.FromProviderSpecificId(entryId); CoreItem coreItem = CoreItem.Bind(base.Mailbox.StoreSession, storeId); using (coreItem) { object[] array = new object[propValues.Length]; PropTag[] array2 = new PropTag[propValues.Length]; for (int i = 0; i < propValues.Length; i++) { array2[i] = (PropTag)propValues[i].PropTag; array[i] = propValues[i].Value; } NativeStorePropertyDefinition[] array3 = base.Mailbox.ConvertPropTagsToDefinitions(array2); coreItem.OpenAsReadWrite(); for (int j = 0; j < propValues.Length; j++) { coreItem.PropertyBag[array3[j]] = array[j]; } coreItem.Save(SaveMode.ResolveConflicts); } } }
public StorePropertyDefinition[] GetProperties(StoreObjectId itemId, CoreItem item) { List <StorePropertyDefinition> list = new List <StorePropertyDefinition>(); foreach (PropertyDefinition propertyDefinition in ContactSchema.Instance.InternalAllProperties) { if (!item.PropertyBag.IsPropertyDirty(propertyDefinition)) { ContactTracker.Tracer.TraceDebug <string>((long)this.GetHashCode(), "ContactTracker.ShouldLogContact: Skipping property as it is not dirty: {0}", propertyDefinition.Name); } else { StorePropertyDefinition storePropertyDefinition = propertyDefinition as StorePropertyDefinition; if (storePropertyDefinition == null) { ContactTracker.Tracer.TraceDebug <string>((long)this.GetHashCode(), "ContactTracker.ShouldLogContact: Skipping property as it is not a StorePropertyDefinition: {0}", propertyDefinition.Name); } else { list.Add(storePropertyDefinition); } } } return(list.ToArray()); }
internal static void CoreObjectUpdateFileAs(CoreItem coreItem) { PersistablePropertyBag persistablePropertyBag = Microsoft.Exchange.Data.Storage.CoreObject.GetPersistablePropertyBag(coreItem); InternalSchema.FileAsString.UpdateCompositePropertyValue(persistablePropertyBag); InternalSchema.FileAsString.UpdateFullNameAndSubject(persistablePropertyBag); }
internal override void CoreObjectUpdate(CoreItem coreItem, CoreItemOperation operation) { base.CoreObjectUpdate(coreItem, operation); Task.CoreObjectUpdateTaskStatus(coreItem); Task.CoreObjectUpdateRecurrence(coreItem); Task.CoreObjectUpdateTaskDates(coreItem); }
internal static MessageItem ItemBindAsMessage(StoreSession session, StoreId storeId, ItemBuilder.MapiMessageCreator mapiMessageCreator, ItemBindOption itemBindOption, ICollection <PropertyDefinition> propertiesToLoad) { ItemCreateInfo messageItemInfo = ItemCreateInfo.MessageItemInfo; propertiesToLoad = ItemBuilder.GetPropertiesToLoad(itemBindOption, messageItemInfo.Schema, propertiesToLoad); CoreItem coreItem = null; MessageItem messageItem = null; bool flag = false; MessageItem result; try { StoreObjectType storeObjectType = StoreObjectType.Message; coreItem = ItemBuilder.CoreItemBind(session, storeId, mapiMessageCreator, itemBindOption, propertiesToLoad, ref storeObjectType); messageItem = (MessageItem)messageItemInfo.Creator(coreItem); flag = true; result = messageItem; } finally { if (!flag) { Util.DisposeIfPresent(messageItem); Util.DisposeIfPresent(coreItem); } } return(result); }
public PersistablePropertyBag CreateAttachment(ICollection <PropertyDefinition> propertiesToLoad, CoreAttachment attachmentToClone, IItem itemToAttach, out int attachmentNumber) { this.CheckDisposed(null); InMemoryPersistablePropertyBag inMemoryPersistablePropertyBag = new InMemoryPersistablePropertyBag(propertiesToLoad); inMemoryPersistablePropertyBag.ExTimeZone = this.ExTimeZone; if (attachmentToClone != null) { throw new NotSupportedException("CreateAttachment for copied attachments is not supported"); } attachmentNumber = this.attachmentCounter++; inMemoryPersistablePropertyBag[InternalSchema.AttachNum] = attachmentNumber; this.newAttachmentList.Add(attachmentNumber, inMemoryPersistablePropertyBag); if (itemToAttach != null) { string text = itemToAttach.TryGetProperty(InternalSchema.ItemClass) as string; Schema schema = (text != null) ? ObjectClass.GetSchema(text) : ItemSchema.Instance; propertiesToLoad = InternalSchema.Combine <PropertyDefinition>(schema.AutoloadProperties, propertiesToLoad); using (DisposeGuard disposeGuard = default(DisposeGuard)) { PersistablePropertyBag persistablePropertyBag = new InMemoryPersistablePropertyBag(propertiesToLoad); disposeGuard.Add <PersistablePropertyBag>(persistablePropertyBag); persistablePropertyBag.ExTimeZone = this.ExTimeZone; CoreItem coreItem = new CoreItem(null, persistablePropertyBag, null, null, Origin.New, ItemLevel.Attached, propertiesToLoad, ItemBindOption.LoadRequiredPropertiesOnly); disposeGuard.Add <CoreItem>(coreItem); CoreItem.CopyItemContent(itemToAttach.CoreItem, coreItem); this.attachedItems.Add(attachmentNumber, coreItem); disposeGuard.Success(); } } return(inMemoryPersistablePropertyBag); }
internal static void CoreObjectUpdatePhysicalAddresses(CoreItem coreItem) { PersistablePropertyBag persistablePropertyBag = Microsoft.Exchange.Data.Storage.CoreObject.GetPersistablePropertyBag(coreItem); InternalSchema.HomeAddress.UpdateCompositePropertyValue(persistablePropertyBag); InternalSchema.BusinessAddress.UpdateCompositePropertyValue(persistablePropertyBag); InternalSchema.OtherAddress.UpdateCompositePropertyValue(persistablePropertyBag); }
private static void NewItem(CoreItem item, Menu parent) { if (item.Maps.Contains((MapType)MapId) || item.Maps.Contains(MapType.Common)) { Lists.Items.Add(item.CreateMenu(parent)); } }
private object GetPropertyValueForLogging(CoreItem item, StorePropertyDefinition interestingProperty) { if ((interestingProperty.PropertyFlags & PropertyFlags.Streamable) == PropertyFlags.Streamable) { COWContactLogging.Tracer.TraceDebug <string>((long)this.GetHashCode(), "COWContactLogging.GetPropertyValueForLogging: Skipping retrieval of value for streamable property {0}", interestingProperty.Name); return(null); } return(item.PropertyBag.GetValueOrDefault <object>(interestingProperty, null)); }
internal static void CoreObjectUpdateDraftFlag(CoreItem coreItem) { bool?valueAsNullable = coreItem.PropertyBag.GetValueAsNullable <bool>(InternalSchema.IsDraft); if (valueAsNullable == null || valueAsNullable.Value) { coreItem.PropertyBag[InternalSchema.IsDraft] = false; } }
private IMessageItem CreateEscalationMessage(IMailboxSession mailboxSession, StoreId escalationFolderId, IMessageItem originalMessage) { IMessageItem messageItem = this.xsoFactory.Create(mailboxSession, escalationFolderId); messageItem.Load(InternalSchema.ContentConversionProperties); CoreItem.CopyItemContentExcept(originalMessage.CoreItem, messageItem.CoreItem, GroupEscalation.PropertiesToExcludeFromCopy); messageItem.CharsetDetector.DetectionOptions = originalMessage.CharsetDetector.DetectionOptions; messageItem.SaveFlags |= (originalMessage.SaveFlags | PropertyBagSaveFlags.IgnoreMapiComputedErrors | PropertyBagSaveFlags.IgnoreAccessDeniedErrors); return(messageItem); }
private bool TryCreateMeetingActivity(CoreItem item, out Activity activity) { activity = null; ActivityId?activityId = null; Schema schema = ((IValidatable)item).Schema; Dictionary <string, string> dictionary = new Dictionary <string, string>(); if (schema is MeetingRequestSchema) { string valueOrDefault = item.PropertyBag.GetValueOrDefault <string>(InternalSchema.InReplyTo); dictionary.Add("InReplyTo", valueOrDefault); activityId = new ActivityId?(ActivityId.SendMeetingRequest); } else if (schema is MeetingResponseSchema) { switch (item.PropertyBag.GetValueOrDefault <ResponseType>(MeetingResponseSchema.ResponseType)) { case ResponseType.Tentative: activityId = new ActivityId?(ActivityId.TentativeMeetingRequest); break; case ResponseType.Accept: activityId = new ActivityId?(ActivityId.AcceptedMeetingRequest); break; case ResponseType.Decline: activityId = new ActivityId?(ActivityId.DeclinedMeetingRequest); break; default: return(false); } bool valueOrDefault2 = item.PropertyBag.GetValueOrDefault <bool>(MeetingResponseSchema.AppointmentCounterProposal); dictionary.Add("ProposeNewTime", valueOrDefault2 ? bool.TrueString : bool.FalseString); } else if (schema is MeetingMessageInstanceSchema) { int valueOrDefault3 = item.PropertyBag.GetValueOrDefault <int>(MessageItemSchema.AppointmentState); if ((valueOrDefault3 & 4) != 0) { activityId = new ActivityId?(ActivityId.CancelMeeting); } } if (activityId == null) { return(false); } dictionary.Add("ItemClass", item.ClassName()); activity = new Activity(activityId.Value, this.clientInfo.Id, ExDateTime.UtcNow, this.clientSessionId, this.clientInfo.Version, Interlocked.Increment(ref this.sequenceNumber), this.session, ((ICoreObject)item).InternalStoreObjectId, null, dictionary); return(true); }
private MessageRec SetSyncState(StoreSession storeSession, byte[] key, string syncStateStr, CoreFolder folder) { byte[] syncStateSearchKey = this.GetSyncStateSearchKey(key); MessageRec result; using (QueryResult queryResult = folder.QueryExecutor.ItemQuery(ItemQueryType.None, new ComparisonFilter(ComparisonOperator.Equal, ItemSchema.ReplyTemplateId, syncStateSearchKey), null, new PropertyDefinition[] { ItemSchema.Id })) { object[][] rows = queryResult.GetRows(1); CoreItem coreItem; if (rows.Length == 1) { coreItem = CoreItem.Bind(storeSession, (VersionedId)rows[0][0]); } else { coreItem = CoreItem.Create(storeSession, folder.Id, CreateMessageType.Normal); } using (coreItem) { coreItem.PropertyBag[StoreObjectSchema.ItemClass] = "IPM.MS-Exchange.MailboxSyncState"; coreItem.PropertyBag[ItemSchema.Subject] = this.GetSyncStateSubject(key); if (string.IsNullOrWhiteSpace(syncStateStr)) { coreItem.PropertyBag.Delete(MailboxProviderBase.SyncStateStorePropertyDefinition); } else { using (Stream stream = coreItem.PropertyBag.OpenPropertyStream(MailboxProviderBase.SyncStateStorePropertyDefinition, PropertyOpenMode.Create)) { using (StreamWriter streamWriter = new StreamWriter(stream)) { streamWriter.Write(syncStateStr); CommonUtils.AppendNewLinesAndFlush(streamWriter); } } } coreItem.PropertyBag[ItemSchema.ReplyTemplateId] = syncStateSearchKey; coreItem.Save(SaveMode.FailOnAnyConflict); coreItem.PropertyBag.Load(new PropertyDefinition[] { ItemSchema.Id }); result = new MessageRec((byte[])coreItem.Id.ObjectId.ProviderLevelItemId.Clone(), (byte[])folder.Id.ObjectId.ProviderLevelItemId.Clone(), DateTime.MinValue, 0, MsgRecFlags.None, null); } } return(result); }
private void PrepareAggregatedUserConfigurationUpdate(CoreItem coreItem) { if (!coreItem.CoreObjectUpdateContext.ContainsKey(this) && this.IsEnabledForConfigurationAggregation(coreItem)) { IList <IAggregatedUserConfigurationWriter> writers = AggregatedUserConfiguration.GetWriters(AggregatedUserConfigurationSchema.Instance, coreItem.Session as IMailboxSession, coreItem); if (writers != null) { coreItem.CoreObjectUpdateContext[this] = writers; foreach (IAggregatedUserConfigurationWriter aggregatedUserConfigurationWriter in writers) { aggregatedUserConfigurationWriter.Prepare(); } } } }
internal override void CoreObjectUpdate(CoreItem coreItem, CoreItemOperation operation) { base.CoreObjectUpdate(coreItem, operation); MessageItem.CoreObjectUpdateConversationTopic(coreItem); MessageItem.CoreObjectUpdateConversationIndex(coreItem); MessageItem.CoreObjectUpdateConversationIndexFixup(coreItem, operation); MessageItem.CoreObjectUpdateIconIndex(coreItem); MessageItem.CoreObjectUpdateMimeSkeleton(coreItem); if (operation == CoreItemOperation.Send && coreItem != null && coreItem.Session != null && coreItem.Session.ActivitySession != null) { StoreObjectId internalStoreObjectId = ((ICoreObject)coreItem).InternalStoreObjectId; string name = base.GetType().Name; coreItem.Session.ActivitySession.CaptureMessageSent(internalStoreObjectId, name); } }
private static void NewItem(CoreItem item, Menu parent) { try { if (item.Maps.Contains((MapType)MapId) || item.Maps.Contains(MapType.Common)) { Lists.Items.Add(item.CreateMenu(parent)); } } catch (Exception e) { Console.WriteLine(e); } }
internal virtual void CoreObjectUpdate(CoreItem coreItem, CoreItemOperation operation) { Item.CoreObjectUpdateInternetMessageId(coreItem); Item.CoreObjectUpdatePreview(coreItem); Item.CoreObjectUpdateSentRepresentingType(coreItem); Item.CoreObjectUpdateAnnotationToken(coreItem); this.CoreObjectUpdateAllAttachmentsHidden(coreItem); if (coreItem != null && ((IValidatable)coreItem).ValidateAllProperties) { foreach (PropertyRule propertyRule in this.PropertyRules) { bool arg = propertyRule.WriteEnforce(coreItem.PropertyBag); ExTraceGlobals.StorageTracer.Information <string, bool>((long)this.GetHashCode(), "ItemSchema.CoreObjectUpdate. PropertyRule enfoced. Rule = {0}. Result = {1}", propertyRule.ToString(), arg); } } }
private static void NewItem(CoreItem item, Menu parent) { try { if (item.Maps.Contains((MapType)MapId) || item.Maps.Contains(MapType.Common)) { Lists.Items.Add(item.CreateMenu(parent)); } } catch (Exception e) { Console.WriteLine(e); Chat.Print("Exception thrown at <font color=\"#FFF280\">Activator.NewItem</font>"); } }
private static bool ItemSuccessfullyDeleted(MailboxSession mailbox, StoreId itemId) { try { CoreItem coreItem = CoreItem.Bind(mailbox, itemId, new PropertyDefinition[] { StoreObjectSchema.ParentItemId }); coreItem.Dispose(); } catch (ObjectNotFoundException) { return(true); } return(false); }
internal static void CoreObjectUpdateSubjectPrefix(CoreItem coreItem) { if (coreItem.Session != null) { string valueOrDefault = coreItem.PropertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass); LocalizedString localizedString; if (DsnMdnUtil.TryGetSubjectPrefix(valueOrDefault, out localizedString)) { CultureInfo formatProvider = coreItem.Session.InternalPreferedCulture; if (ObjectClass.IsMdn(valueOrDefault)) { formatProvider = ReportMessage.GetMdnCulture(coreItem); } coreItem.PropertyBag[InternalSchema.SubjectPrefix] = localizedString.ToString(formatProvider); } } }
private object GetOriginalPropertyValueForLogging(CoreItem item, StorePropertyDefinition interestingProperty) { if ((interestingProperty.PropertyFlags & PropertyFlags.Streamable) == PropertyFlags.Streamable) { COWContactLogging.Tracer.TraceDebug <string>((long)this.GetHashCode(), "COWContactLogging.GetOriginalPropertyValueForLogging: Skipping retrieval of value for streamable property {0}", interestingProperty.Name); return(null); } IValidatablePropertyBag validatablePropertyBag = item.PropertyBag as IValidatablePropertyBag; if (validatablePropertyBag == null) { COWContactLogging.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLogging.GetOriginalPropertyValueForLogging: Skipping retrieval of value as property bag doesn't track original values."); return(null); } PropertyValueTrackingData originalPropertyInformation = validatablePropertyBag.GetOriginalPropertyInformation(interestingProperty); return(originalPropertyInformation.OriginalPropertyValue); }