I’ve been spending a lot of time working in the SharePoint client side object model (CSOM) and one of the things I initially struggled with was waiting for SharePoint client dependencies to load before my code starts executing.
Here’s some information on SharePoint Role Definitions
Role Definitions can be created quite easily
$spRoleDef = New-Object Microsoft.SharePoint.SPRoleDefinition $spRoleDef.Name = "Custom Permission Level" $spRoleDef.Description = "This is the description of a custom Permission Level" $spRoleDef.BasePermissions = ("ViewListItems","AddListItems","EditListItems") $spWeb.RoleDefinitions.Add($spRoleDef);
However, I kept getting SharePoint errors when I ran this script
Exception calling "Add" with "1" argument(s): "You cannot customize permission levels in a web site with inherited permission levels." At line:38 char:17 + $Web.RoleDefinitions.Add($spRoleDef); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) , MethodInvocationException + FullyQualifiedErrorId : ArgumentException
Again, this seemed like one of those common issues because there were a lot of posts online about how to fix it. You have to break inheritance with the site’s parent.
This makes perfect sense. If you’re inheriting from the parent then obviously you can’t start adding your own custom Permission Levels.
The problem was that this didn’t work for me. I kept getting the exact same error as before
What I misunderstood was that there are different types of inheritance:
- There are the Users and Groups that have been assigned to the List
- and then there are the Permission Levels that can be assigned to the Users and Groups
It is the Permission Level inheritance that needs to be changed.
Once that was done, then the Permission Levels could be created
I was trying to write a Powershell script that would deploy several features to a SharePoint 2013 environment but I kept getting an error:
Error occurred in deployment step ‘Activate Features’: Cannot start service SPUserCodeV4 on computer ‘SERVERNAME’
A Google search revealed that this was quite a common problem with quite a simple fix:
- Open the Central Administration site
- Open System Settings and click on Manage Service on server
- Check to see if Microsoft SharePoint Foundation Sandboxed Code Service is running (it should be stopped)
- Start the service and retry deploying the Sandboxed solution.
The problem I had was that I was using Powershell to do my deployment and didn’t want to have to include any manual steps. Unfortunately I couldn’t find any blogs that discussed how to do that.
Recently I learned something new while working with SharePoint 2010.
I was working with a SP List’s NewForm page and was restricted to working on the client-side only (i.e. No server side code / web parts).
The basic scenario was that I had a List of Issues. Each individual Issue could then have related Issues.
So our List basically looked like:
- Issue ID
- Issue Name
- Related Issues (IDs)
The customer didn’t like the default lookup controls to select the Related Issues because they could have a LOT of Issues in the system at any one time (600+ Issues) and the default controls don’t really allow the user to filter, sort or do any other wonderful SharePoint things that we can normally do on a List.