Example #1
0
 void DeleteRemovedLearnerFolders(AssignmentFolder assignmentFolder, AssignmentProperties oldAssignmentProperties)
 {
     foreach (SlkUser oldLearner in oldAssignmentProperties.Learners)
     {
         if (!assignmentProperties.Learners.Contains(oldLearner.UserId))
         {
             // Get learner subfolder, and delete it if exists
             AssignmentFolder learnerSubFolder = assignmentFolder.FindLearnerFolder(oldLearner.SPUser);
             if (learnerSubFolder != null)
             {
                 learnerSubFolder.Delete();
             }
         }
     }
 }
Example #2
0
        /// <summary>Deletes the assignment folder.</summary>
        public void DeleteAssignmentFolder()
        {
            SPSecurity.RunWithElevatedPrivileges(delegate
            {
                using (SPSite spSite = new SPSite(assignmentProperties.SPSiteGuid))
                {
                    using (SPWeb spWeb = spSite.OpenWeb(assignmentProperties.SPWebGuid))
                    {
                        DropBox dropBox = new DropBox(store, spWeb);

                        //Get the folder if it exists
                        AssignmentFolder assignmentFolder = dropBox.GetAssignmentFolder(assignmentProperties);

                        if (assignmentFolder != null)
                        {
                            using (new AllowUnsafeUpdates(spWeb))
                            {
                                assignmentFolder.Delete();
                            }
                        }
                    }
                }
            });
        }