Example #1
0
        private void UpdateOtherView()
        {
            IResourceList allWorkspaces = _store.GetAllResources(_props.WorkspaceResourceType);

            foreach (IResource res in allWorkspaces)
            {
                IResourceList otherLinks = res.GetLinksTo("WorkspaceOtherView", _props.InWorkspace);
                if (otherLinks.Count == 0)
                {
                    IResource otherView = _store.BeginNewResource("WorkspaceOtherView");
                    otherView.SetProp("Name", "Other");
                    otherView.AddLink(_props.InWorkspace, res);
                    otherView.EndUpdate();
                }

                _resourceTreeManager.SetResourceNodeSort(res, "Type Name");
            }
        }
Example #2
0
        public static IResource FindOrCreate(FolderDescriptor folderDescriptor, IResource parentFolder)
        {
            Guard.NullArgument(folderDescriptor, "folderDescriptor");
            IResource MAPIStore = FindOrCreateMAPIStore(folderDescriptor.FolderIDs.StoreId);
            IResource resFolder =
                Core.ResourceStore.FindUniqueResource(STR.MAPIFolder, PROP.EntryID, folderDescriptor.FolderIDs.EntryId);

            if (resFolder != null)
            {
                resFolder.BeginUpdate();
            }
            else
            {
                resFolder = Core.ResourceStore.BeginNewResource(STR.MAPIFolder);
                Core.WorkspaceManager.AddToActiveWorkspaceRecursive(resFolder);
                resFolder.SetProp("EntryID", folderDescriptor.FolderIDs.EntryId);
                resFolder.SetProp("OwnerStore", MAPIStore);
                if (OutlookSession.IsDeletedItemsFolder(folderDescriptor.FolderIDs.EntryId))
                {
                    resFolder.SetProp(Core.Props.ShowDeletedItems, true);
                    resFolder.SetProp(PROP.DeletedItemsFolder, true);
                    resFolder.SetProp(PROP.DefaultDeletedItems, true);
                }
                if (parentFolder != null)
                {
                    SetIgnored(resFolder, IsIgnored(parentFolder));
                }
            }
            SetName(resFolder, folderDescriptor.Name);
            string containerClass = folderDescriptor.ContainerClass;

            resFolder.SetProp(PROP.PR_STORE_SUPPORT_MASK, folderDescriptor.StoreSupportMask);
            resFolder.SetProp(PROP.PR_CONTENT_COUNT, folderDescriptor.ContentCount);
            if (containerClass.Length > 0)
            {
                resFolder.SetProp(PROP.ContainerClass, containerClass);
            }
            containerClass = resFolder.GetPropText(PROP.ContainerClass);
            bool visible =
                (containerClass.Length == 0 || containerClass == FolderType.Mail ||
                 containerClass == FolderType.Post || containerClass == FolderType.IMAP || containerClass == FolderType.Dav);

            resFolder.SetProp(PROP.MAPIVisible, visible);

            if (parentFolder != null)
            {
                SetParent(resFolder, parentFolder);
            }
            else
            {
                Folder.SetAsRoot(resFolder);
            }
            resFolder.EndUpdate();
            _resourceTreeManager.SetResourceNodeSort(resFolder, STR.Name);
            return(resFolder);
        }
Example #3
0
        /**
         * Creates the new category root resource (which is the standard root of
         * resource type Category) and, if necessary, deletes the old root (which
         * was a category marked with the IsRoot property).
         */

        private void UpdateCategoryRoot()
        {
            _rootCategory             = _resourceTreeManager.GetRootForType("Category");
            _rootCategory.DisplayName = "Categories";
            _rootCategory.SetProp(Core.Props.Open, 1);
            _resourceTreeManager.SetResourceNodeSort(_rootCategory, "Name");
            _resourceTreeManager.LinkToResourceRoot(_rootCategory, 20);

            IResourceList typedCategories = _store.FindResourcesWithProp("Category", Core.Props.ContentType);

            foreach (IResource res in typedCategories)
            {
                if (res.GetLinkProp("Parent") == _rootCategory)
                {
                    IResource rootForType = GetRootForTypedCategory(res.GetStringProp(Core.Props.ContentType));
                    res.SetProp("Parent", rootForType);
                }
            }
        }