Archive for the ‘Uncategorized’ Category
Developer’s Toolset for #SP2013 – Add MVC and mix in Razor!
The clear message from Microsoft for SharePoint 2013 development is a move to the app model. Here’s an introduction: http://msdn.microsoft.com/en-us/library/jj164084.aspx. SharePoint 2013 apps moves your code assemblies out of the SharePoint platform and into separate web applications. There are two reason for this:
1. A requirement for a more stable SharePoint platform. If you’re running SharePoint across your organization you don’t want badly written applications impacting reliability.
2. In Office 365 you can only add assemblies in sandboxed solutions. However, because of the very constrained subset of the SharePoint API available to such solutions their functionality is limited. Now, Office 365 will use functionality provided by SharePoint apps.
The move to SharePoint 2013 brings SharePoint 2013 developers fully back into the ASP.NET development fold. In particular, MVC with Razor greatly simplifies web application development. You will be using the SharePoint Client Object Model to access SharePoint objects from your app.
Here are some links that help you get started with building SharePoint 2013 apps:
- How to: Create high-trust apps for SharePoint 2013 using the server-to-server protocol: http://msdn.microsoft.com/en-us/library/office/apps/fp179901. Essential for building on-premise SharePoint 2013 apps.
- Building ASP.NET MVC Based SharePoint Cloud Apps: http://www.ilovesharepoint.com/2012/07/building-aspnet-mvc-based-sharepoint.html. A number of steps in this guide are automatically performed with Visual Studio 2012 released version.
- ASP.NET MVC 4: http://www.asp.net/mvc/tutorials/mvc-4. An excellent introduction to get you up to speed with ASP.NET MVC with Razor.
Ontology – An aside
Of course, ontology is not a new study (http://en.wikipedia.org/wiki/Ontology). The opening paragraphs in Aristotle’s “The History of Animals” (written 350 BCE) clearly shows this:
Of the parts of animals some are simple: to wit, all such as divide into parts uniform with themselves, as flesh into flesh; others are composite, such as divide into parts not uniform with themselves, as, for instance, the hand does not divide into hands nor the face into faces. And of such as these, some are called not parts merely, but limbs or members. Such are those parts that, while entire in themselves, have within themselves other diverse parts: as for instance, the head, foot, hand, the arm as a whole, the chest; for these are all in themselves entire parts, and there are other diverse parts belonging to them.
Translated by D’Arcy Wentworth Thompson (http://classics.mit.edu/Aristotle/history_anim.mb.txt)
Microsoft FAST Search Installation Guide
Microsoft FAST Search is becoming both more popular and relevant - rumor has it that it will be the only search and index option for SharePoint 2013 Standard/Enterprise.
Here’s a good installation guide: http://blog.concurrency.com/sharepoint/fast/
To get document preview you’ll need to install Microsoft Office Web Apps. Here’s a guide for this: http://technet.microsoft.com/library/ff431687(office.14).aspx#bkmk_ins_exis_sa
SharePoint 2013 with Metro Interface
As this post shows, SharePoint is destined to support a Metro style interface… http://camerondwyer.wordpress.com/2012/04/18/sharepoint-15-sharepoint-2013-screenshots/
SharePoint 2010 Foundation, Server Service Pack 1 for Download
Here’s information on SP1 for SharePoint 2010 Foundation http://support.microsoft.com/kb/2460058. Download from here: http://www.microsoft.com/download/en/details.aspx?id=26640
And for SP1 for SharePoint Server (Enterprise and Standard) information http://support.microsoft.com/kb/2460045. Download from: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=26623
SharePoint Diagnostic Studio
Talking of tools (see Favorite SharePoint Development Tools), the SharePoint Diagnostic Studio from Microsoft provides SharePoint performance monitoring functionality. This tool is particularly useful for consolidating the ULS records across servers in a SharePoint server farm. It’s part of the Microsoft SharePoint 2010 Administration Toolkit v2.0.
While useful, the user interface is not particularly polished or easy to use. In particular, the SharePoint Diagnostic Studio must be run with the language set to “US-English”, otherwise date formats will be presented incorrectly and date/time filtering will not work.
Overall Description: http://sharepoint.microsoft.com/blog/Pages/BlogPost.aspx?pID=971
Download from: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=718447d8-0814-427a-81c3-c9c3d84c456e&displaylang=en
Documentation: http://technet.microsoft.com/en-us/library/hh144782.aspx
Opening Web Parts Gallery Programmatically
Navigating to the Web Part Gallery in the browser interface takes you to http://site collection URL/_layouts/_catalogs/wp/Forms/AllItems.aspx. Attempting to open the list through “_catalogs/wp” will fail:
SPList spWPG = spWeb.Lists["_catalogs/wp"]; // does not work
Instead, you need to use the following code:
SPList spWPG = spWeb.Lists["Web Part Gallery"];
Reference: http://meiyinglim.blogspot.com/2007/10/programatically-organizing-web-parts-in.html
Re-ordering All-day Items in a Calendar
By default, all-day items will be displayed in the order determined by their physical location in the database table:

A more natural order would be alphabetic – to change the sort order you’ll need to create a list template, modify the manifest file to add the sort order and then load a new list template. Here goes….
- First navigate to a standard Calendar list and select the Settings + List Settings menu command.
- Select the Save List as Template command.
- Enter a name, such as “SortedCalendar” for the filename and template name and click OK.
- Click the list template gallery link on the “Operation Completed Successfully” form.
- You will be taken to the “List Template Gallery”. Click the “Sorted Calendar” link for the gallery you just created. Save this down to the file sytem.
- Use Windows Explorer to rename the file from “SortedCalendar.stp” to “SortedCalendar.stp.cab” – it really is a CAB file!
- In Windows Explorer double click the CAB file – you will find a single file called mainifest.xml. Copy this into the file system.
- Use an XML editor (such as Visual Studio) to open the XML file.
- Search for the following line (look for calendar.aspx):
<View Name=”{895B6132-0327-4FAB-A34B-EFB57FD5E542}” DefaultView=”TRUE” Type=”CALENDAR” RecurrenceRowset=”TRUE” DisplayName=”Calendar” Url=”Lists/Calendar2/calendar.aspx” Level=”1″ BaseViewID=”2″ ContentTypeID=”0x” ImageUrl=”/_layouts/images/events.png”>
- You now need to look for the query associated with this view. It will be about ten to fifteen lines below the line shown above and looks like:
<Query>
<Where>
<DateRangesOverlap>
<FieldRef Name=”EventDate”/>
<FieldRef Name=”EndDate”/>
<FieldRef Name=”RecurrenceID”/>
<Value Type=”DateTime”>
<Month/>
</Value>
</DateRangesOverlap>
</Where>
</Query>
- Edit the CAML query to include a “OrderBy” clause:
<Query>
<Where>
<DateRangesOverlap>
<FieldRef Name=”EventDate”/>
<FieldRef Name=”EndDate”/>
<FieldRef Name=”RecurrenceID”/>
<Value Type=”DateTime”>
<Month/>
</Value>
</DateRangesOverlap>
</Where>
<OrderBy>
<FieldRef Name=”Title”/>
</OrderBy>
</Query>
This will cause the results to be sorted by the “Title” field.
- Save the file manifest.xml.
The manifest.xml file now needs to be added back into the CAB file using the MAKECAB application. To make this tool more accessible run a Visual Studio Command Prompt:
- Select the Start + All Program + Visual Studio 2005 + Visual Studio Tools + Visual Studio 2005 Command Prompt.
- At the command prompt navigate to the folder where the manifest and CAB files are located and enter the following:
makecab manifest.xml SortedCalendar.stp.cab
- Rename “SortedCalendar.stp.cab” to “SortedCalendar.stp”.
- Return to the “List Template Gallery” in SharePoint.
- Click the Upload button and upload the “SortedCalendar.stp” file.
You can now test the new list template by creating a new list– you will find the new listtemplate listed in the Tracking section on the “Create” form. All day events will now be alphabetically sorted by “Title”. Phew!
Following Styles in SharePoint Customization
When customizing or writing add-ins for SharePoint it’s important to follow the styles such as ms-input or ms-descriptiontext on your components so that your pages will use modified CSS files, master pages etc.
You can download and install the Microsoft Developer Toolbar for IE 6 or 7 and click on the IE Developer Toolbar button. This displays the Developer Toolbar pane. Click the “mouse pointer” icon on the left side of the bar, select an item on the page and information about the HTML element will be displayed:

Encyrpting SQL Server Connections
In SQL Server 2005 connections between client and server can be encrypted using SSL even if a X.509 certificate has not been installed on the server. When a certificate is not present SQL Server will automatically generate one.
By default, the certificate chain up to a root CA will be checked, and if a recognised root CA is not found, the connection will fail with the following exception message:
A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 31 – Encryption(ssl/tls) handshake failed)
You can request that the certificate check is not made by using the TrustServerCertificate connection string parameter. So, the full connection string to specify SSL encryption without checking the certificate is:
string connectionstring =
“Server=(local);Database=AdventureWorks; Integrated Security=SSPI;Encrypt=true;TrustServerCertificate=true”;
It’s best to install a recognised certificate, but this approach is better than sending data in plain text across insecure networks.