My blog has moved!

Visit http://blog.adamroderick.com/ and update your bookmarks.

Friday, October 30, 2009

Hiding "Unhideable" Actions in SharePoint

Often, I will get requests to hide certain actions in SharePoint.  Many items can be hidden using the HideCustomAction (also see here and here) element.  But not every item can be hidden this way.

Today's request was hiding the "Edit in Data Sheet” for a certain list only

image

To use the snippet below, you will have to get jQuery into your SharePoint pages first.  Because this list was created from a custom list definition, I had control over the views of the list definition.  In the footer of the view that displays the list, I added a jQuery snippet to remove the menu item that I wanted to hide.  Below is the list definition schema.xml file, with my jQuery snippet circled:

image

The view footer is located in the second view at List/MetaData/Views/.  In the ViewFooter element, you will notice the HTML elements that can contain CDATA blocks with any HTML you want.  The jQuery selector [id$=’EditInGridButton’] grabs the element with the ID that ends in EditInGridButton.  Then it removes that element from the DOM with the remove() function.  I tried the hide() function first, but that did not work.  The result is exactly what I wanted:

image

To explain the weird selector—when I viewed the HTML source to get the ID of the button, I noticed it was prepended with zz16_ making the id zz16_EditInGridButton:

image

The zz16_ is due to the theme being applied.  Since I wanted this to work for any them, I couldn’t match on the whole id value.  The selector above says “get me any DOM element with an id that ENDS with EditInGridButton.”

Labels: ,

Thursday, October 29, 2009

SharePoint Document Library & Folder Security Screenshots

 

SharePoint security can be very granular. Security permissions can apply to Document Libraries, Folders within Document Libraries, and individual Documents. Security permissions can be applied to individual SharePoint users as well as groups of SharePoint users. Below are some screenshots and information demonstrating these concepts

SharePoint Groups

In the screenshot below, two new groups have been created:

clip_image002[4]

Folder Security

This screenshot shows a Document Library named FolderSecurityDemo. It has two folders, Information Technology and Human Resources:

clip_image004[4]

These screenshots show managing security for folders. We must first stop inheriting permissions from the parent (which is the Document Library). We can then remove permissions from everyone but administrators and members of the Human Resources group:

clip_image006[4]

clip_image008[4]

clip_image010[4]

clip_image012[4]

Other Options

You can do similar operations at the Document Library level—for example, if you want executives or auditors to be able to read all Documents in the Document Library, but not be able to edit anything. Another example might be granting read-only permissions to a group so they could read but not edit folders that pertain to a different group.

Another option would be to have separate lists for each department, with each list containing only a custom content type (for example, the “Policies and Procedures” content type). This would allow good segregation, while still being able to query across lists using the content type.

References

· Documentation: http://office.microsoft.com/en-us/help/HA100215641033.aspx

· Video walking through some aspects of SharePoint security and permissions: http://www.youtube.com/watch?v=vZaV-dmOK0I

Friday, October 2, 2009

Easy Feature Deployment for SharePoint Development

This file has 4 .bat scripts that have helped our teams develop SharePoint Features more quickly.

The zip file contains a folder named Deployment, which has the following 5 files:
  • Deploy.bat - This will install then activate the Feature
  • Undeploy.bat - Ths will deactivate then uninstall the Feature
  • Redeploy.bat - This basically calls Undeploy then calls Deploy
  • Reactivate.bat - This deactivates then activates the Feature
  • Setup.bat - called by the other 4 scripts, will do nothing if you run it directly

All you have to do is put the Deployment folder into any feature folder, like this:

12\TEMPLATE\FEATURES\MyFeature\Deployment

The scripts will work for any Feature. They determine the Feature-specific information from the folder structure. You will want to change the URL parameter. Just edit Setup.bat and change change URL=http://localhost:5600 to whatever URL you want to use to activate the Feature.

Download Scripts