示例#1
0
        internal static PropertyError[] MapiCopyTo(MapiProp source, MapiProp destination, StoreSession sourceSession, StoreSession destSession, CopyPropertiesFlags copyPropertiesFlags, CopySubObjects copySubObjects, params NativeStorePropertyDefinition[] excludeProperties)
        {
            Util.ThrowOnNullArgument(source, "sources");
            Util.ThrowOnNullArgument(destination, "destination");
            ICollection <PropTag> excludeTags = PropertyTagCache.Cache.PropTagsFromPropertyDefinitions(source, sourceSession, true, excludeProperties);

            PropProblem[] problems = null;
            bool          flag     = false;

            try
            {
                if (sourceSession != null)
                {
                    sourceSession.BeginMapiCall();
                    sourceSession.BeginServerHealthCall();
                    flag = true;
                }
                if (StorageGlobals.MapiTestHookBeforeCall != null)
                {
                    StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                }
                try
                {
                    problems = source.CopyTo(destination, false, CoreObject.ToCopyPropertiesFlags(copyPropertiesFlags), copySubObjects == CopySubObjects.Copy, excludeTags);
                }
                catch (MapiExceptionNamedPropsQuotaExceeded)
                {
                    PropTag[] propList = source.GetPropList();
                    NativeStorePropertyDefinition[] propertyDefinitions = PropertyTagCache.Cache.PropertyDefinitionsFromPropTags(NativeStorePropertyDefinition.TypeCheckingFlag.DisableTypeCheck, source, sourceSession, propList);
                    ICollection <PropTag>           collection          = PropertyTagCache.Cache.PropTagsFromPropertyDefinitions(destination, destSession, true, true, true, propertyDefinitions);
                    List <PropTag> list = new List <PropTag>(collection.Count);
                    int            num  = 0;
                    foreach (PropTag propTag in collection)
                    {
                        if (propTag == PropTag.Unresolved)
                        {
                            list.Add(propList[num]);
                        }
                        num++;
                    }
                    problems = source.CopyTo(destination, list);
                }
            }
            catch (MapiPermanentException ex)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotCopyMapiProps, ex, sourceSession, source, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("CoreItem::MapiCopyTo.", new object[0]),
                    ex
                });
            }
            catch (MapiRetryableException ex2)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotCopyMapiProps, ex2, sourceSession, source, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("CoreItem::MapiCopyTo.", new object[0]),
                    ex2
                });
            }
            finally
            {
                try
                {
                    if (sourceSession != null)
                    {
                        sourceSession.EndMapiCall();
                        if (flag)
                        {
                            sourceSession.EndServerHealthCall();
                        }
                    }
                }
                finally
                {
                    if (StorageGlobals.MapiTestHookAfterCall != null)
                    {
                        StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                    }
                }
            }
            CoreObject.ProcessCopyPropertyProblems(problems, sourceSession, source);
            return(CoreObject.ToXsoPropertyErrors(destSession, destination, problems));
        }
示例#2
0
 public PropertyError[] CopyAttachment(CoreAttachment destinationAttachment, CopyPropertiesFlags copyPropertiesFlags, CopySubObjects copySubObjects, NativeStorePropertyDefinition[] excludeProperties)
 {
     this.CheckDisposed(null);
     Util.ThrowOnNullArgument(destinationAttachment, "destinationAttachment");
     Util.ThrowOnNullArgument(excludeProperties, "excludeProperties");
     EnumValidator.ThrowIfInvalid <CopyPropertiesFlags>(copyPropertiesFlags, "copyPropertiesFlags");
     EnumValidator.ThrowIfInvalid <CopySubObjects>(copySubObjects, "copySubObjects");
     return(CoreObject.MapiCopyTo(this.PropertyBag.MapiProp, destinationAttachment.PropertyBag.MapiProp, this.Session, destinationAttachment.Session, copyPropertiesFlags, copySubObjects, excludeProperties));
 }
示例#3
0
 PropertyError[] ICoreItem.CopyItem(ICoreItem destinationItem, CopyPropertiesFlags copyPropertiesFlags, CopySubObjects copySubObjects, NativeStorePropertyDefinition[] excludeProperties)
 {
     return(this.CoreItem.CopyItem(destinationItem, copyPropertiesFlags, copySubObjects, excludeProperties));
 }