There have been many instances when one required to upload the document to the document library in a particular folder. If one have noticed that while uploading the document to document library we get a browse option which let one to select the folder to add the document in library.
To achieve this sharepoint uses the LaunchPickerTreeDialog method this can be found in /_layouts/1033/PickerTreeDialog.js file under 14 hive folder. This is used to display the site content and filter the content based on the WebOnly, listOnly, WebAndLIsts and websAndListFolders.
Now the if you want to reuse the same in your custom control, and want to list only particular document library folder for example to list folders in pages library in launch picker, the hack here is about how to pass on the filter parameter to LaunchPickerTreeDialog method .
Creating the anchor tag format is “SPList:[ID]?SPWeb:[ID]”
Example:
[javascript]
var pagesList = ‘SPList:<%= SPContext.Current.Web.GetList(“/Pages”).ID %>?’;
var webID = ‘SPWeb:<%= SPContext.Current.Web.ID %>:’;
LaunchPickerTreeDialog('CbqPickerSelectListTitle', 'CbqPickerSelectListText', 'listsOnly', pagesList+webID, '<%= SPContext.Current.Web.ServerRelativeUrl %>', '', '', 'Error Occured', "/_layouts/images/smt_icon.gif", '', callback, true, '');
[/javascript]
Complete code
[javascript]
<SharePoint:InputFormTextBox Title="Select file or folder" class="ms-input" ID="URLTextBox" onfocusout="javascript:CheckSubFolderSelected();"
Columns="35" runat="server" MaxLength="455" size="60" />
<asp:Button ID="BrowseToButton" runat="server" OnClientClick="launchPicker();return false;"
Text="…" />
[/javascript]
JavaScript
[javascript]
function ULSfGQ(){var o=new Object;o.ULSTeamName="DLC Server";o.ULSFileName="UploadEx.aspx";return o;}
var rptstglocid = <%SPHttpUtility.AddQuote(SPHttpUtility.NoEncode(URLTextBox.ClientID),Response.Output);%>;
var weburl=<%SPHttpUtility.AddQuote(SPHttpUtility.UrlPathEncode(Web.Url,true),Response.Output);%>;
function launchPicker()
{ULSxQp:;
var callback = function(dest)
{ULSxQp:;
if (dest != null && dest != undefined && dest[3] != null)
{
// alert(dest[0] +'-'+dest[1]+'-'+dest[2]);
document.getElementById(rptstglocid).value = dest[3];
}
};
var pagesList = 'SPList:<%SPHttpUtility.NoEncode(ListID,Response.Output);%>?'; // get the list id based on the library name
var webID = 'SPWeb:<%= SPContext.Current.Web.ID %>:';
//alert(pagesList+webID); // create the anchor tag
LaunchPickerTreeDialog('CbqPickerSelectListTitle', 'CbqPickerSelectListText',
'listsOnly', pagesList+webID, '<%= SPContext.Current.Web.ServerRelativeUrl %>', '', '', 'Error Occured',
"/_layouts/images/smt_icon.gif", '', callback, true, '');
}
[/javascript]
Thanks.
In email spam they target only known email id, which they get from various sources like small consultancies or from training institutes or by doing some social engineering ;). Mail providers like Gmail, Yahoo are too intelligent to send it to spam folder without giving you trouble. So, you are somehow safe in case of email spam.
It is a well known fact that only good quality content is what it takes your readers to visit your blog, get information and revisit it whenever they need or feel like. But that’s just one part of the story. Are you paying enough attention to your blog’s readability quotient as a blogger?
Visitor Rating: 5 Stars