<Update 2014-08-18> The Office App Model Samples project has been transitioned over to the Office 365 Developer Patterns & Practices GitHub repo. Please use that location going forward for any references.</Update 2014-08-18>
During the SharePoint Conference 2014 I had the pleasure of meeting Vesa Juvonen (@vesajuvonen) and Steve Walker (Linked In) after their session “Real-world examples of FTC to CAM transformations” (video). This was a very valuable session to attend discussing examples of full trust code (FTC) solutions that were re-implemented / re-imagined as app model apps. They also mentioned a new CodePlex project gathering community app model samples called Office App Model Samples (Office AMS).
Over the past few years I’ve been toying around with various PowerShell scripts to enumerate permissions in an on-premise SharePoint farm (Enumerate SharePoint 2010/2013 Permissions, Enumerate SharePoint 2007 Permissions). I was curious to see if it was possible to enumerate permissions in a SharePoint Online tenant as well. I had tried using the official SharePoint Online Management Shell commandlets, Gary LaPointe’s custom SharePoint Online commandlets, and my own client side object model (CSOM) PowerShell queries with no luck. Looking through Gary’s source code though I found a way to get the permission information I needed via C# code and CSOM. This felt like a great idea to submit to the OfficeAMS project.
I’m happy to announce that my submission Core.PermissionListing is now published in the OfficeAMS project. Keep in mind this is a rough proof of concept. The sample iterates through all non-My Site site collections (something I borrowed from another OfficeAMS solution) in a SharePoint Online tenant and lists out the permissions assigned to groups or users and specifies the permission assigned. The output could definitely be cleaned up but that will be an effort for a later date. Hopefully you will find this and other app model samples useful. If you’d like to contribute or improve upon a solution you find please contact Vesa, Steve, or myself.