So I’ve finally published my Visual Studio theme on the Studio Styles website. It’s a customized version of the Ragnarok Grey theme created by Tomas Restrepro. I darkened the background then had to make a few other subtle changes for readability due to the darker background.
Ragnarok Dark as I’ve chosen to call it can be found here: http://studiostyl.es/schemes/ragnarok-dark-grey-customized
And remember to rate it if you like it!
Now a bonus for those of you that use ReSharper. The following line pasted into the bottom of the items section in the XML downloaded from the site before you import will make those To Do Comments and Not Implemented Exceptions stand out.
<Item Name="ReSharper Todo Item" Foreground="0x0000FFFF" Background="0x02000000" BoldFont="Yes"/>
When building a web part for SharePoint, you can use the .webpart file to set default values for almost all of the properties of that web part. But many people don’t know what those properties are or what they pertain to. Below is a listing of all the properties of an empty web part:
<type name=yourTypeHere" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
<property name="AllowClose" type="bool">True</property>
<property name="AllowConnect" type="bool">True</property>
<property name="AllowEdit" type="bool">True</property>
<property name="AllowHide" type="bool">True</property>
<property name="AllowMinimize" type="bool">True</property>
<property name="AllowZoneChange" type="bool">True</property>
<property name="CatalogIconImageUrl" type="string" />
<property name="ChromeState" type="chromestate">Normal</property>
<property name="ChromeType" type="chrometype">Default</property>
<property name="Description" type="string">My WebPart</property>
<property name="Direction" type="direction">NotSet</property>
<property name="ExportMode" type="exportmode">All</property>
<property name="Height" type="unit" />
<property name="HelpMode" type="helpmode">Navigate</property>
<property name="HelpUrl" type="string" />
<property name="Hidden" type="bool">False</property>
<property name="Title" type="string">Web Part Title</property>
<property name="TitleIconImageUrl" type="string" />
<property name="TitleUrl" type="string" />
<property name="Width" type="unit" />
For a definition and list of possible values for each of these properties, you can visit the MSDN pages for:
What about custom properties?
You can use SharePoint to create a reference for the properties of your web part. Install your web part, setup the web part the way you would like it by default, and then use the Verbs menu to Export the web part. Locate the exported file, open it in your favorite editor, and your XML is there! Simple right?
A client wished to push data into their SQL databases from an InfoPath form. Usually quite a simple task but the form was published to a SharePoint library and had fields published so they could be displayed in the library. We looked into a few different mechanisms but ultimately decided on a workflow set to start on creation or update of a list item. The workflow consisted only of a code block that produced the contents of the XML file stored in the SharePoint library and passed it into a stored procedure. The following code block was used produced the entire contents of the XML file as well as the file name.
The variable workflowProperties is an instance of SPWorkflowActivationProperties:
SPWorkflowActivationProperties workflowProperties = new SPWorkflowActivationProperties();
// get file contents
using (StreamReader reader = new StreamReader(workflowProperties.Item.File.OpenBinaryStream()))
contents = reader.ReadToEnd();
string fileName = Path.GetFileNameWithoutExtension(workflowProperties.Item.File.Name);
At this point, you can use code to get specific values or pass the entire XML string to SQL depending on your requirements. I would recommend using SharePoint’s unique ID for the list item to identify the record in SQL. This will allow you to synchronize any CRUD operation on the SharePoint record to the SQL record.