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); } }
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); }
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); }
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; } }