Specified value is not supported for the urlOfFile parameter

TLDR is in the last paragraph so jump there if you’re in a hurry.

A developer was attempting to deploy a site workflow to a new site and sent this error message to me. This was new but I assumed it had something to do with the fact that I had had some difficulty getting the site setup, which can happen for a number of reasons. When a site fails to setup as expected (I script site setups), I go in and delete the site, detach the SharePoint Content Database, remove the entries from a few Nintex tables via sql, Delete the databases from the sql instance, do an IIS reset and then start the process over again. For this site I had to run through this not once but 3 times!

My first stop was Central Admin to check the 3 pages in the Database Setup area. The view Database Mappings page showed that the site URL did not have the Workflow Database value so I went into Manage Database Mappings to try to set it. Well I got an error on that page that I’ve seen before when the mappings were off so I was getting closer.

I opened SSMS and checked the nintex mappings in the Storage, ContentDbMapping and Databases tables. Sure enough the DatabaseId in the Storage table was 1 less than the NWContentDbId value in the ContentDbMapping table. This was due to the multiple setups. I updated it and then checked back in CA on the the View Database Mappings page and it was showing correctly now. However the Manage Databse Mappings page still threw an error. This will still throw an error until some time has passed and then the changes will be properly reflected.

However this didn’t resolve the problem! The developer had tried to publish a workflow before there was a proper mapping of the site to a nintex database. As you know that’s kind of a required element. There was a folder in the NintexWorkflows library (<fqdn to site>/NintexWorkflows/Forms/AllItems.aspx) on the Sharepoint site that had been created and was empty. Once deleted he was able to publish the workflow.

For you sadists here is the corresponding URL entry for this error:

0x197C SharePoint Foundation         Runtime                       tkau Unexpected System.ArgumentException: urlOfFile  Parameter name: Specified value is not supported for the urlOfFile parameter.  
at Microsoft.SharePoint.SPFileCollection.get_Item(String urlOfFile)   
at Nintex.Workflow.WorkflowRepository.NameInUse(String workflowName, Guid listId, WorkflowType& workflowType)   
at Nintex.Workflow.ApplicationPages.SetName.Page_Load(Object sender, EventArgs e)   
at System.EventHandler.Invoke(Object sender, EventArgs e)   
at System.Web.UI.Control.OnLoad(EventArgs e)   
at Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase.OnLoad(EventArgs e)   
at Microsoft.SharePoint.WebControls.LayoutsPageBase.OnLoad(EventArgs e)   
at Nintex.Workflow.ServerControls.NintexLayoutsBase.OnLoad(EventArgs e)   
at Nintex.Workflow.ApplicationPages.SetName.OnLoad(EventArgs e)   
at System.Web.UI.Control.LoadRecursive()   
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) Getting Error Message for Exception System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ArgumentException: urlOfFile  Parameter name: Specified value is not supported for the urlOfFile parameter.   
at Microsoft.SharePoint.SPFileCollection.get_Item(String urlOfFile)   
at Nintex.Workflow.WorkflowRepository.NameInUse(String workflowName, Guid listId, WorkflowType& workflowType)   
at Nintex.Workflow.ApplicationPages.SetName.Page_Load(Object sender, EventArgs e)   
at System.EventHandler.Invoke(Object sender, EventArgs e)   
at System.Web.UI.Control.OnLoad(EventArgs e)   
at Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase.OnLoad(EventArgs e)   
at Microsoft.SharePoint.WebControls.LayoutsPageBase.OnLoad(EventArgs e)   
at Nintex.Workflow.ServerControls.NintexLayoutsBase.OnLoad(EventArgs e)   
at Nintex.Workflow.ApplicationPages.SetName.OnLoad(EventArgs e)   
at System.Web.UI.Control.LoadRecursive()   
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)   
at System.Web.UI.Page.HandleError(Exception e)   
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)   
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)   
at System.Web.UI.Page.ProcessRequest()   
at System.Web.UI.Page.ProcessRequest(HttpContext context)   
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()   
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)   
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) ba25629f-eb8d-2008-632b-ce07b318b838

DetachDatabase

This is a brief guide on completely removing a SharePoint 2013 on-premises site from a farm which is using Nintex Workflow. I have used this method successfully in our Test environment. For this to work for you, you will need to be a farm administrator with RDP access to a farm server as well as to central administration. This could also be done in PowerShell. I rarely need to do this and the process isn’t too complicated or time consuming as is so I’ve not scripted it yet.

Before you start consider if there is anything that you’ve been wanting to try out but have held off from doing so because of concerns about unintended side effects of those actions. This might be a good time to do that and then follow the steps below. Once you’ve notified the stakeholders, if any, of your intention to remove the site and you’ve gotten the all clear, head to Central Administration –> Application Management –> Delete a site collection and remove the site collection.

Once deleted go to Application Management –> Databases –> Manage Content Databases. Find the database name and be sure there is a zero in the Current Number of Site Collections column. If there is any positive number there then you obviously don’t want to delete this database. For security purposes I have a 1-to-1 mapping of sites to content databases, both Nintex and SharePoint. After verifying there’s no site collections in the site, click the name of the content database you want to remove and on ‘Manage Database Settings’ page, check the ‘Remove Content Database’ checkbox, dismiss the warning and click OK. The database is detached from the Farm.

Now click ‘Nintex Workflow Management’ in the Quick Launch navigation menu and then click on ‘Database Setup’. Notice that the DB you just detached from the SharePoint farm is still showing up in the list of content databases. If you visit the ‘View Database Mappings’ or ‘Manage Database Mappings’ link at the bottom of that page, both pages will not have a listing for the site you’ve removed. So the purge isn’t really complete. If your intention is to dismount the database from the SQL Server instance so that it’s no longer backed up or to just to keep things logical and clean, you’ll want to be sure it is completely purged from the SharePoint/Nintex ecosystem. You can also deactivate and reactivate the “Nintex Workflow” feature at the site collection level to force Nintex to remap your databases, but this isn’t always possible, even in a test farm.

Go ahead and open the configuration DB for Nintex. The ‘Databases’ table inside of your Nintex config DB still has a listing for the removed site. There is also an entry for it in the ‘Storage’ and ‘ContentDbMapping’ tables. You’ll want these to be gone too. If you do not have RDP access to the SharePoint app server you can use the method above to complete the purge. Otherwise RDP to your SharePoint server. In a multi-server farm configuration I run all commands on an App server rather than a WFE. Run the following:

nwadmin -o DetachDatabase -serverName <server or Alias name> -databaseName <Nintex COntent DB Name>

When I ran this on my test farm I got the following output:

de77705b-f3f6-48b6-9a88-32fbe559855a |Unable to access, site collection may no longer be present.

Content database ‘Nintex_Sen’ is in use. Detaching it will cause workflow history to be lost and workflows in site collections associated with this database to fail.
Are you sure you want to detach this database? (yes / no)

This was a test farm. The first message was obvious since I did in fact remove the site. It likely had workflows running or orphaned workflows that appeared to be running to Nintex. I answered ‘yes’ and the ‘Operation Completed’.

Returning to the Central Admin pages I now saw that on /_admin/NintexWorkflow/DatabaseSettingsView.aspx there was no listing for the content database. It was purged. I went ahead and deleted both the SharePoint and the Nintex DBs from SSMS .

There are other ways to do this and this may not even be the best way but my intention in posting is to shed some light on an NWAdmin command so I hope you found it helpful.