Quick Tip: Provisioning a List View to a Web Part Page

Following on from my recent post (Provisioning Web Parts to a Page), I had a question asking how to do this for List Views. Below is a code sample showing how to do this… 1: <?xml version="1.0" encoding="utf-8"?> 2: <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> 3: <Module Name="XYZCustomPages" RootWebOnly="True"> 4: <File Path="XYZCustomPages\Home.aspx" Url="Home.aspx" IgnoreIfAlreadyExists="true"> 5: <View List="Lists/Tasks" BaseViewID="0" WebPartZoneID="Left"…

4

Deploying Files to the Root of a SharePoint Web Application

I’ve recently been working on a project where a Silverlight App sitting on a separate url calls through to a WCF service hosted in SharePoint. For this to work, a “clientaccesspolicy.xml” file is required at the root of the SharePoint web application. This file will contain the following: 1: <?xml version="1.0" encoding="utf-8"?> 2: <access-policy> 3:…

2

Quick Tip: Provisioning Web Parts to a Page

When deploying a page to SharePoint through a Modules feature, there are several options adding web parts to this. These are as follows: Add the web parts to the page programmatically via a feature receiver. This approach can be done quickly and easily if you are familiar with coding, however if the feature receiver fails, the web…

9

Quick Tip: Throwing SPExceptions

Just a quick note for developers. If you want normal code execution to be terminated and want a useful message to be presented back to the end user on the SharePoint error page, throw an exception that either is of type SPException, or derives from type SPException. If this is done, the associated exception message…

1