DotNetWikiBot Framework Documentation

The Page type exposes the following members.

Constructors

  NameDescription
Public methodPage()()()()
This constructor creates Page object without title using most recently created Site object.
Public methodPage(Int64)
This constructor creates Page object with specified page's numeric revision ID (also called "oldid") using most recently created Site object.
Public methodPage(String)
This constructor creates Page object with specified title using most recently created Site object.
Public methodPage(Site)
This constructor creates empty Page object with specified Site object, but without title. Avoid using this constructor needlessly.
Public methodPage(Site, Int64)
This constructor creates Page object with specified page's numeric revision ID (also called "oldid"). Page title is retrieved automatically in this constructor.
Public methodPage(Site, String)
This constructor creates Page object with specified title and specified Site object. This is preferable constructor. Basic title normalization occurs during construction. When constructed, new Page object doesn't contain text, use Load()()()() method to get text and metadata from live wiki.

Methods

  NameDescription
Public methodAddTemplate
Adds a specified template to the end of the page text, but before categories.
Public methodAddToCategory
Adds the page to the specified category by adding a link to that category to the very end of page's text. If the link to the specified category already exists, the function silently does nothing.
Public methodConvertHtmlMarkupToWikiMarkup
Function converts basic HTML markup in this page's text to wiki markup, except for tables markup. Use ConvertHtmlTablesToWikiTables()()()() function to convert HTML tables markup to wiki format.
Public methodConvertHtmlTablesToWikiTables
Function converts HTML table markup in this page's text to wiki table markup.
Public methodCorrectNsPrefix
Changes default English namespace prefixes to correct local prefixes (e.g. for German wiki sites it changes "Category:..." to "Kategorie:...").
Public methodDelete
Deletes the page. Administrator's rights are required for this action.
Public methodDownloadImage
Downloads image, audio or video file, pointed by this page's title, from the wiki site to local computer. Redirection is resolved automatically.
Public methodExists
Returns true, if text field is not empty. Don't forget to call Load()()()() before using this function.
Public methodStatic memberFormatTemplate(String, Dictionary<(Of <<'(String, String>)>>))
Formats a template with the specified title and parameters. Default formatting options are used.
Public methodStatic memberFormatTemplate(String, Dictionary<(Of <<'(String, String>)>>), String)
Formats a template with the specified title and parameters. Formatting options are got from provided reference template. That function is usually used to format modified template as it was in it's initial state, though absolute format consistency can not be guaranteed.
Public methodStatic memberFormatTemplate(String, Dictionary<(Of <<'(String, String>)>>), Boolean, Boolean, Int32)
Formats a template with the specified title and parameters, allows extended format options to be specified.
Public methodGetAllCategories
Returns list of strings, containing category names found in page's text and added by page's templates.
Public methodGetAllLinks
Returns the list of strings, containing all wikilinks ([[...]]) found in page's text, excluding links in image descriptions, but including interlanguage links, links to sister wiki projects, categories, images, etc.
Public methodGetCategories()()()()
Returns the list of strings which contains category names found in page's text, with namespace prefix, without sorting keys. You can use the resultant strings to call FillFromCategory(String) or FillFromCategoryTree(String) function. Categories added by templates are not returned. Use GetAllCategories() function to get such categories too.
Public methodGetCategories(Boolean, Boolean)
Returns the list of strings which contains categories' names found in page text. Categories added by templates are not returned. Use GetAllCategories()()()() function to get categories added by templates too.
Public methodGetExternalLinks
Returns the list of strings which contains external links found in page's text.
Public methodGetFirstTemplateParameter
This helper method returns specified parameter of a first found instance of specified template. If no such template or no such parameter was found, empty string "" is returned.
Public methodGetImages
Returns a list of files, embedded in this page.
Public methodGetInterLanguageLinks
Gets interlanguage links for pages on WikiMedia Foundation's projects.
Public methodGetLinks
Finds all wikilinks in page text, excluding interwiki links, categories, embedded images and links in image descriptions.
Public methodGetNamespace
Identifies the namespace of the page.
Public methodGetSecurityTokens
Gets security tokens which are required by MediaWiki to perform page modifications.
Public methodGetSisterwikiLinks
Returns links to sister wiki projects, found in this page's text. These may include interlanguage links but only those embedded in text, not those located on wikidata.org
Public methodGetTemplateParameter
Returns specified parameter of a specified template. If several instances of specified template are found in text of this page, all parameter values are returned.
Public methodGetTemplates
Returns the templates found in text of this page (those inside double curly brackets {{...}} ). MediaWiki's "magic words" are not returned as templates.
Public methodGetTitle
Retrieves the title for this Page object using page's numeric revision ID (also called "oldid"), stored in "revision" object's property. Make sure that "revision" property is set before calling this function. Use this function when working with old revisions to detect if the page was renamed at some point.
Public methodGetWikidataItem
For pages that have associated items on Wikidata.org this function returns XElement object with all information provided by Wikidata. If page is not associated with a Wikidata item null is returned.
Public methodGetWikidataLinks
For pages of Wikimedia foundation projects this function returns interlanguage links located on Wikidata.org.
Public methodIsDisambig
Returns true, if this page is a disambiguation page. This function automatically recognizes disambiguation templates on Wikipedia sites in different languages. But in order to be used on other sites, disambig variable must be manually set before this function is called. disambig should contain local disambiguation template's title or several titles delimited by '|' character, letters case doesn't matter, e.g. "disambiguation|disambig|disam". Page text will be loaded from wiki if it was not loaded prior to function call.
Public methodIsEmpty
Returns true, if text field is empty. Don't forget to call Load()()()() before using this function.
Public methodIsRedirect
Returns true, if page redirects to another page. Don't forget to load actual page contents from live wiki Load()()()() before using this function.
Public methodLoad
Loads page text and metadata (last revision's ID, timestamp, comment, author, minor edit mark) from wiki site. If the page doesn't exist it's text will be empty (""), no exception is thrown.
Public methodLoadFromFile
Loads page text from the specified UTF8-encoded file.
Public methodLoadTextOnly
Loads page text from live wiki site via raw web interface. If Page.revision is specified, the function gets that specified revision. If the page doesn't exist it's text will be empty (""), no exception is thrown. This function is very fast, but it should be used only when metadata is not needed and no page modification is required. In other cases Load()()()() function should be used.
Public methodStatic memberParseTemplate
Parses the provided template body and returns the key/value pairs of it's parameters titles and values. Everything inside the double braces must be passed to this function, so first goes the template's title, then '|' character, and then go the parameters. Please, see the usage example.
Public methodProtect
Protects or unprotects the page, so only authorized group of users can edit or rename it. Changing page protection mode requires administrator (sysop) rights.
Public methodRedirectsTo
Returns redirection target. Don't forget to load actual page contents from live wiki Load()()()() before using this function.
Public methodRemoveFromCategory
Removes the page from category by deleting link to that category in page text.
Public methodRemoveTemplate
Removes all instances of a specified template from page text.
Public methodRemoveTemplateParameter
Removes the specified parameter of the specified template. If several instances of specified template are found in text of this page, either first instance can be affected or all instances.
Public methodRenameTo(String, String)
Renames the page. Redirection from old title to new title is automatically created.
Public methodRenameTo(String, String, Boolean, Boolean)
Renames the page. Redirection from old title to new title is automatically created.
Public methodResolveRedirect
If this page is a redirection, this function loads the title and text of redirection target page into this Page object.
Public methodRevert
Undoes the last edit, so page text reverts to previous contents. The function doesn't affect other actions like renaming.
Public methodReviseInMsWord
This function opens page text in Microsoft Word for editing. Just close Word after editing, and the revised text will appear back in text variable.
Public methodSave()()()()
Saves contents of text to live wiki site. Uses defaultEditComment and minorEditByDefault (true by default).
Public methodSave(String)
Saves specified text in page on live wiki. Uses defaultEditComment and minorEditByDefault (true by default).
Public methodSave(String, Boolean)
Saves text contents to live wiki site.
Public methodSave(String, String, Boolean)
Saves specified text on page on live wiki.
Public methodSave(String, String, Boolean, Boolean)
Saves specified text on page on live wiki.
Public methodSaveToFile()()()()
Saves text to the ".txt" file in current directory. Use Directory.SetCurrentDirectory() function to change the current directory (but don't forget to change it back after saving file). The name of the file is constructed from the title of the article. Forbidden characters in filenames are replaced with their Unicode numeric codes (also known as numeric character references or NCRs).
Public methodSaveToFile(String)
Saves page text to the specified file. If the target file already exists it is overwritten.
Public methodSetTemplateParameter
Sets the specified parameter of the specified template to new value. If several instances of specified template are found in text of this page, either first value can be set, or all values in all instances.
Public methodShowText
Sends page text to console.
Public methodShowTitle
Sends page title to console.
Public methodUndoLastEdits
Undoes all last edits made by last contributor. The function doesn't affect other operations like renaming or protecting.
Public methodUnwatch
Removes page from bot account's watchlist.
Public methodUploadImage
Uploads local image to wiki site. Function also works with non-image files. Note: uploaded image title (wiki page title) will be the same as title of this Page object, not the title of source file.
Public methodUploadImageFromWeb
Uploads web image to wiki site.
Public methodWatch
Adds this page to bot account's watchlist.

Fields

  NameDescription
Public fieldcomment
Last edit comment.
Public fieldlastBytesModified
Number of bytes modified during last edit.
Public fieldlastLoadTime
Time of last page load (UTC). Used to detect edit conflicts.
Public fieldlastMinorEdit
True, if last edit was minor edit.
Public fieldlastUser
Username or IP-address of last page contributor.
Public fieldlastUserId
Last contributor's ID in MediaWiki database.
Public fieldpageId
Page's ID in MediaWiki database.
Public fieldrevision
Page revision ID in the MediaWiki database.
Public fieldsite
Site, on which this page is located.
Public fieldtext
Page's text.
Public fieldtimestamp
Date and time of last edit expressed in UTC (Coordinated Universal Time). Call "timestamp.ToLocalTime()" to convert to local time if it is necessary.
Public fieldtitle
Page's title, including namespace prefix.
Public fieldwatched
True, if this page is in bot account's watchlist.

See Also