Example #1
0
        void ISourceFolder.CopyTo(IFxProxy destFxProxy, CopyPropertiesFlags flags, PropTag[] excludeTags)
        {
            MrsTracer.ProxyClient.Function("ISourceFolder.CopyTo({0}): {1}", new object[]
            {
                flags,
                base.FolderName
            });
            byte[]          objectData = destFxProxy.GetObjectData();
            DataExportBatch dataExportBatch;

            if (base.ServerVersion[30])
            {
                dataExportBatch = base.MrsProxy.ISourceFolder_CopyTo(base.Handle, (int)flags, DataConverter <PropTagConverter, PropTag, int> .GetData(excludeTags), objectData);
            }
            else
            {
                dataExportBatch = base.MrsProxy.ISourceFolder_Export2(base.Handle, DataConverter <PropTagConverter, PropTag, int> .GetData(excludeTags), objectData);
            }
            long dataExportHandle = dataExportBatch.DataExportHandle;

            using (FxProxyReceiver fxProxyReceiver = new FxProxyReceiver(destFxProxy, false))
            {
                using (BufferedReceiver bufferedReceiver = new BufferedReceiver(fxProxyReceiver, false, base.MrsProxyClient.UseBuffering, base.MrsProxyClient.UseCompression))
                {
                    RemoteDataExport.ExportRoutine(base.MrsProxy, dataExportHandle, bufferedReceiver, dataExportBatch, base.MrsProxyClient.UseCompression);
                }
            }
        }
        void ISourceMailbox.CopyTo(IFxProxy destMailbox, PropTag[] excludeProps)
        {
            MrsTracer.ProxyClient.Function("RemoteSourceMailbox.CopyTo", new object[0]);
            base.VerifyMailboxConnection();
            byte[]          objectData      = destMailbox.GetObjectData();
            DataExportBatch dataExportBatch = base.MrsProxy.ISourceMailbox_Export2(base.Handle, DataConverter <PropTagConverter, PropTag, int> .GetData(excludeProps), objectData);

            using (FxProxyReceiver fxProxyReceiver = new FxProxyReceiver(destMailbox, false))
            {
                using (BufferedReceiver bufferedReceiver = new BufferedReceiver(fxProxyReceiver, false, base.MrsProxyClient.UseBuffering, base.MrsProxyClient.UseCompression))
                {
                    RemoteDataExport.ExportRoutine(base.MrsProxy, dataExportBatch.DataExportHandle, bufferedReceiver, dataExportBatch, base.MrsProxyClient.UseCompression);
                }
            }
        }
        void ISourceMailbox.ExportFolders(List <byte[]> folderIds, IFxProxyPool proxyPool, ExportFoldersDataToCopyFlags exportFoldersDataToCopyFlags, GetFolderRecFlags folderRecFlags, PropTag[] additionalFolderRecProps, CopyPropertiesFlags copyPropertiesFlags, PropTag[] excludeProps, AclFlags extendedAclFlags)
        {
            MrsTracer.ProxyClient.Function("RemoteSourceMailbox.ExportFolders", new object[0]);
            base.VerifyMailboxConnection();
            if (!base.ServerVersion[54])
            {
                throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "ISourceMailbox_ExportFolders");
            }
            DataExportBatch dataExportBatch = base.MrsProxy.ISourceMailbox_ExportFolders(base.Handle, folderIds, (int)exportFoldersDataToCopyFlags, (int)folderRecFlags, DataConverter <PropTagConverter, PropTag, int> .GetData(additionalFolderRecProps), (int)copyPropertiesFlags, DataConverter <PropTagConverter, PropTag, int> .GetData(excludeProps), (int)extendedAclFlags);

            using (IDataImport dataImport = new FxProxyPoolReceiver(proxyPool, false))
            {
                using (BufferedReceiver bufferedReceiver = new BufferedReceiver(dataImport, false, base.MrsProxyClient.UseBuffering, base.MrsProxyClient.UseCompression))
                {
                    RemoteDataExport.ExportRoutine(base.MrsProxy, dataExportBatch.DataExportHandle, bufferedReceiver, dataExportBatch, base.MrsProxyClient.UseCompression);
                }
            }
        }
Example #4
0
        void ISourceFolder.ExportMessages(IFxProxy destFolderProxy, CopyMessagesFlags flags, byte[][] entryIds)
        {
            MrsTracer.ProxyClient.Function("ISourceFolder.ExportMessages({0}): {1}", new object[]
            {
                flags,
                base.FolderName
            });
            byte[]          objectData       = destFolderProxy.GetObjectData();
            DataExportBatch dataExportBatch  = base.MrsProxy.ISourceFolder_ExportMessages(base.Handle, (int)flags, entryIds, objectData);
            long            dataExportHandle = dataExportBatch.DataExportHandle;

            using (FxProxyReceiver fxProxyReceiver = new FxProxyReceiver(destFolderProxy, false))
            {
                using (BufferedReceiver bufferedReceiver = new BufferedReceiver(fxProxyReceiver, false, base.MrsProxyClient.UseBuffering, base.MrsProxyClient.UseCompression))
                {
                    RemoteDataExport.ExportRoutine(base.MrsProxy, dataExportHandle, bufferedReceiver, dataExportBatch, base.MrsProxyClient.UseCompression);
                }
            }
        }
        void ISourceMailbox.ExportMessages(List <MessageRec> messages, IFxProxyPool proxyPool, ExportMessagesFlags flags, PropTag[] propsToCopyExplicitly, PropTag[] excludeProps)
        {
            MrsTracer.ProxyClient.Function("RemoteSourceMailbox.ExportMessages({0} messages)", new object[]
            {
                messages.Count
            });
            if (propsToCopyExplicitly != null)
            {
                throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "ISourceMailbox_ExportMessages");
            }
            base.VerifyMailboxConnection();
            using (IDataImport dataImport = new FxProxyPoolReceiver(proxyPool, false))
            {
                IDataMessage      dataMessage = new FxProxyPoolGetFolderDataResponseMessage(proxyPool.GetFolderData());
                DataMessageOpcode dataMessageOpcode;
                byte[]            targetObjectData;
                dataMessage.Serialize(base.MrsProxyClient.UseCompression, out dataMessageOpcode, out targetObjectData);
                DataExportBatch dataExportBatch;
                if (!base.ServerVersion[8])
                {
                    if ((flags & ExportMessagesFlags.OneByOne) != ExportMessagesFlags.None || excludeProps != null)
                    {
                        throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "ISourceMailbox_ExportMessages");
                    }
                    dataExportBatch = base.MrsProxy.ISourceMailbox_ExportMessageBatch2(base.Handle, messages, targetObjectData);
                }
                else
                {
                    int[] data = DataConverter <PropTagConverter, PropTag, int> .GetData(excludeProps);

                    dataExportBatch = base.MrsProxy.ISourceMailbox_ExportMessages(base.Handle, messages, (int)flags, data, targetObjectData);
                }
                MessageExportResultReceiver messageExportResultReceiver = null;
                IDataImport destination = dataImport;
                if (!base.ServerVersion[16])
                {
                    messageExportResultReceiver = new MessageExportResultReceiver(destination, false);
                    destination = messageExportResultReceiver;
                }
                using (messageExportResultReceiver)
                {
                    using (BufferedReceiver bufferedReceiver = new BufferedReceiver(destination, false, base.MrsProxyClient.UseBuffering, base.MrsProxyClient.UseCompression))
                    {
                        RemoteDataExport.ExportRoutine(base.MrsProxy, dataExportBatch.DataExportHandle, bufferedReceiver, dataExportBatch, base.MrsProxyClient.UseCompression);
                        if (messageExportResultReceiver != null)
                        {
                            List <BadMessageRec> badMessages = messageExportResultReceiver.BadMessages;
                            if (messageExportResultReceiver.MissingMessages != null)
                            {
                                foreach (MessageRec msg in messageExportResultReceiver.MissingMessages)
                                {
                                    badMessages.Add(BadMessageRec.MissingItem(msg));
                                }
                            }
                            if (badMessages != null && badMessages.Count > 0)
                            {
                                throw new DownlevelBadItemsPermanentException(badMessages);
                            }
                        }
                    }
                }
            }
        }