When you develop Sharpeoint solutions in Visual Studio, there is one tool you can't miss: WSP builder.
The description from codeplex: The WSPbuilder is a console application that creates SharePoint Solutions files
based on a folder structure. WSPBuilder will automatically traverse a "12" folder structure
and creates a SharePoint solution manifest.xml and the wsp file based on the files it finds.
Therefore you do not need the knowledge of how to create a solution manifest.xml
and wsp file any more.
The link to download: http://wspbuilder.codeplex.com/
1f0e44de-ba9d-4317-a49f-8abba5d88eef|0|.0
Reading values from list items in Sharepoint is no fun. I have created a method to read the value of a DateTime field in an SPItem:
private DateTime readSharepointDatefield(SPItem currentItem, string fieldName)
{
DateTime date = DateTime.MinValue;
if (currentItem.Fields[fieldName] != null)
{
if (!String.IsNullOrEmpty(currentItem.Fields[fieldName].GetFieldValueAsText(currentItem["PersberichtDatumMetKalender"])))
{
date = ((DateTime)(currentItem.Fields[fieldName].DefaultValueTyped)).Date;
}
}
return date;
}
a94219c9-9957-4053-89d0-a448fc0ec0aa|2|2.5
In some cases you want to disable the Web Page Security Validation. You can do this in the central administration:
Central Administration > Application Management > Web Application General Settings
Choose the correct web application
Scroll to the Web Page Security Validation setting
Choose the option 'Off'
4fe3e8d1-6a21-436c-89bd-c510ce04a48d|1|4.0
Linq is a powerfull method to use within webparts and show the content of a SPList. This example opens the task list and orders the list by the title property:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace SharepointLinq
{
public class MyList : System.Web.UI.WebControls.WebParts.WebPart
{
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
base.Render(writer);
SPList taskList = SPContext.Current.Web.Lists["Tasks"];
// Get items, order by title alphabetically and assign to taskListItems
var taskListItems = from SPListItem tItem in taskList.Items
orderby tItem.Title
ascending select tItem;
foreach (SPListItem taskItem in taskListItems)
writer.WriteLine(taskItem.Title + "<br/>\n");
}
}
}
78df26cf-d124-4fb0-8663-087fb3d31a69|0|.0
The Sharepoint Manager 2007 is a tool you can't do without when developing Sharepoint. You can find the download
here. The description from the author:
The SharePoint Manager 2007 is a SharePoint object model explorer. It enables you to browse every site on the local farm and view every property. It also enables you to change the properties (at your own risk). This is a very powerfull tool for developers that like to know what the SharePoint holds of secrets.
59349c57-366d-46b6-a77b-b1739f4228ca|0|.0
If you want to hide the Sharepoint SiteActions menu if a user is not authorized, you can use the PublishingWebControls:AuthoringContainer element. One of the attributes of this element is the DisplayAudience. If you set the value of this attribute to AuthorsOnly, the SiteActions menu will not appear when not logged in.
A complete example:
<PublishingWebControls:AuthoringContainer id="authoringcontrols" runat="server" DisplayAudience="AuthorsOnly">
<div id="sharepointmenu">
<wssuc:Welcome id="explitLogout" runat="server"/>
<PublishingSiteAction:SiteActionMenu runat="server"/>
<PublishingConsole:Console runat="server" />
</div>
</PublishingWebControls:AuthoringContainer>
Have fun with it!
94a85e5b-486b-450b-8a8a-e016d50b3dee|0|.0