コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        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);
                            }
                        }
                    }
                }
            }
        }