Paul (your new email needs a name change), Since your javascript is already looping over the items and adds them to the selectedItemIds string, you can add an IF statement in the for-loop. I am not sure what you get in the javascript in the way of properties - I am guessing it will either be href, or filename or name or FileRef - just debug the script and see what properties you get in the object and add the if statement like so:
for (selectedItemIndex in selectedItems){ if(selectedItems[selectedItemIndex].name.indexOf("docx")>0) selectedItemIds += '|' + selectedItems[selectedItemIndex].id; } [Description: Description: Description: C:\Users\Brian\Pictures\EXD Logos\Extelligent logo no text.jpg]Ishai Sagi | Solutions Architect 0488 789 786 | is...@exd.com.au<mailto:is...@exd.com.au> | www.sharepoint-tips.com<http://www.sharepoint-tips.com/> | @ishaisagi<http://twitter.com/ishaisagi> | MVP Profile<https://mvp.support.microsoft.com/profile/Ishai> From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of Web Admin Sent: Thursday, 19 July 2012 09:15 To: ozMOSS Subject: Re: SP.ListOperation.Selection.getSelectedItems js method Cos then I'd have to query the whole list. The 2010 JS library allows you to query selected list items using the getSelectedItems List Operation. var selectedItems = SP.ListOperation.Selection.getSelectedItems(); var selectedItemIds = ''; var selectedItemIndex; for (selectedItemIndex in selectedItems){ selectedItemIds += '|' + selectedItems[selectedItemIndex].id; } I then render them in my modaldialog using this pattern: <asp:DataList ID="SelectedDocumentsDataList" runat="server" RepeatColumns="2" CellPadding="2" CellSpacing="5"> <ItemTemplate> <li><%# DataBinder.Eval(Container.DataItem, "File.Name").ToString()%></li> </ItemTemplate> </asp:DataList> What I am trying to do is filter this further by only displaying items whose filename ends with doc or docx. But I'm not sure of the best method to use. :( I'm already performing this with the code behind so that only Word docs are converted. But I want to show this list to the user as well. foreach (SPListItem listItem in _selectedListItems) { //Verify the document added is a Word Document // before starting the conversion. if (listItem.Name.EndsWith(".docx") || listItem.Name.EndsWith(".doc")) { //do stuff } Better still I'd like to render unsupported filetypes in red or strikethrough text. But I just don't know how to indiviudally define supported and unsopported docs within my slecteditems var. ya dig? ;) On 18 July 2012 16:14, Maxine Harwood <maxinetechg...@gmail.com<mailto:maxinetechg...@gmail.com>> wrote: Not sure if i follow what you wanted to achieve, but why not just query the items file extension? Sent from Max's iPad On 18/07/2012, at 3:15 PM, Web Admin <web.ad...@syd.catholic.edu.au<mailto:web.ad...@syd.catholic.edu.au>> wrote: Hi all, I'm writing a CommandUIHandler for a custom Ribbon button which retrieves the currently selected items in the list and displays them in a modal dialog. var selectedItems = SP.ListOperation.Selection.getSelectedItems(); var selectedItemIds = ''; var selectedItemIndex; for (selectedItemIndex in selectedItems) { selectedItemIds += '|' + selectedItems[selectedItemIndex].id; } I want to try taking this a step further by only returning selected items whose Name EndsWith ".doc" or ".docx". I can achieve this easily enough in C# but am struggling with JavaScript and don't want to start using Regex and manipulating array strings. :| I'm not sure how (or whether it's possible) to grab the Name value at all in this way? Regards, Paul (new email) SharePoint Farm Admin/Developer Infrastructure Team CEO Sydney p: (02) 9568 8461 f: (02) 9568 8483 e: paul.no...@syd.catholic.edu.au<mailto:paul.no...@syd.catholic.edu.au> w: http://www.ceosyd.catholic.edu.au/ _______________________________________________ ozmoss mailing list ozmoss@ozmoss.com<mailto:ozmoss@ozmoss.com> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss _______________________________________________ ozmoss mailing list ozmoss@ozmoss.com<mailto:ozmoss@ozmoss.com> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss -- Regards, Paul Noone -- SharePoint Farm Admin/Developer Infrastructure Team CEO Sydney p: (02) 9568 8461 f: (02) 9568 8483 e: paul.no...@syd.catholic.edu.au<mailto:paul.no...@syd.catholic.edu.au> w: http://www.ceosyd.catholic.edu.au/
<<inline: image001.jpg>>
<<inline: image002.jpg>>
_______________________________________________ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss