0

What is the best way to preconfigure a custom SharePoint WebPart?

Is it e.g. possible to add a textfile to the WSP package and simply read the file from the WebPart? I couldn't figure out a way to retrieve the path of the textfile after the deployment.

Or can I somehow add key value pairs to the .webpart file and access them from my WebPart?

1 Answers1

2

The schema for .webpart files is here:
http://msdn.microsoft.com/en-us/library/ms227561.aspx
and allows for you to set default value properties for your WebPart.

Also, since you are running in the context of an assembly, you could read a file of config data from inside that assembly. The first answer to this question shows you how:
How to read embedded resource text file

Community
  • 1
  • 1
Mark Mascolino
  • 2,227
  • 1
  • 15
  • 19