Eventreceiver that triggers on unzipping a SharePoint 2010 DocumentSet after routing

Leave a comment

I needed to automatically convert documents that are added to a Records Library to PDF. The documents are part of a DocumentSet when they are submitted to the record centre. They are routed to their final destination and after that they are unpacked (unzipped). The moment they are unzipped I wanted to convert them, so I thought as a trigger I could use the ItemAdded event for each document that was unzipped.

The ItemAdded eventreciever triggers when the documentset is added to the Record Library by the content router (so far so good), but when the DocumentSet is unpacked (unzipped) the ItemAdded eventreceiver is not triggered at all. Instead, to my surprise, for each document that is unzipped the ItemUpdated event is triggered. Unexpected, but it does the job.


Set maximum upload filesize SharePoint WCF service

Leave a comment

When I changed a SharePoint asmx webservice to a WCF service I ran into the problem that out-of-the-box you can only upload files (as bytestreams) with a maximum filesize of about 18 KB (which is not a lot). After some searching on the internet I found that the WCF endpoint settings should not be set in web.config, but that there is a convenience class “SPWcfServiceSettings”.

I use the featureinstalled method of the feature eventreceiver of the SharePoint WCF service to set the servicesettings.

wcf settings

Settings for WCF service

Please note that even if the name of your service has capitals, like “DMSService.svc”, you still need to reference your service in all lower case: “dmsservice.svc”. If your service is hosted in a folder for example “DMSServices/DMSService.svc” you need to reference your service without the folder path: “dmsservice.svc”.

Update “Created by”, “Modified by”, “Author” and “Editor” fields

Leave a comment

Last month I was working on a project which used a webservice to upload files to a SharePoint document Library. The webservice had to run under a service account, so the “Created by”, “Modified by”, “Author” and “Editor” fields always had the same value (like “Administrator”). I wanted the fields to have the value of the person that actually loads up/edits the file.

I eventually used the method below where “userName” is the name of the user that the fields should be filled with, “item” is the actual item that has been created/uploaded and “isCreation” indicates if the item is created (true) or updated (false).

You need submit the userName in your request message and the userName has to be known in SharePoint.

Method example