/// <summary> /// Creates the node. /// </summary> /// <param name="parentNode">The parent node.</param> /// <param name="publishingPage">The publishing page.</param> /// <returns></returns> public static IExplorerNode CreateNode(IExplorerNode parentNode, PublishingPageInfo publishingPage) { return(parentNode.ChildNodes.Add(ExplorerNodeIds.PublishingPageNodeTypeId, String.IsNullOrEmpty(publishingPage.Name) ? publishingPage.Title : publishingPage.Name, new Dictionary <object, object> { { typeof(PublishingPageInfo), publishingPage } })); }
/// <summary> /// Handles the Click event of the exportMenuItem control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MenuItemEventArgs" /> instance containing the event data.</param> void exportMenuItem_Click(object sender, MenuItemEventArgs e) { IExplorerNode pageNode = e.Owner as IExplorerNode; if (pageNode != null) { PublishingPageInfo pageInfo = pageNode.Annotations.GetValue <PublishingPageInfo>(); if (pageInfo != null) { string pageXml = pageNode.Context.SharePointConnection.ExecuteCommand <PublishingPageInfo, string>(PublishingPageCommandIds.ExportToXml, pageInfo); DTEManager.CreateNewTextFile(String.Format("{0}.xml", pageInfo.Name), pageXml); } } }
private static string ExportToXml(ISharePointCommandContext context, PublishingPageInfo pageInfo) { string pageXml = null; PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(context.Web); PublishingPage page = publishingWeb.GetPublishingPage(pageInfo.ServerRelativeUrl); if (page != null) { pageXml = ExportPublishingPage(page, context.Web, context).ToString(); } return(pageXml); }
private static Dictionary <string, string> GetProperties(ISharePointCommandContext context, PublishingPageInfo pageInfo) { Dictionary <string, string> pageProperties = new Dictionary <string, string>(); PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(context.Web); PublishingPage page = publishingWeb.GetPublishingPage(pageInfo.ServerRelativeUrl); if (page != null) { pageProperties = SharePointCommandServices.GetProperties(page); } return(pageProperties); }