Friday, May 17, 2013

How to create an event handler for sharepointmoss 2007

The easiest ways is to download and install WSP Builder from codeplex its a visual studio plug in that adds the correct confirmations, using statements, mapped folder paths, overrideable functions, future scope, etc. for you by right clicking and adding a event to your project you can also us it to build your WSPs, deploy to SP, cycle IIS and attach to the correct w3wp for debugging purposes. If however this is not for you, it is possible to do it 'manually' by following the following instructions.

Add the Microsoft.SharePoint reference and using statement to your newly create project.

Derive your class from SPItemEventReceiver
e.g. public class MyEventAction : SPItemEventReceiver

Override the required *ed or *ing function(s) out of the list required for your project:
ItemAdded
ItemAdding
ItemAttachmentAdded
ItemAttachmentAdding
ItemAttachmentDeleted
ItemAttachmentDeleting
ItemCheckedIn
ItemCheckedOut
ItemCheckingIn
ItemCheckingOut
ItemDeleted
ItemDeleting
ItemFileConverted
ItemFileMoved
ItemFileMoving
ItemUncheckedOut
ItemUncheckingOut
ItemUpdated
ItemUpdating

e.g.
public override void ItemAdded(SPItemEventProperties properties)
{
   base.ItemAdded(properties);
}

Create a folder that syncs to the hive location under templates then features then create a folder with the name of the feature and in it create a xml file called Feature.xml

Update the Feature.xml to look sorting like the following.
<Feature Scope="Web" Title="My Event Handler"
Id="GUID" xmlns="http://schemas.microsoft.com/sharepoint/">
   <ElementManifests>
      <ElementManifest Location="Elements.xml"/>
   </ElementManifests>
</Feature>

Now create an Elements.xml file in the MyEventHandler folder that identifies the assembly, class, and method to implement as the event handler.

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
   <Receivers ListTemplateId="104">
      <Receiver>
         <Name>MyEventHandler</Name>
         <Type>ItemAdded</Type>
         <SequenceNumber>10000</SequenceNumber>
         <Assembly>MyEventHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a26b5449ac4a4cf3</Assembly>
         <Class>MyEventHandler.AddedAction</Class>
         <Data></Data>
         <Filter></Filter>
      </Receiver>
   </Receivers>
</Elements>

The Type attribute ListTemplateId is for the type of list this action applies to:

IDName
100Generic list
101Document library
102Survey
103Links list
104Announcements list
105Contacts list
106Events list
107Tasks list
108Discussion board
109Picture library
110Data sources
111Site template gallery
112User Information list
113Web Part gallery
114List template gallery
115XML Form library
116Master pages gallery
117No-Code Workflows
118Custom Workflow Process
119Wiki Page library
120Custom grid for a list
130Data Connection library
140Workflow History
150Gantt Tasks list
200Meeting Series list
201Meeting Agenda list
202Meeting Attendees list
204Meeting Decisions list
207Meeting Objectives list
210Meeting text box
211Meeting Things To Bring list
212Meeting Workspace Pages list
300Portal Sites list
301Blog Posts list
302Blog Comments list
303Blog Categories list
1100Issue tracking
1200Administrator tasks list
2002Personal document library
2003Private document library

Save and build project.

Deploy using STSADM.
stsadm -o installfeature -filename MyEventHandler\Feature.xml

stsadm -o activatefeature -filename MyEventHandler\Feature.xml 
-url http://Server/Site/Subsite

Then you will have to do and iisreset using cmd
iisreset -noforce

For more information see:
http://msdn.microsoft.com/en-us/library/ms453149(v=office.12).aspx

Tuesday, May 7, 2013

Installing SharePoint 2010 SSRS Web Part

About Report Explorer and Report Viewer
Report Explorer and Report Viewer are SharePoint Web Parts that were introduced in SQL Server 2000 Reporting Services Service Pack 2 (SP2).

Thy provide a way to view reports and explore the report server folder hierarchy from a SharePoint site.

Note: That customizing the Web Parts is not supported. The Web parts are intended to be used as is, and should not be extended or modified.

Report Viewer
  • Report Viewer displays a report and provides a toolbar that you can use to navigate pages, search for content, or export the report.
  • You can add the Report Viewer Web Part to a Web Part page to always show a specific report on that page or you can connect it to Report Explorer to display reports that are opened through that Web Part.
Report Explorer
  • Report Explorer connects to Report Manager on the report server computer. You can browse available reports on a report server and subscribe to individual reports.
  • If Report Builder is enabled and you have sufficient permissions, you can start Report Builder from the Report Explorer Web Part.
  • Report Explorer displays the contents of a folder using a page in Report Manager.
  • Access to individual items and folders throughout the report server folder hierarchy are controlled through role assignments on the report server. When you select a report, it opens in a new browser window.
  • The HTML viewer on the report server displays the report and provides the report toolbar, not the Report Viewer Web Part. If you want to customize the toolbar settings, be sure to specify the URL access parameters on the report server. For instructions, see Using URL Access Parameters.

Requirements for using the Report Viewer and Report Explorer Web Parts
  • Report Manager must be installed.
  • The report server version must be SQL Server 2005 Reporting Services or later.
  • The report server must run in native mode. You cannot use the Report Explorer and Report Viewer Web Parts to connect to or view reports on a report server that runs in SharePoint mode. For more information about modes, see Planning a Deployment Mode.
  • Report Explorer and Report Viewer Web Parts are distributed through a cabinet (.cab) file that is included with Reporting Services. Instructions for installing, configuring, and using the Web Parts are provided in the following sections of this topic.

Modes
Viewing Reports with SharePoint Web Parts can be done in 2 different ways called Native and SharePoint Mode.

SharePoint mode
If you want to access a report server that runs in SharePoint mode, use the web parts that are installed by the Reporting Services Add-in for SharePoint products. For more information about the add-in, see Overview of Reporting Services and SharePoint Technology Integration.

Native mode
If you want to access report server content on a SharePoint site from a native mode report server, use the SharePoint Web Parts Report Explorer and Report Viewer that are included with Reporting Services, installation instructions can be found below.


Installing
Where to get the cab file
By default Reporting Services 2008 R2 installs the RSWebParts.cab file into the following folder:
C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Reporting Services\SharePoint

How to add it
Using the STSADM.exe tool found under 12hive bin, run the following command:
stsadm  -o addwppack -filename "RSWebParts.cab" -globalinstall 
You should see a message of  “Operation completed successfully.”

Using SharePoint 2010 Management Shell with administrative privileges on the computer that has the installation of the SharePoint product, run the following command:
Install-SPWebPartPack -LiteralPath "RSWebParts.cab" -GlobalInstall
You should see a message similar to the following, indicating the Web Part was deployed.

Note: Specifying -globalinstall adds the Web Parts to the global assembly cache (GAC). This is only necessary if you want to connect the Web Parts.



More information can be found at: http://msdn.microsoft.com/en-us/library/ms159772.aspx