Can I use files as custom SharePoint WebPart property?
Is it possible to use a file as custom SharePoint Webpart property?开发者_高级运维 I would like to provide a file upload box in the WebPart editing menu. ("Modify This Web Part" -> "Custom Properties").
According to the documentation (MSDN - Creating a Web Part with Custom Properties) by default only bool, int, string, enum and datetime types are supported.
Is there any way to allow the user to upload a file instead?
You could create a custom EditorPart (or Toolpart) that allows the user to upload a file. I like Bil Simser's blog because he helps mimic out of the box SharePoint styles: http://weblogs.asp.net/bsimser/archive/2009/08/12/spreading-some-sharepoint-love-to-editorpart.aspx
Here is another answer of someone who also needed a Toolpart and the example on MSDN.
精彩评论