示例#1
0
        void CreateAssignmentView(AssignmentProperties properties)
        {
            StringCollection fields = new StringCollection();

            fields.Add(DropBoxList.Fields[SPBuiltInFieldId.DocIcon].InternalName);
            fields.Add(DropBoxList.Fields[SPBuiltInFieldId.LinkFilename].InternalName);
            fields.Add(DropBox.ColumnLearner);
            fields.Add(DropBoxList.Fields[SPBuiltInFieldId.Modified].InternalName);
            fields.Add(DropBox.ColumnIsLatest);

            string query = "<GroupBy Collapse=\"TRUE\" GroupLimit=\"100\"><FieldRef Name=\"{0}\" /></GroupBy><Where><Eq><FieldRef Name=\"{1}\" /><Value Type=\"Text\">{2}</Value></Eq></Where>";

            query = string.Format(CultureInfo.InvariantCulture, query, DropBox.ColumnLearner, DropBox.ColumnAssignmentId, properties.Id.GetKey());
            SPView view = DropBoxList.Views.Add(AssignmentViewName(properties), fields, query, 100, true, false, SPViewCollection.SPViewType.Html, false);

            view.Update();
            DropBoxList.Update();

            // Seem to need to re-get the view to set scope and group header.
            SPView view2 = DropBoxList.Views[view.ID];

            view2.Scope = SPViewScope.Recursive;
            DropBoxCreator.RemoveFieldNameFromGroupHeader(view2);
            view2.Update();
            DropBoxList.Update();
        }
示例#2
0
 SPListItem GetNoPermissionsFolder()
 {
     try
     {
         SPFolder folder = DropBoxList.RootFolder.SubFolders[NoPermissionsFolderName];
         return(folder.Item);
     }
     catch (ArgumentException)
     {
         return(DropBoxCreator.CreateNoPermissionsFolder(DropBoxList));
     }
 }
        /// <summary>
        /// Creates sub folder under a specific assignment folder, it is being named after the specified learner's name.
        /// </summary>
        SPListItem CreateSubFolder(string newFolderName)
        {
            SPFolder folder = assignmentFolder.Folder;

            using (new AllowUnsafeUpdates(web))
            {
                SPFolder learnerSubFolder = folder.SubFolders.Add(newFolderName);
                learnerSubFolder.Update();
                DropBoxCreator.ClearPermissions(learnerSubFolder.Item);
                return(learnerSubFolder.Item);
            }
        }
示例#4
0
        /// <summary>Creates the assignment folder.</summary>
        /// <param name="properties">The assignment properties.</param>
        /// <returns>The assignment folder.</returns>
        public AssignmentFolder CreateAssignmentFolder(AssignmentProperties properties)
        {
            string url = DropBoxList.RootFolder.ServerRelativeUrl;

            SPFolder noPermissionsFolder = GetNoPermissionsFolder().Folder;

            using (new AllowUnsafeUpdates(web))
            {
                string   name   = GenerateFolderName(properties);
                SPFolder folder = noPermissionsFolder.SubFolders.Add(name);
                folder.MoveTo(url + "\\" + name);
                folder.Update();
                SPListItem assignmentFolder = folder.Item;
                DropBoxCreator.ClearPermissions(assignmentFolder);
                DropBoxList.Update();
                CreateAssignmentView(properties);
                return(new AssignmentFolder(assignmentFolder, false, properties));
            }
        }