Ejemplo n.º 1
0
        protected override StorageFxProxyPool.FolderEntry CreateFolder(FolderRec folderRec)
        {
            IDestinationMailbox destinationMailbox = this.destMailbox;

            byte[] folderID;
            destinationMailbox.CreateFolder(folderRec, CreateFolderFlags.None, out folderID);
            return(this.OpenFolder(folderID));
        }
Ejemplo n.º 2
0
        public void CreateMissingFolders()
        {
            IDestinationMailbox destMailbox = (IDestinationMailbox)this.MbxWrapper.Mailbox;

            base.EnumerateFolderHierarchy(EnumHierarchyFlags.AllFolders, delegate(FolderRecWrapper fRec, FolderMap.EnumFolderContext ctx)
            {
                if (fRec.EntryId != null)
                {
                    return;
                }
                FolderMapping fm      = (FolderMapping)fRec;
                fm.FolderRec.ParentId = fm.ParentId;
                ExecutionContext.Create(new DataContext[]
                {
                    new FolderRecWrapperDataContext(fRec)
                }).Execute(delegate
                {
                    byte[] array;
                    destMailbox.CreateFolder(fRec.FolderRec, CreateFolderFlags.FailIfExists, out array);
                    fm.FolderRec.EntryId = array;
                    this[array]          = fm;
                    if (fm.SourceFolder != null)
                    {
                        List <PropValueData> list = new List <PropValueData>();
                        list.Add(new PropValueData(this.SourceEntryIDPtag, fm.SourceFolder.EntryId));
                        list.Add(new PropValueData(this.SourceLastModifiedTimestampPtag, fm.SourceFolder.FolderRec.LastModifyTimestamp));
                        if (fm.SourceFolder.WKFType != WellKnownFolderType.None)
                        {
                            list.Add(new PropValueData(this.SourceWKFTypePtag, (int)fm.SourceFolder.WKFType));
                        }
                        using (IDestinationFolder folder = destMailbox.GetFolder(array))
                        {
                            if (folder != null)
                            {
                                folder.SetProps(list.ToArray());
                            }
                            else
                            {
                                MrsTracer.Service.Warning("Something just deleted newly created folder from under us. Ignoring.", new object[0]);
                            }
                        }
                        if (fm.SourceFolder.WKFType != WellKnownFolderType.None && this.GetWellKnownFolder(fm.SourceFolder.WKFType) == null)
                        {
                            this.SetWellKnownFolder(fm.SourceFolder.WKFType, fm);
                            if (this.RootFolder == this.RootRec && (this.MbxWrapper.Flags & MailboxWrapperFlags.Archive) == (MailboxWrapperFlags)0 && (this.MbxWrapper.Flags & MailboxWrapperFlags.PST) == (MailboxWrapperFlags)0)
                            {
                                this.WriteWellKnownFolderReference(fm.SourceFolder.WKFType, fm.EntryId);
                            }
                        }
                    }
                });
            });
        }