Hi all,
We have created a multiple selection of documents in the past to send links and
attachments (outlook power tool 2007). This allows you to select multiple items
in a document library and then via a javascript feature, you can then loop
through each of the selected items and do your thing.
We haven't done it for list items yet as we haven't got around to it.
The general process is the following (for doc libs, you need to work it out for
your list type)
1. Modify the schema.xml of the list type and add a field that renders a
checkbox in the fields node. Here is the example from the document library
schema that we implemented:
2.
<!--START OF SELECTION CHECKBOX CHANGES-->
<Field ID="{A8250948-F134-4e38-A66E-1525DE792477}"
ReadOnly="TRUE"
Type="Computed"
Name="SelectedItem"
ClassInfo="Menu"
DisplayName="Selected Item Checkbox"
Filterable="FALSE"
Sortable="FALSE"
HeaderImage="blank.gif"
SourceID="http://schemas.microsoft.com/sharepoint/v3/fields"
StaticName="SelectedItem">
<FieldRefs>
<FieldRef
ID="{30BB605F-5BAE-48fe-B4E3-1F81D9772AF9}" Name="FSObjType"/>
</FieldRefs>
<DisplayPattern>
<IfEqual>
<Expr1>
<LookupColumn Name="FSObjType"/>
</Expr1>
<Expr2>0</Expr2>
<Then>
<HTML>
<![CDATA[<input type=checkbox WT_SELECTIONCHECKBOX = true
title="selection checkbox" name="selectionCheckBox" WT_ENCODEDABSURL ="]]>
</HTML>
<Field Name="EncodedAbsUrl"/>
<HTML>
<![CDATA[" ItemID="]]>
</HTML>
<Column Name="ID"/>
<HTML>
<![CDATA[" id="cbx_]]>
</HTML>
<Column Name="ID"/>
<HTML>
<![CDATA[">]]>
</HTML>
</Then>
</IfEqual>
</DisplayPattern>
</Field>
<!--END OF SELECTION CHECKBOX CHANGES-->
NOTE: I tried creating a custom field for the checkbox selection but it did not
work for me, so I opted to change the schema.
3. We created a feature that looped through the selected items. The
urlAction has the javascript in it. This is the example:
<CustomAction
Id="echoTechnology.OutlookPowerTool2007.SendMultipleLinks"
RegistrationType="List"
RegistrationId="101"
Location="EditControlBlock"
Sequence="1001"
ImageUrl="/_layouts/images/sendto.gif"
Title="Send Multiple Links">
<UrlAction Url="javascript:function SendLinks()
{
var URL = ''; var frm = document.forms[0]; var iTotal =
frm.elements.length;var i = 0;var item;var itm={ItemId};var d;
var selectedItems = new Array;for (i = 0; i < iTotal;
i++){item = frm.elements[i];if (item.WT_SELECTIONCHECKBOX == 'true')
{if (item.checked != false){
selectedItems.push(item.WT_ENCODEDABSURL);}if(itm==item.ItemID){d=item.WT_ENCODEDABSURL;}}
} var sLinks; sLinks = ''; var sDocUrl; var CRLF ='%0D%0A';
if(selectedItems.length !=0)
for (var i = 0; i < selectedItems.length; i++)
{sDocUrl = '<' + selectedItems[i] + '>'; sLinks = sLinks
+ '%0D%0A' + sDocUrl;}
else{sDocUrl = '<' + d + '>'; sLinks = sLinks + '%0D%0A'
+ sDocUrl; }window.navigate('mailto:?subject=Please look at these
links...&body=' + sLinks);
} SendLinks();"/>
</CustomAction>
NOTE1: you can call an aspx page in the _layouts directory if you need to do
fancier stuff I guess, and you can have .net code inline
NOTE 2: that the javascript may be limited to a 2k block. That is why the code
is all bunched up. When changing the javascript change 1 thing at a time, test
and then change the next bit. But once you get it running it works like a charm.
4. Once you deploy the schema.xml and the feature, you need to then
change the views to include the selection checkbox.
After this you should have a checkbox to multiply select items and the drop
down menu should have your custom action.
You can download the full feature from
www.echotechnology.com<http://www.echotechnology.com> (Outlook Power Tool 2007).
Hope this helps you in some way.
regards,
Sergio Otoya | Technical Director |livePoint | SharePoint Solutions
E [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>| w +61 2 9929 6333 | m +61 (0)
416 275 110
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sezai KOMUR
Sent: Tuesday, 19 February 2008 3:41 PM
To: [email protected]
Subject: RE: [OzMOSS] Form Library: View: Selecting Multiple Items and
performing an Action
It's best to write your own.
There is a multilookup field control that you can use only in edit mode which
binds to a page field on a page layout, where the page field is a site column
added to the pages's content type. The site column is created as a lookup
column to a site list.
<SharePointWebControls:MultipleLookupField ID="Multiplelookupfield1"
FieldName="FacilityFeatures"
runat="server"></SharePointWebControls:MultipleLookupField>
This is only useful for publishing page layouts and only in edit mode, this
field control stores multiple selections of items from the list which the site
column is setup as a lookup to.
If you want a control to use in regular display mode, then you'll probably need
to code it all yourself, shouldn't be too tough, use a checkboxlist control or
some other asp.net control which allows users to select multiple items, on
loading the page populate the control programmatically with items from the
list, and then add a button and some code to the button click event to perform
the action on the selected items.
Sezai Kömür
Senior Developer - BEng, BSc - Microsoft Certified Technology Specialist -
http://www.moss2007.com.au/
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeremy Thake
Sent: Tuesday, 19 February 2008 1:18 PM
To: [email protected]
Subject: [OzMOSS] Form Library: View: Selecting Multiple Items and performing
an Action
We have a requirement for a user to be able to select multiple List Items from
a Custom List. The user then clicks the Action menu and it will perform that
action on all selected List Items. I've searched around the web for this, is
this possible out of the box or with a third party component? Or is it best to
write a web part that spins through the List using the API and manage this
separately?
Thanks
Jeremy Thake
wss.made4the.net<mailto:[EMAIL PROTECTED]>
------------------------------------------------------------------- OzMOSS.com
- to unsubscribe from this list, send a message back to the list with
'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net
------------------------------------------------------------------- OzMOSS.com
- to unsubscribe from this list, send a message back to the list with
'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net
------------------------------------------------------------------- OzMOSS.com
- to unsubscribe from this list, send a message back to the list with
'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net