Skip to main content

How to find Microsoft.SharePoint.ApplicationPages.dll and some other assemblies


You may be wondering where to find Microsoft.SharePoint.ApplicationPages.dll , if you are creating a new SharePoint application page? But don’t worry, it resides in _app_bin folder of your SharePoint site’s virtual directory.
Assuming your IIS inetpub is at C then the exact path of Microsoft.SharePoint.ApplicationPages.dll is
C:\Inetpub\wwwroot\wss\VirtualDirectories\<Your Virtual Server >\_app_bin\Microsoft.SharePoint.ApplicationPages.dll
Here is the full list of assemblies at _app_bin folder:
  1. Microsoft.Office.DocumentManagement.Pages.dll
  2. Microsoft.Office.officialfileSoap.dll
  3. Microsoft.Office.Policy.Pages.dll
  4. Microsoft.Office.SlideLibrarySoap.dll
  5. Microsoft.Office.Workflow.Pages.dll
  6. Microsoft.Office.WorkflowSoap.dll
  7. Microsoft.SharePoint.ApplicationPages.dll
  8. STSSOAP.DLL

Creating SharePoint-like Custom Dialogs


When working with SharePoint you certainly configured a Content Query Web Part. Never wished that you could reuse this dialog from within your code?

When copying a document from a document library to another destination in the SharePoint site, never wished you could browse to the destination instead of typing in the complete URL?

When taking a closer look at the source code of the Content Query Web Part, you will see that the HTML button calls a JavaScript function named mso_LaunchListSmtPicker().
 
The JavaScript function is defined in the same source file. It gets a reference to a TextBox, defines a callback function to which the results of the dialog should return, and finally calls the LaunchPickerTreeDialog() function. You can pass along arguments like the URL to the dialog, the dialog title, description, icon and the previously defined callback function.


The LaunchPickerTreeDialog() function is defined in the PickerTreeDialog.js file that is located in the12\TEMPLATE\LAYOUTS\1033 directory. This function on its turn calls the commonShowModalDialog function, passing through the arguments like URL to the dialog, the size of the dialog and the callback function. The dialogUrl argument is a concatination of the URL of the dialog, completed with query string parameters for the dialog title, the description, the icon,…
commonShowModalDialog(dialogUrl, PickerTreeDlgDimension, callback, null);
You can reuse the complete functionality of the CQWP dialog using the LaunchPickerTreeDialog() function but there will be cases that this dialog is too restrictive. In that case you can build your own custom SharePoint-like dialogs.
The sample code contains a demo application page that calls a custom dialog when browse button is clicked.

You can download the sample code here. It comes with an install.bat that you can use to deploy the solution.

Project structure

This is the project structure:

Developing the dialog

The dialog itself is an .aspx page that inherits from UnsecuredLayoutsPageBase. It applies the dialog.master.  It is in fact a special type of SharePoint application page. The demo itself the dialog page has a code behind class. This code behind will populate the TreeView with lists and document libraries, and their folders.
<%@ Page Language="C#" Inherits="BPoint.SharePoint.ApplicationPages.DemoDialog" MasterPageFile="~/_layouts/dialog.master"     %>
This type of application pages that build upon the dialog.master have some special content place holders. The content place holder for the PlaceHolderAdditionalPageHead contains two ScriptLink controls: one that references thecore.js JavaScript file and one that references the PickerTreeDialog.js file.
It also contains a piece of JavaScript that validates the user selection and returns the results to the callback function defined in the calling application page.
<asp:Content ID="Content2" contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">
 <SharePoint:ScriptLink ID="ScriptLink1" language="javascript" name="core.js" runat="server" />
 <SharePoint:ScriptLink ID="ScriptLink2" language="javascript" name="PickerTreeDialog.js" runat="server" />

  <script type="text/javascript" Language="javascript">
      function ValidateAndReturn() {
          var strDlgReturnValue = new Array(1);
          strDlgReturnValue[0] = "<%= SelectedUrl.Value %>";
          var strDlgReturnErr = "<%= smtPickerError.Value %>";
          if (strDlgReturnValue[0] == null || strDlgReturnValue[0].length <= 0) {
              alert("Please, select a list or folder from the treeview before clicking the OK button");
          }
          else {
              return HandleOkReturnValues(strDlgReturnValue, strDlgReturnErr);
          }
      }
 </script>
 <SharePoint:FormDigest ID="FormDigest1" runat=server/>
</asp:Content>
Another content control is the one that references the PlaceHolderDialogBodyMainSection place holder. It contains two hidden fields: one will contain the URL to the selected list, document library or folder, and one for an eventual error message. It also contains the ASP.NET TreeView control that will be populated when the dialog loads.
<asp:Content ID="Content6" contentplaceholderid="PlaceHolderDialogBodyMainSection" runat="server">
  <DIV ID="HiddenFields" >
    <asp:HiddenField ID="SelectedUrl" Value="" runat="server" />
    <asp:HiddenField ID="smtPickerError" Value="" runat="server"/>
  </DIV>
  <DIV>
      <asp:TreeView ID="WebTreeview" runat="server" OnSelectedNodeChanged="WebTreeview_SelectedNodeChanged" ExpandDepth="1" ShowExpandCollapse="true" ShowLines="true">
          <NodeStyle HorizontalPadding="5" ForeColor="#666666" font-name="Tahoma" font-size="8pt"/>
          <SelectedNodeStyle BackColor="0x000080" ForeColor="0xFFFFFF" />
      </asp:TreeView>
   </DIV>
</asp:Content>

Comments