Friday, January 2, 2009

Size Matters: WorkItem Attachments

Workitems in TFS have a handy feature that allows you to attach files to them.

workitem_attachments

Notice the size column? It's not obvious but there is a size limit to attachments. The default setting is to allow documents less than 4 MB.

Great, but what if I need to attach a document that is bigger than 4 MB? Believe it or not this can happen quite easily if you have an big ol' image or some documentation that was kept in one single Word file. If you need to increase the attachment size you can make a call to the handy ConfigurationSettingsService web service. Here's the URL:

http://your.tfs.server:8080/WorkItemTracking/v1.0/ConfigurationSettingsService.asmx?op=SetMaxAttachmentSize

You'll need to access the machine that is running the App Tier of your TFS installation, usually by remote desktop. Then enter the URL in your browser and you should then get a page like this where you can enter the new maximum size in bytes and click "Invoke":

SetMaxAttachmentSize

Oh yeah, you need to be a member of the Adminstrators group on the Application Tier.

Now you can't just set it to any value - there is a maximum value of 2 GB that can't be exceeded. If you try to set a value larger than 2 GB you'll get this error:

System.Web.Services.Protocols.SoapException: TF51316: The maximum attachment size exceeds the allowable maximum of 2000000000 kilobytes. Upload a smaller file, or change the maximum value for the work item attachment size. 
at Microsoft.TeamFoundation.WorkItemTracking.Server.ExceptionManager.ThrowProperSoapException(Exception e)
at Microsoft.TeamFoundation.WorkItemTracking.Server.Global.WebMethodExceptionHandler(Exception e)
at Microsoft.TeamFoundation.Server.TeamFoundationWebServiceBase.HandleException(LogRecord requestRecord, Exception e)
at Microsoft.TeamFoundation.WorkItemTracking.Server.ConfigurationSettingsService.SetMaxAttachmentSize(Int64 maxSize)


Just remember that this setting changes it for all projects. So now we can increase the attachment size to let us upload that 800 MB Word document. Awesome.



Enjoy!

No comments: