Item level security with SharePoint web services
Or: Deploying WSS like services to SharePoint farms as solutions
While the SharePoint service model (found in /_vti_bin) supports retrieval of List and Web permissions, it supplies no way of fetching permissions for List items.
Implementing such as service is however fairly straight forward, so I typed up a quick example which:
- Provides a PermissionsEx.asmx service, which is a skeleton for your extended permission service needs.
- Exposes a demo GetListItemPermissions(listname, itemguidstring) function, which returns an xml structure of all permissions for the list item.
- Has various helper functions and classes, to easily retrieve assets from the SharePoint instance which hosts the service.
- Automatically wraps the service, and the additional files, in a .wsp solution. Upon deployment, this will put the service binary into the web app's bin folder, and the service endpoint into the isapi folder (which is where _vti_bin points).
There's not a lot of wizardry going on there, so it should be fairly self explanatory - if you're vaguely familiar with solutions and web services as such. I've structured the service in a manner similar to that of the original SharePoint web services, so if you've looked into these before, you should also feel quite at home.
What's worth noting is that if you decide to extend the service, and provide more functions, you should read up on Walkthrough: Creating a Custom Web Service to learn how to generate new discovery and wsdl files. Adapting these files from the generated versions is quite simple, but you'll have to make an extra step for XmlElement return types. Check the GetListItemPermissionCollectionResponse of the PermissionsExwsdl.aspx file to see the structure you'll need. Once new files are generated, you should overwrite those in the project directory.
If you've got any questions, or need help getting it all going, feel free to tweet me @einaros, or drop a comment here.

0 comments:
Post a Comment