OneNoteConversionTool.OutputGenerator.OneNoteGenerator.GetPage C# (CSharp) Method

GetPage() public method

Gets the ID o fan existing page in the given section If more than one exists, it returns the first one
public GetPage ( string pageName, string sectionId ) : string
pageName string page name
sectionId string ID of the section where the page exists
return string
		public string GetPage(string pageName, string sectionId)
		{
			var pageId = String.Empty;

			try
			{
				XmlDocument xDoc = new XmlDocument();
				xDoc.LoadXml(GetPageScopeHierarchy(sectionId));
				XmlNode node = xDoc.SelectSingleNode(String.Format("//one:Page[@name='{0}']", pageName), GetNSManager(xDoc.NameTable));
				if (node != null && node.Attributes != null) 
					pageId = node.Attributes["ID"].Value;
			}
			catch (Exception e)
			{
				throw new ApplicationException("Error in GetPage: " + e.Message, e);
			}

			return pageId;
		}