Zieglers

Just little about C#, .NET, SQL Server, SharePoint and SAP

Posts Tagged ‘Bulk Actions’

SPBulkActions – CodePlex Project

Posted by zieglers on May 21, 2010

Yesterday I published the first release of SharePoint Bulk List Actions project on CodePlex.

http://spbulkactions.codeplex.com/

This project is basically a combination of bulk functionalities I mentioned in my last couple of posts.

This project aims to provide some essential and generic bulk actions for SharePoint lists. Idea is to include any custom actions that can be applied on lists in bulk. List item selection is also provided, so not only you can do your actions in bulk but also selectively.

Hopefully, it’s used by whoever needs and extended based on specific business requirements. If you are interested in developing for SPBulkActions, please let me know.

zieglers

Advertisements

Posted in IT Stuff, SharePoint | Tagged: , , , , | Leave a Comment »

GeneriX for SharePoint – Part: 1

Posted by zieglers on March 25, 2010

In this post, I’ll mention about GeneriX solution for SharePoint. In fact, i call it GeneriX since it is developed under namespace SharePoint.Core.Generic.

Point is to include any projects implementing a generic idea in this namespace. For example as for this post, I’ll show ‘Select Multiple List Items’ and ‘Delete Items’ custom action menu item.

 This project consists of two parts:

 1. Select Multiple Items – Adding checkboxes next to items in lists so that user can select and work on more than one list item.

 2. Delete Items – A custom action which simply deletes all items selected by user. This is done by implementing a custom ‘Actions Menu‘ item. However, implementation is done in a way that it can be customized very easily to any other custom action incase needed.

You might ask which part of this solution is generic since i keep using word ‘custom’. It is generic, because two parts of the solution are both individually generic actions – namely being able to select multiple items and deleting multiple items. Moreover, you can easily extend custom actions classes to introduce your own actions (handling multiple items) such as check-out/check-in, approve, publish, approve, alert me … etc.

 DEMO: Here is a short demo of the functionality.

 Upload multiple items in a sample lib (where multiple list item selection is not enabled yet).

Enable multiple list item selection using Actions Menu.

NOTE: By default, once this solution is deployed, multiple item selection is enabled on lists. You don’t need to take below action explicitly. This is just for demonstration.

Select items you want to delete.

Select ‘Delete Items’ in Actions.

Confirm deletion.

Selected items are deleted.

Very simple yet powerful!! 

IMPLEMENTATION:

 Now let’s see how we can extend this generic project to introduce another bulk action to process multiple items.

GeneriX wsp: Zieglers.SharePoint.Generic.20100325.wsp

GeneriX Source Code: GeneriX.zip

(Don’t forget to remove .doc extension 🙂 Rename downloaded files exactly as seen above)

 When you download GeneriX solution and open it, you’ll see the following in Solution Explorer. (Following solution structure might change as development progresses)

Here there are 3 features:

JQuery – supporting infrastructure feature

SelectMultipleListItems – this feature introduces enable/disable multiple items functionality for lists. This feature is making use of JQuery feature as well.

DeleteItems – this feature introduces delete multiple items functionality.

We can think of first 2 features as supporting features for custom action features like delete items.

Now let’s implement another custom action say ‘Check-out Items’ which performs a multiple check-out action on selected items.

Step-1: Implement MenuItemTemplate interface

Simply copy-paste whole DeleteItemsAction class and rename Delete to CheckOut for that class.

Here basically we are creating a new Actions Menu item for Check-out operation.

Now, our custom action class is ready for CheckOut operation.

Step-2: Create a ashx file for CheckOut items

This is a handler file to determine which handler code to execute once user clicks on our CheckOut items actions menu item.

In order to do so, simply copy-paste DeleteItems.ashx file residing under layouts folder and rename it to CheckOutItems.ashx.

Open the file and also rename DeleteItemsHandler to CheckOutItemsHandler.

By doing so, we basically state which handler class to be executed once user clicks ‘Checkout Items’. In next step, we’ll implement CheckOutItemsHandler class.

Step-3: Implement CheckOutItemsHandler class

So far, we created a menuitemtemplate for checkout items and a handler file to point which handler class to execute. This handler class will implement our custom logic (whatever your business logic might be) in this case, check-out items.

Similar to above, open CustomActionHandlers.cs and copy-paste DeleteItemsHandler class and again rename Delete to CheckOut.

Note that this class is implementing IHttpHandler interface which basically is catching user http request upon clicking CheckOut Items menu item.

Step-4: Write your code implementing your custom logic

We are almost done. Search for ‘Write Your Code’ in the new class you created and simply include your code snippet there.

 In our case, it is Check-Out action, so all i need to do is just include only one line code as seen below.

Well, that’s all about it. We are done! 🙂

Now build, deploy and test your changes..

Let me know if you run into any issues. I’ll be glad to help.

Zieglers

Posted in IT Stuff, SharePoint | Tagged: , , , , , , , , , | 1 Comment »