When you browse your forms deployed to Nintex Mobile, it’s not always immediately obvious where that form resides if you want to make changes or unpublish the form.

In most cases you will know where to find the source form, however particularly in a large or shared environment (e.g. development) you may end up with a mess of deployed forms that you want to tidy up.

Aside from inserting some submissions and then using SharePoint search to try and find where the form ended up, you can use PowerShell to interrogate the Nintex Forms database and work out the full source path to a particular form.

The code below will list all Nintex Mobile forms and the path from which they were published. Note that if you use this code it is entirely at your own risk.

Add-PSSnapin Microsoft.SharePoint.Powershell -EA 0
# Global variables
$sqlServer = "localhost"
$nintexFormsDatabase = "NintexForms"

function findSharePointPath($name, $category, $guidSite, $guidWeb, $guidList) {
    $site = Get-SPSite -Identity $guidSite
    $url = $site | %{$_.URL}
    $list = $site | Get-SPWeb -Identity $guidWeb -Limit All | %{$_.Lists} | ?{$_.ID -eq $guidList}
    $url += $list | %{$_.ParentWebURL}
    $url += "/"
    $url += $list | %{$_.RootFolder}

    Write-Host "URL for $name ($category): $url"

function querySQL($sqlServer, $nintexFormsDatabase) {
    # Connect to SQL
    $connectionString = "Server="+$sqlServer+";Database=master;Integrated Security=True"
    $sqlConnection = new-object system.data.SqlClient.SqlConnection($connectionString);

    # Create a dataset
    $dataSet = new-object "System.Data.DataSet" "NintexForms"
    $query = "SELECT * FROM ["+$nintexFormsDatabase+"].[dbo].[NM_Form] WHERE IsDeleted = '0'"

    # Create a new data adapter
    $dataAdapter = new-object "System.Data.SqlClient.SqlDataAdapter" ($query, $sqlConnection)
    $dataAdapter.Fill($dataSet) | Out-Null

    # Close the SQL connection

    # Create a new table
    $dataTable = new-object "System.Data.DataTable" "NintexMobileForms"
    $dataTable = $dataSet.Tables[0]

    # Iterate through the results
    $dataTable | FOREACH-OBJECT {
        findSharePointPath $_.Name $_.Category
        $_.SiteId $_.WebId $_.ListId

querySQL $sqlServer $nintexFormsDatabase

Leave a Reply

Your email address will not be published. Required fields are marked *