My new blog

My blog has moved to www.davehunter.co.uk/blog see you there.
Showing posts with label WSS V3. Show all posts
Showing posts with label WSS V3. Show all posts

Wednesday, 8 August 2007

SharePoint 2007 Hotfix KB 936867

I recently had problems when the security inheritance was broken for a document library on a WSS site for a MOSS 2007 installation. After raising a support request Microsoft issued a hot fix. The hotfix package also addresses KB 934577, 935958, 937038.

I received an email from "ISA IT Department" on this post http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1881157&SiteID=1. He was receiving forbidden errors from SharePoint, after installing the hot fix 936867 all issues were fixed.

I would recommend anyone experiencing issues with security to request this hotfix. Always backup the SharePoint SQL Server databases and do a complete farm SharePoint backup before installing. The hotfix at the time of downloading it hasn't been fully regression tested yet so backup the SharePoint environment first.

Wednesday, 25 July 2007

Tip - Quickly find out an assembly's public key

When working with MOSS / WSS you need to find out the Public Key Token of your assembly for a feature, manifest or the web.config file.

One of the ways to retrieve the Public Key Token is to build the project (making sure the assembly is signed) and drop the assembly in the Global Assembly Cache (GAC).

You can however use the SN.EXE (.NET Strong Name Tool) with the -T parameter (please note the uppercase -T).

For example:
sn.exe -T MyAssembly.dll

Wednesday, 18 July 2007

SharePoint 2007 Running SPSecurity.RunWithElevatedPrivileges

In SharePoint Portal Server 2003 you may have needed to impersonate a user with higher priveledges than the current user executing the code. You did this using WindowsIdentity.Impersonate() method. In SharePoint 2007 and WSS V3 you have SPSecurity.RunWithElevatedPrivileges call. The code looks like:

SPSecurity.RunWithElevatedPrivileges(delegate() {

// put your code here. any code within these curly brackets will run with SharePoint system rights

});
For more information see SPSecurity.RunWithElevatedPrivileges Method on MSDN.

Please note: If you use the SPControl.GetContextSite(this.Context) within the SPSecurity.RunWithElevatedPrivileges call or have an variable defined before the call this will use the current user's rights and not the system's. For example:

SPSecurity.RunWithElevatedPrivileges(delegate() {

using (SPSite site = SPControl.GetContextSite(this.Context))
{

// site will be based on the current user that executes this code

}


});

You should use:

SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(web.Site.ID))
{


// site will be based on the rights for the system account

}

});
 

WSS V3 SDK download updated

The WSS V3 SDK has been updated and ready for download http://www.microsoft.com/downloads/details.aspx?FamilyID=05e0dd12-8394-402b-8936-a07fe8afaffd&DisplayLang=en

Overview
The Windows SharePoint Services 3.0 SDK contains conceptual overviews, programming tasks, and references to guide you in developing solutions based on Windows SharePoint Services as a platform. The SDK includes information about the following technologies:

  • Web Part Framework Create, package, and deploy Web Parts on SharePoint sites.

  • Server-side object model Work with individual lists and sites or manage an entire Windows SharePoint Services deployment.

  • Web services Use default Web services, or create custom Web services, to interact with Windows SharePoint Services from external applications.

  • Collaborative Application Markup Language (CAML) Customize the schemas that define lists and sites, define queries for use with members of the object model or Web services, and specify parameters for use with methods in Remote Procedure Call (RPC) protocol.

  • Master Pages Specify all of the shared elements of your site in the master page or pages, and add content page-specific elements to content pages.

  • Workflows Create workflows that encapsulate business processes to be performed on items in Windows SharePoint Services, and attach those workflows to items in Windows SharePoint Services.

  • Custom Field Types Create custom field types that conform to your business data. These custom field types can be based on the base field types already included in Windows SharePoint Services, and can include custom data validation, field rendering, and field property rendering and processing.

  • Information Rights Management (IRM) Specify IRM for files located in document libraries and stored as attachments to list items. Create IRM protectors for your own custom file types.

  • Document Property Promotion and Demotion Use the built-in XML parser to synchronize the document properties and list column data for XML documents. Create document parsers to do the same for your custom file types.

  • Search Use the new Query object model and Query Web service to retrieve search results. Search in Windows SharePoint Services now shares the same SharePoint search technology used by Microsoft Office SharePoint Server 2007.

Also included is the Workflow Developer Starter Kit for Windows SharePoint Services 3.0, which helps solution providers, independent software vendors, value-added resellers, and other developers write custom workflows for Windows SharePoint Services 3.0. It contains the following:

Visual Studio Project Templates

  • Sequential Workflow Library
  • State Machine Workflow Library

Sample Custom Workflow

  • Simple Collect Feedback using ASPX forms

You can also view the SDK documentation online http://msdn2.microsoft.com/en-us/library/bb264594.aspx

Adding web.config settings to you WSS or MOSS site

This article describes how to add web.config settings automatically to your new web applications under WSS V3 and SharePoint 2007.

You need to create a file in the format of webconfig.[name].xml, copy the file to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG folder and the settings in the file will be merged with the web.config file on any new web application. Unfortunately this only works for new web applications, if you put the file in the config folder no changes will be applied on existing web applications.

The example below adds a key to the appSettings and a database connection string to the connectionStrings section.

<?xml version="1.0" encoding="utf-8" ?>
<actions>
<add path="configuration/appSettings">
<add key="MyFilePath" value="C:\temp\path\" />
</add>
<add path="configuration">
<connectionStrings />
</add>
<add path="configuration/connectionStrings">
<remove name="MySqlServerConnection" />
<add name="MySqlServerConnection" connectionString="server=[server];database=[db];Integrated Security=SSIP;" providerName="System.Data.SqlClient" />
</add>
</actions>

Friday, 13 July 2007

Hosting UserControls vs Delegate Control

There are two main approaches for adding user controls to your site:

  1. Deploying them to the "wpresources" folder
  2. Using the DelegateControl

Many people have blogged about each technique, but which is the best or the recommended approach?

Tony Rahbun has posted an article called "WebParticles: Developing and Using Web User Controls as WebParts in Microsoft Office SharePoint Server 2007" http://www.codeproject.com/spoint/WebParticles.asp.

Microsoft's recommended approach is to use the DelegateControl. http://msdn2.microsoft.com/en-us/library/ms463169.aspx.

Advantages of using the DelegateControl over hosting UserControls in the wpresources folder

  • Using Solution deployment in SharePoint 2007 you can create a WSP to automate the deployment of your UserControls (stored in the ControlTemplates folder) and Features (used to activate a DelegateControl).
  • You can control the scope of the feature.
  • More closely integrated with SharePoint.
  • If the feature isn't activated the DelegateControl will fall over gracefully. This would enable the component to be hidden if no longer needed.

Sunday, 8 July 2007

SharePoint 2007 Virtual Labs

Here's a list of SharePoint 2007 Virtual Labs

Removing hidden and damaged webparts from a page

You can remove hidden or damaged webparts from a page by appending "?contents=1" to the url (if the url already contains a querystring parameter replace "?" with "&"). This will bring up a screen listing all the webparts on the page (both visible and hidden). You can then select any web part and remove it.

If a webpart is causing significant damaged to a page (ie throwing an exception which isn't handled in the webpart) then you should see a SharePoint error page with a link to the remove webparts from the current page.