Wednesday, May 09, 2007

SharePoint fine grained permission control

Just located this blog - an excellent description of how to extend SharePoint permissions to avoid approvers having delete rights.

Wednesday, May 02, 2007

Approve a SPFolder programmatically

If you are creating folders programmatically in SharePoint you'll notice that they turn of with "Approval Status" Pending.

Conclusion: And it's just sooo simple --> check out this.

Luckily it seems that you can programmatically change the _ModerationStatus of a folder item using the ProcessBatchData operation of the SPWeb object as outlined in this blog.

Unfortunately for me I can't get it working - yet. My code for ProcessBatchData looks like this:

<?xml version="1.0" encoding="UTF-8"?><ows:Batch OnError="Continue" >
<SetList Scope="Request">{5234ebfe-58c5-4af3-8879-cde8ade42315}</SetList>
<SetVar Name="DatesInGregorian">TRUE</SetVar>
<Method ID="1,Update">
<SetVar Name="Cmd">Save</SetVar>
<SetVar Name="ID">14</SetVar>
<SetVar Name="owshiddenversion">1</SetVar>
<SetVar Name="owsfileref">http://intranet/Projects/Labbooks/ABC</SetVar>
<SetVar Name="urn:schemas-microsoft-com:office:office#_ModerationStatus">0</SetVar>
<SetVar Name="urn:schemas-microsoft-com:office:office#_ModerationComments">Exformatics Approved Folder</SetVar>

I get a proper reply back - but the folder is not yet approved. Maybe it only works in SharePoint 2003 and not in MOSS 2007. However, according to Joris Poelmans ProcessBatchData also works for MOSS 2007 - at least for creating new pages.

A good description with similar syntax can be found here - but not working either :-(