Example #1
0
 protected virtual void InternalSetProperty(MdbPropertyMapping mdbMapping, object value)
 {
     if (this.allowItemBind)
     {
         this.InitializeItemIfNecessary();
         MdbDocumentAdapter.CallXsoAndMapExceptions(this.diagnosticsSession, this.id.MailboxGuid, delegate
         {
             mdbMapping.SetPropertyValue(this.Item, value, new MdbDocumentAdapter.MdbDocAdapterPropertyContext
             {
                 MailboxSession = this.Session
             });
         });
         if (this.mappedPropertiesToLoadOnBind != null)
         {
             foreach (StorePropertyDefinition item in mdbMapping.StorePropertyDefinitions)
             {
                 if (!this.mappedPropertiesToLoadOnBind.Contains(item))
                 {
                     this.mappedPropertiesToLoadOnBind.Add(item);
                 }
             }
             return;
         }
     }
     else
     {
         mdbMapping.SetPropertyValue(this.preloadedProperties, value);
     }
 }
Example #2
0
        private static TReturnValue CallXsoAndMapExceptionsWithReturnValue <TReturnValue>(IDiagnosticsSession tracer, Guid mailboxGuid, MdbDocumentAdapter.CallXsoWithReturnValue <TReturnValue> xsoCall)
        {
            TReturnValue result = default(TReturnValue);

            MdbDocumentAdapter.CallXsoAndMapExceptions(tracer, mailboxGuid, delegate
            {
                result = xsoCall();
            });
            return(result);
        }
Example #3
0
        protected virtual IItem GetItem()
        {
            IItem item = null;

            MdbDocumentAdapter.CallXsoAndMapExceptions(this.diagnosticsSession, this.id.MailboxGuid, delegate
            {
                HashSet <PropertyDefinition> propsToReturn = new HashSet <PropertyDefinition>(this.mappedPropertiesToLoadOnBind);
                item = Microsoft.Exchange.Data.Storage.Item.Bind(this.Session, this.id.ItemId, ItemBindOption.None, propsToReturn);
                item.OpenAsReadWrite();
            });
            return(item);
        }
Example #4
0
 public virtual void Save(bool reload)
 {
     if (this.Item == null)
     {
         throw new OperationFailedException(Strings.SaveWithNoItemError);
     }
     if (this.Item.IsDirty)
     {
         MdbDocumentAdapter.CallXsoAndMapExceptions(this.diagnosticsSession, this.id.MailboxGuid, delegate
         {
             this.Item.Save(SaveMode.ResolveConflicts);
             if (reload)
             {
                 this.Item.Load(this.mappedPropertiesToLoadOnBind);
             }
         });
         return;
     }
 }