About Ian Hayse

A lengthy career working as a SharePoint developer, admin, and architect. I'm now working in the Power Platform and Azure spaces. What happened to InfoPath?

Does creating a folder start a workflow?

Does creating a folder cause a workflow to run?

Yes, when you create a folder, SharePoint treats it like you are uploading a new document.

If you only want to run a workflow on documents that are created or changed, you will need to add a step to your workflow.

The workflow condition would be:

If Current Item: Content Type equals Folder

Stop workflow

Doing this will stop the workflow each time a folder is added or changed.

 

The breakpoint will not currently be hit. No symbols have been loaded for this document

You will find a lot of different ways to solve this error, but this worked for me.

Working in Visual Studio set a break point.
Hit F5 or Start Debugging.

IE will open.
Start a new InPrivate Browsing IE session (ctrl+Shift+p).
From your first IE session, copy the URL and paste it into your InPrivate session and load the site.

Browse to the item that will trigger your breakpoint.

That’s it.

After doing the above sets, I didn’t see the The breakpoint will not currently be hit. No symbols have been loaded for this document error again.

*update*
Using Chrome or Firefox also helped with avoiding this error.

Update users display name in SharePoint

The script below will allow you to change a users display name in SharePoint.


# add SharePoint snap-in if needed

 	$ntName = "domain\XXX"
	$displayName = "New Name"
 	$webApp = "http://webapp.sharepointed.com/"
	$user = Get-SPUser -web $webApp -Identity $ntName
	
	Get-SPWebApplication $webApp | Get-SPSite -Limit ALL | Get-SPWeb -Limit ALL | ForEach-Object {
		Set-SPUser -Identity $user -DisplayName $displayName -Web $_.URL
	}

SharePoint Specified cast is not valid

SharePoint pages were not loading on one server in our farm after doing a registry updated.

http://msdn.microsoft.com/en-us/library/aa973248.aspx

Turned out that a Key value was incorrectly set. Once the Key value was fixed, pages started loading.

Server Error in ‘/’ Application.
——————————————————————————–

Specified cast is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Specified cast is not valid.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidCastException: Specified cast is not valid.]
Microsoft.SharePoint.SPRequestManager.get_SPRequestsPerThreadWarning() +26657440
Microsoft.SharePoint.SPRequestManager.Add(SPRequest request, Boolean shareable) +340
Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(SPSite site, String name, Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous) +27989305
Microsoft.SharePoint.SPRequestManager.GetContextRequest(SPRequestAuthenticationMode authenticationMode) +268
Microsoft.SharePoint.Administration.SPFarm.get_RequestAny() +173
Microsoft.SharePoint.SPRegionalSettings.get_GlobalInstalledLanguages() +27
Microsoft.SharePoint.Administration.SPTemplateFileSystemWatcher.RefreshInstalledLocales() +60
Microsoft.SharePoint.Administration.SPTemplateFileSystemWatcher.Initialize() +69
Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.System.Web.IHttpModule.Init(HttpApplication app) +931
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +480
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +336
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +350
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +382

[HttpException (0x80004005): Specified cast is not valid.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11335878
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +88
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4355300

——————————————————————————–
Version Information: Microsoft .NET Framework Version:2.0.50727.5472; ASP.NET Version:2.0.50727.5456

Cleaning up a drop off library mess

You installed SharePoint, then your power users enabled the content organizer feature all over your farm. This isn’t necessarily a bad thing, but if it’s not being used, turn it off! Less load on the farm, the better off you will be.

You will find plenty of examples on the web about cleaning up this mess, but I took a slightly different approach. Before disabling the feature and deleting the library, I first checked to make sure the library was empty and no content org rules had been created.

Start-SPAssignment -Global

$web = Get-SPWeb "http://webapp.sharepointed.com"
$feature = Get-SPFeature "7ad5272a-2694-4349-953e-ea5ef290e97c" 

   if ($web.Features[$feature.ID]) 
   {
            $corList = $web.lists["Content Organizer Rules"]
            $dolList = $web.lists["Drop Off Library"]
            
            #check for Cont Org Rules and items in Drop Off Library
            if(($corList.ItemCount -eq 0) -and ($dolList.ItemCount -eq 0))
            {
                  #disable the feature
                  Disable-SPFeature -Identity "7ad5272a-2694-4349-953e-ea5ef290e97c" -Url $_.URL -Confirm:$false
                  
                  #remove the Drop Off Library
                  $dolList.AllowDeletion = $true
                  $dolList.Update()
                  $dolList.Delete()
            }
   } 

Stop-SPAssignment -Global

Accessing search.asmx from a site collection

My goal was to setup a desktop app to query the SharePoint Search Web Service located at: http://webApp/managedPath/siteCollection/_vti_bin/search.asmx

Guide for creating the app:
http://msdn.microsoft.com/en-us/library/ff394650.ASPX

In my app, I needed to query a site collection, not the root site. Also needed to pass in my test-account username, password, and domain.

Error 1:

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> Attempted to perform an unauthorized operation.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
.....

Error 2:

System.Net.WebException: The request failed with HTTP status 401: Unauthorized.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)

Error1 was the primary issue.
Error2 was related to an incorrect login.

When creating my app, I used a web reference pointing to http://webApp/managedPath/siteCollection/_vti_bin/search.asmx . After receiving Error1 countless times, I opened the App.config file. In there I found the answer…

For some great reason, Visual Studio updated the reference to point to the root web app, not the site collection.

http://webApp/_vti_bin/search.asmx

Updated the App.config file to point to the site collection, no more Error1.

http://webApp/managedPath/siteCollection/_vti_bin/search.asmx

Connection I used:

//queryService.Credentials = System.Net.CredentialCache.DefaultCredentials;
queryService.Credentials = new NetworkCredential("testAccountName", "thePassword", "domain");

Use PowerShell to Create Year and Month Folders in Library

How do you create a year and month folder structure in a SharePoint document library?

Every year, I needed to create a folder structure in a report library that looks like this:

Next Year – 01 …… 12

Using PowerShell I’m able to create the parent folder (year), then create the subfolders (months).

*NOTE*
This can be executed using a scheduled task or using a workflow in SharePoint Designer with the help of the iLoveSharePoint add in.

if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {
    Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}

$spWeb = Get-SPWeb "http://sharepointed.com/sites/reports"
$spDocLib = $spWeb.Lists["TacoReports"]

$yearFolder = (get-date (Get-Date).AddYears(1) -UFormat "%Y")

$targetFolder = $spWeb.GetFolder($spDocLib.RootFolder.ServerRelativeUrl + "/$yearFolder")

if($targetFolder.Exists -eq $false)
{
    $spFolder = $spDocLib.AddItem("",[Microsoft.SharePoint.SPFileSystemObjectType]::Folder,$yearFolder)
	$spFolder.Update()

	$i = 1
	While ($i -le 12)
	{
		$subFolder= "{0:D2}" -f $i
		$spSubFolder = $spDocLib.AddItem($spFolder.Folder.ServerRelativeUrl,[Microsoft.SharePoint.SPFileSystemObjectType]::Folder,$subFolder)
		$spSubFolder.Update()

		$i++
	}
}

Get the current year and add one.
Check if the new folder already exist.
Create the year folder.
Then create the twelve subfolders (one for each month).

Task ‘SharePoint’ reported error (0x80004005): an error occurred in this SharePoint list

From what I have read in other blogs and forums, this might not be the fix for everyone.

Error in Outlook:
0x80004005

Using Fiddler, I was seeing the same reference to http://randomSite.SP.com.

In my case, it turned that I had an outdated / not used URL in my Alternate Access Mappings.
Default Zone was set to http://goodSite.SP.com
Intranet Zone was set to http//randomSite.SP.com

Once http://randSIte.SP.com was removed, the Outlook error went away.
(removing the mapping did NOT induce an IISreset.)

Alternate Access Mappings can be found here:
http://YourCentralAdminSite/_admin/AlternateUrlCollections.aspx

Full error:
Task ‘SharePoint’ reported error (0x80004005) : ‘An error occurred in this SharePoint List (site name – list name). Try updating the folder again. If the problem continues, contact the SharePoint site administrator. HTTP 500.
The server returned the following error message: Exception of type
‘Microsoft.SharePoint.SoapServer.SoapServerException’ was thrown.’

Fiddler referenced this web service:
GetListItemChangesSinceToken

HTMLCHECKERLib.XMLPProcessorClass The form template failed to load

Lists that use InfoPath for the display and edit forms were randomly producing errors. It was randomly happening because, one of the WFE servers in the farm was out of sync.

To test, I logged into each WFE, then tried to display the list forms. Testing worked on one box but failed on the other.

From the WFE that was not displaying the forms, I ran the following command.

From the start menu, locate the Command Prompt icon, right click on it, then click on Run as administrator. One the command window opens, paste in the command below.

regsvr32 “C:\Program Files\Common Files\Microsoft Shared\OFFICE14\htmlchkr.dll”

This will not cause an IISreset.

Couple of the errors in the log.

10/18/2013 09:05:28.16 w3wp.exe (SPW2:0x46DC) 0x2D30 InfoPath Forms Services Maintenance 82fv Critical The form template failed to load. (User: domain\user, Form Name: Template, IP: , Request: http://sharepointed.com/site/Lists/listname/blah.aspx, Form ID: urn:schemas-microsoft-com:office:infopath:list:-AutoGen-2012-11-28T21:23:23:720Z, Type: InvalidCastException, Exception Message: Unable to cast COM object of type ‘HTMLCHECKERLib.XMLPProcessorClass’ to interface type ‘HTMLCHECKERLib.IHTMLtoXHTML’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{A260B372-BC78-441B-8764-D0B83F4004F4}’ failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).) 9130d182-80de-4da7-96d6-b2a566aea3e7
• 10/18/2013 09:05:28.18 w3wp.exe (SPW2:0x46DC) 0x2D30 InfoPath Forms Services Runtime 8gec Exception Unhandled exception when rendering form System.InvalidCastException: Unable to cast COM object of type ‘HTMLCHECKERLib.XMLPProcessorClass’ to interface type ‘HTMLCHECKERLib.IHTMLtoXHTML’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{A260B372-BC78-441B-8764-D0B83F4004F4}’ failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)). at HTMLCHECKERLib.XMLPProcessorClass.Convert(String bstrHTML) at Microsoft.Office.InfoPath.Server.DocumentLifetime.EventRichTextChange.HtmlToCleanXHtml(String html, Boolean makeDomCompatible) at Microsoft.Office.InfoPath.Server.SolutionLifetime.ItemFieldConnectorRichText.WriteValueNode(ListField fieldInformation, XmlWriter resultWriter, Object value) at Microsoft.Office.InfoPath.Server.SolutionLifetime.ItemFieldConnectorRichText.WritePropertyFromItem(Context context, ResultListItem listItem, XmlWriter resultWriter, ListField fieldInformation, String itemFieldsNamespacePrefix, String itemFieldsNamespace) at Microsoft.Office.InfoPath.Server.SolutionLifetime.DataAdapterListDataProvider.PopulateXmlForMultipleItems(Context context, ResultListItemIterator listItems, Dictionary`2 existingFields, Int64& auxDomSize) at Microsoft.Office.InfoPath.Server.SolutionLifetime.DataAdapterListDataProvider.PopulateXmlForSingleItem(SPListItem listItem, SPListItemVersion currentVersion, XPathNavigator resultFields, Dictionary`2 existingFields, Document document, Int64& auxDomSize) at Microsoft.Office.InfoPath.Server.SolutionLifetime.DataAdapterListDataProvider.LocalListItemQuery(SPContentTypeId contentTypeId, Document document, XPathNavigator resultFields, Boolean& needRegenerateChoice, Dictionary`2& existingFields, Int64& auxDomSize) at Microsoft.Office.InfoPath.Server.SolutionLifetime.DataAdapterListDataProvider.Execute(String siteUrl, Guid listId, SPContentTypeId contentTypeId, Document document, DataAdapterListDataProvider documentAdapter, Boolean useDcl, XPathNavigator queryFields, XPathNavigator resultFields, Boolean isListItemEditing, Boolean discoveryOnly, Int64& auxDomSize) at Microsoft.Office.InfoPath.Server.DocumentLifetime.DataAdapterListDataProvider.ExecuteInternal(XPathNavigator queryFields, XPathNavigator resultFields, Boolean useListItemMode) at Microsoft.Office.InfoPath.Server.SolutionLifetime.RulesActionQueryListItem.ExecuteRule(Document document) at Microsoft.Office.InfoPath.Server.SolutionLifetime.RuleAction.EvaluateExpression(Document document, XPathNavigator currentTarget) at Microsoft.Office.InfoPath.Server.SolutionLifetime.RulesRuleSet.EvaluateExpression(Document document, XPathNavigator targetNavigator) at Microsoft.Office.InfoPath.Server.DocumentLifetime.Document.FireRulesHelper(Boolean onLoadRules) at Microsoft.Office.InfoPath.Server.DocumentLifetime.Document.PerformOnLoadEvent(Dictionary`2 intputParameters) at Microsoft.Office.InfoPath.Server.DocumentLifetime.Document.LoadSolutionAndDocument(HttpContext context, Solution solution, DocumentMetaInformation documentMetaInformation, OnInitializeCallback onInitializeCallback, OpenParameters openParameters) at Microsoft.Office.InfoPath.Server.DocumentLifetime.Document.OpenDocumentWithSolution(HttpContext context, SPSite contextSite, Solution solution, DocumentMetaInformation documentMetaInformation, OnInitializeCallback onInitializeCallback, OpenParameters openParameters) at Microsoft.Office.InfoPath.Server.DocumentLifetime.Document.NewFromSolution(HttpContext context, SPSite contextSite, Solution solution, DocumentMetaInformation documentMetaInformation, Boolean disableFirstRequestOptization, OnInitializeCallback onInitializeCallback, OpenParameters openParameters) at Microsoft.Office.InfoPath.Server.Controls.XmlFormView.DataBindInternal(SolutionMetaInformation solutionMetaInformation, DocumentMetaInformation documentMetaInformation, String absoluteSolutionLocation, Boolean hasCloseHandler, Document& document) at Microsoft.Office.InfoPath.Server.Controls.XmlFormView.StartNewEditingSession() at Microsoft.Office.InfoPath.Server.Controls.XmlFormView.EnsureDocument(EventLogStart eventLogStart) at Microsoft.Office.InfoPath.Server.Controls.XmlFormView.<>c__DisplayClass8.b__5() at Microsoft.Office.Server.Diagnostics.FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock) 9130d182-80de-4da7-96d6-b2a566aea3e7

Change List or Library URL and Name

Recently had a scenario where I needed to move a bunch of libraries from different sites, to another farm. Every library was titled the same, so when I went to import the libraries, I ran into a small issue. Using a combo of Export-SPweb and Import-SPweb, I moved a library over, then updated the library url and name to the source site name.

if ((Get-PSSnapin “Microsoft.SharePoint.PowerShell” -ErrorAction SilentlyContinue) -eq $null)
{
Add-PSSnapin “Microsoft.SharePoint.PowerShell”
}

$webURL = “http://sharepointed.com/sites/taco”

$before = “LibBefore”
$after = “LibAfter”

#Change the URL of the library
$web = Get-SPWeb $webURL
$web.lists[$before].RootFolder.MoveTo($after)
$Web.Dispose()

#Update the library name
$web = Get-SPWeb $webURL
$list = $web.Lists[$after]
$list.Title = $after
$list.Update()
$web.Dispose()

Couple notes.
You might be able to shorten the script to rename and update in a couple lines of code.
If you use the script to change the URL of a list, the list will moved to the root of the site. it will no longer live at site/lists.

*I have not tested this with libraries or list that workflows associated with them. It’s also safe to assume any links to documents would be broken.*