Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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 override CalendarItemBase GetEmbeddedItem()
        {
            this.CheckDisposed("GetEmbeddedItem");
            ExTraceGlobals.MeetingMessageTracer.Information <GlobalObjectId>((long)this.GetHashCode(), "Storage.MeetingMessage.GetEmbeddedItem: GOID={0}", this.GlobalObjectId);
            CalendarItemBase calendarItemBase = null;
            bool             flag             = false;
            CalendarItemBase result;

            try
            {
                ItemCreateInfo calendarItemInfo = ItemCreateInfo.CalendarItemInfo;
                calendarItemBase = ItemBuilder.ConstructItem <CalendarItem>(base.Session, base.StoreObjectId, (base.StoreObjectId != null) ? base.Id.ChangeKeyAsByteArray() : null, calendarItemInfo.Schema.AutoloadProperties, delegate
                {
                    AcrPropertyBag acrPropertyBag = null;
                    PersistablePropertyBag persistablePropertyBag = null;
                    bool flag2 = false;
                    StoreObjectId storeObjectId = base.StoreObjectId;
                    PersistablePropertyBag result2;
                    try
                    {
                        if (storeObjectId != null && !storeObjectId.IsFakeId)
                        {
                            persistablePropertyBag = StoreObjectPropertyBag.CreatePropertyBag(base.Session, storeObjectId, InternalSchema.ContentConversionProperties);
                            acrPropertyBag         = new AcrPropertyBag(persistablePropertyBag, AcrProfile.AppointmentProfile, storeObjectId, new ItemBagFactory(base.Session, base.StoreObjectId), null);
                            flag2   = true;
                            result2 = acrPropertyBag;
                        }
                        else
                        {
                            persistablePropertyBag = new StoreObjectPropertyBag(base.Session, base.MapiProp, InternalSchema.ContentConversionProperties, false);
                            flag2   = true;
                            result2 = persistablePropertyBag;
                        }
                    }
                    finally
                    {
                        if (!flag2)
                        {
                            Util.DisposeIfPresent(persistablePropertyBag);
                            Util.DisposeIfPresent(acrPropertyBag);
                        }
                    }
                    return(result2);
                }, calendarItemInfo.Creator, base.CoreObject.Origin, base.CoreObject.ItemLevel);
                flag   = true;
                result = calendarItemBase;
            }
            finally
            {
                if (!flag && calendarItemBase != null)
                {
                    calendarItemBase.Dispose();
                    calendarItemBase = null;
                }
            }
            return(result);
        }
Ejemplo n.º 4
0
        internal static CoreItem CreateNewCoreItem(StoreSession session, ItemCreateInfo itemCreateInfo, VersionedId itemId, bool useAcr, ItemBuilder.MapiMessageCreator mapiMessageCreator)
        {
            PersistablePropertyBag persistablePropertyBag = null;
            CoreItem      coreItem      = null;
            bool          flag          = false;
            StoreObjectId storeObjectId = null;

            byte[]   changeKey = null;
            Origin   origin    = Origin.New;
            CoreItem result;

            try
            {
                persistablePropertyBag = ItemBuilder.ConstructItemPersistablePropertyBag(session, itemCreateInfo.Schema.AutoloadProperties, useAcr, itemCreateInfo.AcrProfile, mapiMessageCreator);
                if (itemId != null)
                {
                    object obj = persistablePropertyBag.TryGetProperty(CoreItemSchema.ReadCnNew);
                    if (obj is byte[] && ((byte[])obj).Length > 0)
                    {
                        changeKey     = itemId.ChangeKeyAsByteArray();
                        storeObjectId = itemId.ObjectId;
                        origin        = Origin.Existing;
                    }
                }
                coreItem = new CoreItem(session, persistablePropertyBag, storeObjectId, changeKey, origin, ItemLevel.TopLevel, itemCreateInfo.Schema.AutoloadProperties, ItemBindOption.None);
                flag     = true;
                result   = coreItem;
            }
            finally
            {
                if (!flag)
                {
                    Util.DisposeIfPresent(coreItem);
                    Util.DisposeIfPresent(persistablePropertyBag);
                }
            }
            return(result);
        }
Ejemplo n.º 5
0
        internal static T CreateNewItem <T>(StoreSession session, ItemCreateInfo itemCreateInfo, ItemBuilder.MapiMessageCreator mapiMessageCreator) where T : Item
        {
            T        t        = default(T);
            CoreItem coreItem = null;
            bool     flag     = false;
            T        result;

            try
            {
                coreItem = ItemBuilder.CreateNewCoreItem(session, itemCreateInfo, true, mapiMessageCreator);
                t        = (T)((object)itemCreateInfo.Creator(coreItem));
                flag     = true;
                result   = t;
            }
            finally
            {
                if (!flag)
                {
                    Util.DisposeIfPresent(t);
                    Util.DisposeIfPresent(coreItem);
                }
            }
            return(result);
        }
Ejemplo n.º 6
0
        private static Dictionary <StoreObjectType, ItemCreateInfo> CreateDictionary()
        {
            ItemCreateInfo.RightsManagedMessageItemInfo         = new ItemCreateInfo(StoreObjectType.RightsManagedMessage, RightsManagedMessageItemSchema.Instance, AcrProfile.MessageProfile, new ItemCreateInfo.ItemCreator(ItemCreateInfo.RightsManagedMessageItemCreator));
            ItemCreateInfo.SharingMessageItemInfo               = new ItemCreateInfo(StoreObjectType.SharingMessage, SharingMessageItemSchema.Instance, AcrProfile.MessageProfile, new ItemCreateInfo.ItemCreator(ItemCreateInfo.SharingMessageItemCreator));
            ItemCreateInfo.PushNotificationSubscriptionItemInfo = new ItemCreateInfo(StoreObjectType.PushNotificationSubscription, PushNotificationSubscriptionItemSchema.Instance, AcrProfile.GenericItemProfile, new ItemCreateInfo.ItemCreator(ItemCreateInfo.PushNotificationSubscriptionItemCreator));
            ItemCreateInfo.GroupMailboxJoinRequestMessageInfo   = new ItemCreateInfo(StoreObjectType.GroupMailboxRequestMessage, GroupMailboxJoinRequestMessageSchema.Instance, AcrProfile.MessageProfile, new ItemCreateInfo.ItemCreator(ItemCreateInfo.GroupMailboxJoinRequestMessageItemCreator));
            ItemCreateInfo.CalendarItemOccurrenceInfo           = ItemCreateInfo.CreateCalendarItemOccurrenceInfo();
            ItemCreateInfo.ReportInfo                           = ItemCreateInfo.CreateReportInfo();
            ItemCreateInfo.MessageItemInfo                      = ItemCreateInfo.CreateMessageItemInfo();
            ItemCreateInfo.PostInfo                             = ItemCreateInfo.CreatePostInfo();
            ItemCreateInfo.CalendarItemInfo                     = ItemCreateInfo.CreateCalendarItemInfo();
            ItemCreateInfo.CalendarItemSeriesInfo               = ItemCreateInfo.CreateCalendarItemSeriesInfo();
            ItemCreateInfo.ParkedMeetingMessageInfo             = ItemCreateInfo.CreateParkedMeetingMessageInfo();
            ItemCreateInfo.MeetingRequestInfo                   = ItemCreateInfo.CreateMeetingRequestInfo();
            ItemCreateInfo.MeetingRequestSeriesInfo             = ItemCreateInfo.CreateMeetingRequestSeriesInfo();
            ItemCreateInfo.MeetingResponseInfo                  = ItemCreateInfo.CreateMeetingResponseInfo();
            ItemCreateInfo.MeetingResponseSeriesInfo            = ItemCreateInfo.CreateMeetingResponseSeriesInfo();
            ItemCreateInfo.MeetingCancellationInfo              = ItemCreateInfo.CreateMeetingCancellationInfo();
            ItemCreateInfo.MeetingCancellationSeriesInfo        = ItemCreateInfo.CreateMeetingCancellationSeriesInfo();
            ItemCreateInfo.MeetingForwardNotificationInfo       = ItemCreateInfo.CreateMeetingForwardNotificationInfo();
            ItemCreateInfo.MeetingForwardNotificationSeriesInfo = ItemCreateInfo.CreateMeetingForwardNotificationSeriesInfo();
            ItemCreateInfo.MeetingInquiryInfo                   = ItemCreateInfo.CreateMeetingInquiryInfo();
            ItemCreateInfo.ContactInfo                          = ItemCreateInfo.CreateContactInfo();
            ItemCreateInfo.PlaceInfo                            = ItemCreateInfo.CreatePlaceInfo();
            ItemCreateInfo.DistributionListInfo                 = ItemCreateInfo.CreateDistributionListInfo();
            ItemCreateInfo.MailboxAssociationGroupInfo          = ItemCreateInfo.CreateMailboxAssociationGroupInfo();
            ItemCreateInfo.MailboxAssociationUserInfo           = ItemCreateInfo.CreateMailboxAssociationUserInfo();
            ItemCreateInfo.HierarchySyncMetadataInfo            = ItemCreateInfo.CreateHierarchySyncMetadataInfo();
            ItemCreateInfo.TaskInfo                             = ItemCreateInfo.CreateTaskInfo();
            ItemCreateInfo.TaskRequestInfo                      = ItemCreateInfo.CreateTaskRequestInfo();
            ItemCreateInfo.ReminderMessageInfo                  = ItemCreateInfo.CreateReminderMessageInfo();
            ItemCreateInfo.GenericItemInfo                      = ItemCreateInfo.CreateGenericItemInfo();
            ItemCreateInfo.ConversationActionInfo               = ItemCreateInfo.CreateConversationActionInfo();
            ItemCreateInfo.OofMessageItemInfo                   = ItemCreateInfo.CreateOofMessageItemInfo();
            ItemCreateInfo.ExternalOofMessageItemInfo           = ItemCreateInfo.CreateExternalOofMessageItemInfo();
            ItemCreateInfo.CalendarGroupInfo                    = ItemCreateInfo.CreateCalendarGroupInfo();
            ItemCreateInfo.CalendarGroupEntryInfo               = ItemCreateInfo.CreateCalendarGroupEntryInfo();
            ItemCreateInfo.FavoriteFolderEntryInfo              = ItemCreateInfo.CreateFavoriteFolderEntryInfo();
            ItemCreateInfo.ShortcutMessageInfo                  = ItemCreateInfo.CreateShortcutMessageInfo();
            ItemCreateInfo.TaskGroupInfo                        = ItemCreateInfo.CreateTaskGroupInfo();
            ItemCreateInfo.TaskGroupEntryInfo                   = ItemCreateInfo.CreateTaskGroupEntryInfo();
            ItemCreateInfo.OutlookServiceSubscriptionItemInfo   = ItemCreateInfo.CreateOutlookServiceSubscriptionItemInfo();
            ItemCreateInfo.ConfigurationItemInfo                = ItemCreateInfo.CreateConfigurationItemInfo();
            Dictionary <StoreObjectType, ItemCreateInfo> dictionary = new Dictionary <StoreObjectType, ItemCreateInfo>(new StoreObjectTypeComparer());

            ItemCreateInfo[] array = new ItemCreateInfo[]
            {
                ItemCreateInfo.RightsManagedMessageItemInfo,
                ItemCreateInfo.SharingMessageItemInfo,
                ItemCreateInfo.PushNotificationSubscriptionItemInfo,
                ItemCreateInfo.CalendarItemOccurrenceInfo,
                ItemCreateInfo.ReportInfo,
                ItemCreateInfo.MessageItemInfo,
                ItemCreateInfo.PostInfo,
                ItemCreateInfo.CalendarItemInfo,
                ItemCreateInfo.CalendarItemSeriesInfo,
                ItemCreateInfo.ParkedMeetingMessageInfo,
                ItemCreateInfo.MeetingRequestInfo,
                ItemCreateInfo.MeetingRequestSeriesInfo,
                ItemCreateInfo.MeetingResponseInfo,
                ItemCreateInfo.MeetingResponseSeriesInfo,
                ItemCreateInfo.MeetingCancellationInfo,
                ItemCreateInfo.MeetingCancellationSeriesInfo,
                ItemCreateInfo.MeetingForwardNotificationInfo,
                ItemCreateInfo.MeetingForwardNotificationSeriesInfo,
                ItemCreateInfo.MeetingInquiryInfo,
                ItemCreateInfo.ContactInfo,
                ItemCreateInfo.PlaceInfo,
                ItemCreateInfo.DistributionListInfo,
                ItemCreateInfo.MailboxAssociationGroupInfo,
                ItemCreateInfo.MailboxAssociationUserInfo,
                ItemCreateInfo.HierarchySyncMetadataInfo,
                ItemCreateInfo.TaskInfo,
                ItemCreateInfo.TaskRequestInfo,
                ItemCreateInfo.ReminderMessageInfo,
                ItemCreateInfo.GenericItemInfo,
                ItemCreateInfo.ConversationActionInfo,
                ItemCreateInfo.OofMessageItemInfo,
                ItemCreateInfo.ExternalOofMessageItemInfo,
                ItemCreateInfo.CalendarGroupInfo,
                ItemCreateInfo.CalendarGroupEntryInfo,
                ItemCreateInfo.FavoriteFolderEntryInfo,
                ItemCreateInfo.ShortcutMessageInfo,
                ItemCreateInfo.TaskGroupInfo,
                ItemCreateInfo.TaskGroupEntryInfo,
                ItemCreateInfo.GroupMailboxJoinRequestMessageInfo,
                ItemCreateInfo.OutlookServiceSubscriptionItemInfo,
                ItemCreateInfo.ConfigurationItemInfo
            };
            foreach (ItemCreateInfo itemCreateInfo in array)
            {
                dictionary.Add(itemCreateInfo.Type, itemCreateInfo);
            }
            return(dictionary);
        }
Ejemplo n.º 7
0
        public ICoreItem OpenAttachedItem(ICollection <PropertyDefinition> propertiesToLoad, AttachmentPropertyBag attachmentBag, bool isNew)
        {
            MapiMessage            mapiMessage            = null;
            PersistablePropertyBag persistablePropertyBag = null;
            CoreItem      coreItem      = null;
            bool          flag          = false;
            StoreObjectId storeObjectId = null;

            byte[]    array = null;
            ICoreItem result;

            try
            {
                StoreObjectPropertyBag storeObjectPropertyBag = (StoreObjectPropertyBag)attachmentBag.PersistablePropertyBag;
                MapiAttach             mapiAttach             = (MapiAttach)storeObjectPropertyBag.MapiProp;
                StoreSession           session           = this.AttachmentCollection.ContainerItem.Session;
                OpenPropertyFlags      openPropertyFlags = isNew ? OpenPropertyFlags.Create : (this.AttachmentCollection.IsReadOnly ? OpenPropertyFlags.BestAccess : OpenPropertyFlags.BestAccess);
                openPropertyFlags |= OpenPropertyFlags.DeferredErrors;
                string text   = storeObjectPropertyBag.TryGetProperty(InternalSchema.ItemClass) as string;
                Schema schema = (text != null) ? ObjectClass.GetSchema(text) : MessageItemSchema.Instance;
                propertiesToLoad = InternalSchema.Combine <PropertyDefinition>(schema.AutoloadProperties, propertiesToLoad);
                StoreSession session2 = this.AttachmentCollection.ContainerItem.Session;
                bool         flag2    = false;
                try
                {
                    if (session2 != null)
                    {
                        session2.BeginMapiCall();
                        session2.BeginServerHealthCall();
                        flag2 = true;
                    }
                    if (StorageGlobals.MapiTestHookBeforeCall != null)
                    {
                        StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                    }
                    mapiMessage = mapiAttach.OpenEmbeddedMessage(openPropertyFlags);
                }
                catch (MapiPermanentException ex)
                {
                    throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotOpenEmbeddedMessage, ex, session2, this, "{0}. MapiException = {1}.", new object[]
                    {
                        string.Format("MapiAttachmentProvider::OpenAttachedItem", new object[0]),
                        ex
                    });
                }
                catch (MapiRetryableException ex2)
                {
                    throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotOpenEmbeddedMessage, ex2, session2, this, "{0}. MapiException = {1}.", new object[]
                    {
                        string.Format("MapiAttachmentProvider::OpenAttachedItem", new object[0]),
                        ex2
                    });
                }
                finally
                {
                    try
                    {
                        if (session2 != null)
                        {
                            session2.EndMapiCall();
                            if (flag2)
                            {
                                session2.EndServerHealthCall();
                            }
                        }
                    }
                    finally
                    {
                        if (StorageGlobals.MapiTestHookAfterCall != null)
                        {
                            StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                        }
                    }
                }
                persistablePropertyBag = new StoreObjectPropertyBag(session, mapiMessage, propertiesToLoad);
                if (!isNew)
                {
                    StoreObjectType storeObjectType = ItemBuilder.ReadStoreObjectTypeFromPropertyBag(persistablePropertyBag);
                    ItemCreateInfo  itemCreateInfo  = ItemCreateInfo.GetItemCreateInfo(storeObjectType);
                    propertiesToLoad = InternalSchema.Combine <PropertyDefinition>(itemCreateInfo.Schema.AutoloadProperties, propertiesToLoad);
                    if (this.AttachmentCollection.IsReadOnly)
                    {
                        StoreId.SplitStoreObjectIdAndChangeKey(StoreObjectId.DummyId, out storeObjectId, out array);
                    }
                    persistablePropertyBag = new AcrPropertyBag(persistablePropertyBag, itemCreateInfo.AcrProfile, storeObjectId, new RetryBagFactory(session), array);
                }
                coreItem = new CoreItem(session, persistablePropertyBag, storeObjectId, array, isNew ? Origin.New : Origin.Existing, ItemLevel.Attached, propertiesToLoad, ItemBindOption.None);
                if (text != null && isNew)
                {
                    coreItem.PropertyBag[InternalSchema.ItemClass] = text;
                }
                flag   = true;
                result = coreItem;
            }
            finally
            {
                if (!flag)
                {
                    if (coreItem != null)
                    {
                        coreItem.Dispose();
                        coreItem = null;
                    }
                    if (persistablePropertyBag != null)
                    {
                        persistablePropertyBag.Dispose();
                        persistablePropertyBag = null;
                    }
                    if (mapiMessage != null)
                    {
                        mapiMessage.Dispose();
                        mapiMessage = null;
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 8
0
 internal static CoreItem CreateNewCoreItem(StoreSession session, ItemCreateInfo itemCreateInfo, bool useAcr, ItemBuilder.MapiMessageCreator mapiMessageCreator)
 {
     return(ItemBuilder.CreateNewCoreItem(session, itemCreateInfo, null, useAcr, mapiMessageCreator));
 }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
 internal static T CreateNewItem <T>(StoreSession session, StoreId parentFolderId, ItemCreateInfo itemCreateInfo, CreateMessageType createMessageType) where T : Item
 {
     return(ItemBuilder.CreateNewItem <T>(session, itemCreateInfo, () => Folder.InternalCreateMapiMessage(session, parentFolderId, createMessageType)));
 }
Ejemplo n.º 11
0
 internal static T CreateNewItem <T>(StoreSession session, StoreId parentFolderId, ItemCreateInfo itemCreateInfo) where T : Item
 {
     return(ItemBuilder.CreateNewItem <T>(session, parentFolderId, itemCreateInfo, CreateMessageType.Normal));
 }