i'm bigginer. i used site https://www.macaw.nl/artikelen/extreme-new-document-button-makeover for creating application page which will open when someone click on button. i create button in ribbon, bu when i click on button, application page is opening with error
- The method or operation is not implemented.
- Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
-
- Exception Details: System.NotImplementedException: The method or operation is not implemented.
-
- Source Error:
-
- An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
-
- Stack Trace:
-
-
- [NotImplementedException: The method or operation is not implemented.]
- NOVODUGME.Layouts.NOVODUGME.TemplateSelector.SetTemplateLibraryFolders() +72
- NOVODUGME.Layouts.NOVODUGME.TemplateSelector.Page_Load(Object sender, EventArgs e) +107
- System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
- System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
- System.Web.UI.Control.OnLoad(EventArgs e) +132
- Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase.OnLoad(EventArgs e) +101
- Microsoft.SharePoint.WebControls.LayoutsPageBase.OnLoad(EventArgs e) +49
- System.Web.UI.Control.LoadRecursive() +66
- System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
based on this code, method settemplatelibraryfolders() is not implemented.
my aspx application page is
- <%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
- <%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
- <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
- <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
- <%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
- <%@ Register TagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"%>
- <%@ Import Namespace="Microsoft.SharePoint" %>
- <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
- <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TemplateSelector.aspx.cs" Inherits="NOVODUGME.Layouts.NOVODUGME.TemplateSelector" DynamicMasterPageFile="~masterurl/default.master" %>
-
- <asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
- <script language='javascript' type="text/javascript">
- // Open template with the corresponding Office app
- function OpenNewTemplate(strTemplate, strSaveLocation) {
- var strProgID = "SharePoint.OpenDocuments";
- createNewDocumentWithProgID(makeAbsUrl(strTemplate),makeAbsUrl(strSaveLocation), strProgID, false);
- window.frameElement.commitPopup();
- }
- </script>
-
-
- </asp:Content>
-
- <asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
-
- <div>
- <div id="Navigation" style="position: absolute; top: 0; left: 0; width: 30em">
- <asp:TreeView ID="tvFolders" runat="server"></asp:TreeView>
- </div>
- <div id="Content" style="margin-left: 30em;">
- <asp:ListView ID="lvTemplates" runat="server" GroupItemCount="5" DataKeyNames="Title">
- <LayoutTemplate>
- <table cellpadding="5" runat="server" id="tblTemplates">
- <tr id="groupplaceholder" runat="server"></tr>
- </table>
- </LayoutTemplate>
- <GroupTemplate>
- <tr id="itemPlaceholderContainer" runat="server" style="height: 80px;">
- <td id="itemPlaceholder" runat="server"></td>
- </tr>
- </GroupTemplate>
- <ItemTemplate>
- <td id="Td1" valign="top" align="center" style="width: 100px;" runat="server">
- <asp:HyperLink ID="TemplateLink" runat="server" NavigateUrl='<%# Eval("Url") %>' Target="">
- <asp:Image ID="IconImage" runat="server" ImageUrl='<%# Eval("ImageUrl") %>' />
- <br />
-
- <%# Eval("Title") %>
- </asp:HyperLink>
- </td>
- </ItemTemplate>
- </asp:ListView>
- </div>
- </div>
-
-
-
- </asp:Content>
-
- <asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
- Application Page
- </asp:Content>
-
- <asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
- My Application Page
- </asp:Content>
code cs file is
- using System;
- using Microsoft.SharePoint;
- using Microsoft.SharePoint.WebControls;
- using Microsoft.SharePoint.Administration;
- using System.Collections;
- using System.Data;
- using Microsoft.SharePoint.Utilities;
- using System.Web;
-
-
- namespace NOVODUGME.Layouts.NOVODUGME
- {
-
- public partial class TemplateSelector : LayoutsPageBase
- {
-
-
-
- public readonly DataTable _dataTable = new DataTable();
-
-
-
-
-
- protected void Page_Load(object sender, EventArgs e)
- {
-
- if (!IsPostBack)
- {
-
- SetTemplateLibraryFolders();
- }
-
- _dataTable.Columns.Add("ImageUrl", typeof(string));
- _dataTable.Columns.Add("Title", typeof(string));
- _dataTable.Columns.Add("Url", typeof(string));
-
- var selectedNode = tvFolders.SelectedNode == null ?tvFolders.Nodes[0].Value :
- tvFolders.SelectedNode.Value;
-
- GetTemplatesInSelectedFolder(selectedNode);
-
-
- lvTemplates.DataSource = _dataTable;
-
-
- }
-
- private void SetTemplateLibraryFolders()
- {
- throw new NotImplementedException();
- }
-
-
-
- private void GetTemplatesInSelectedFolder(string folderUrl)
- {
- using (SPSite site = new SPSite("http://test-net.dri.local"))
- {
- using (SPWeb web = site.OpenWeb())
- {
- SPList list = web.Lists.TryGetList("Templates");
- if (list != null)
- {
- SPDocumentLibrary docLib = (SPDocumentLibrary)list;
- SPFolder folder = web.GetFolder(folderUrl);
- AddFilesToDataTable(web, folder);
- }
- }
- }
- }
-
-
-
- private void AddFilesToDataTable(SPWeb docWeb, SPFolder folder)
- {
- foreach (SPFile file in folder.Files)
- {
-
- string docIcon = SPUtility.ConcatUrls("/_layouts/images/",SPUtility.MapToIcon(file.Web, SPUtility.ConcatUrls(file.Web.Url, file.Url),"",IconSize.Size32));
-
-
- string absUrl =(string)file.Item[SPBuiltInFieldId.EncodedAbsUrl];
-
- string action;
- if (!String.IsNullOrEmpty(HttpContext.Current.Request.QueryString["DocLib"]))
- {
-
- Guid? docLibId = new Guid(HttpContext.Current.Request.QueryString["DocLib"]);
- SPList selectedLibrary = docWeb.Lists.GetList(docLibId.Value,true);
- string docLibUrl = selectedLibrary.DefaultViewUrl;
-
-
- docLibUrl = docLibUrl.Remove(docLibUrl.LastIndexOf("Forms",StringComparison.Ordinal));
- action = string.Format("javascript:OpenNewTemplate('{0}', '{1}');",absUrl,SPContext.Current.Site.RootWeb.Url + docLibUrl);
- AddDataToDataTable(docIcon, file.Name, action);
- }
-
-
- }
- }
-
-
- private void AddDataToDataTable(string docIcon,string title,string url)
- {
- DataRow row = _dataTable.NewRow();
- row["ImageUrl"] = docIcon;
- row["Title"] = title;
- row["Url"] = url;
- _dataTable.Rows.Add(row);
- }
-
-
-
-
- }
-
-
-
- }
where is error? can someone help me with some guide