Tuesday, June 24, 2008

Retrieve Sharepoint ListItem from document URL

One of our SharePoint site has a webpart which lists links to the documents from different document libraries from different Sharepoint webs.
Now if we want to retrieve information about the document we don't have any other info on the page other than the URL for the document.
So how to retrieve additional info about the document?

Here's the solution:
1. Retrieve the web URL from the document URL.
2. Get the web object.
3. From web object retrieve the SPListItem object.

And you got the all info about the document!

string webUrl = documentURL.Substring(0, documentURL.LastIndexOf("/"));
SPWeb web = SPContext.Current.Site.OpenWeb(webUrl);
SPListItem fileListItem = web.GetListItem(documentURL);

This is also a good use if you are trying to get the list item info in HttpHandler while downloading the document in SharePoint.

Tuesday, June 17, 2008

Aggregating Data From Different SharePoint List

How To: Add a linked data source

Microsoft Windows SharePoint Services and Code Access Security

Microsoft Windows SharePoint Services and Code Access Security
Summary: Learn how to implement policies for code access security for Microsoft SharePoint Products and Technologies and how to customize default security settings for Microsoft Windows SharePoint Services. This document also answers some of the most commonly asked questions about code access security and its applicability to Windows SharePoint.

MOSS 2007 and Code Access Security

Monday, June 16, 2008

Sharepoint extensions for VS 2008

Microsoft has release the Sharepoint Extensions for Visual Studio 2008.

Which includes tools for developing custom SharePoint applications: Visual Studio project templates for Web Parts, site definitions, and list definitions; and a stand-alone utility program, the SharePoint Solution Generator.

Download Link: Windows SharePoint Services 3.0 Tools: Visual Studio 2008 Extensions, Version 1.2

Version 1.2 of the Visual Studio 2008 Extensions for Windows SharePoint Services contains the following tools to aid developers in building SharePoint applications:

Visual Studio 2008 Project Templates

* Web Part
* Team Site Definition
* Blank Site Definition
* List Definition
* Empty SharePoint Project


Visual Studio 2008 Item Templates (items that can be added into an existing project)

* Web Part
* Custom Field
* List Definition (with optional Event Receiver)
* Content Type (with optional Event Receiver
* Module
* List Instance
* List Event Handler
* Template


SharePoint Solution Generator

* This stand-alone program generates a Site Definition project from an existing SharePoint site. The program enables developers to use the browser and Microsoft Office SharePoint Designer to customize the content of their sites before creating code by using Visual Studio.