Error When Updating Item Using Web Service MoveNext

Using the SharePoint REST service to update items, ran into this error:

Unable to update the sharepoint document – An error occurred while processing this request.System.Data.Services.Client.DataServiceClientException: <?

xml version=”1.0″ …

…..

at System.Data.Services.Client.DataServiceContext.SaveResult.<HandleBatchResponse>d_1e.MoveNext()

The target list was set to require checkout before items could be updated.  Once I set require checkout to No, the REST service was able to update items.

 

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.*

SharePoint Not Crawling List or Library

SharePoint search results were not correct or would be missing some data. After hours of digging around, I noticed that one Search Scope was empty. To try and fix this, I went as far as reseting the search index, yes, clearing out all the search data. No fun!

Here is what I found to work.

List Settings
Allow items from this list to appear in search results?
Change this to NO
Run a crawl on the Content Source.
Go back to List Settings.
Allow items from this list to appear in search results?
Change this to YES
Run a crawl on the Content Source.

My Search Scope filled up.
Search was working again!

create a list of groups and the users in each group

As we all know, digging through SharePoint groups looking to see what users are in each, is no fun.

To solve this, I created a new List, and added the groups I wanted to monitor.  Then, added a little PowerShell to update a column in the List with the members in each group.

Setup:

Create a new List.

New Columns:

SPgroup 

Type: Person or Group

Allow selection of: People or Group

Users

Type: Multiple lines of text

Specify the type of text to allow: 

Update Column:

Title

Require that this column contains information: No

The PowerShell script below does the following:

Get the SharePoint Site and List.

Loop through each item in the List.

Retrieve the value of the SPgroup field.

Truncate the Users field.

Loop through the users in the SPgroup.

Update the Users field with the values from SPgroup.


if(-not(Get-PSSnapin | where { $_.Name -eq "Microsoft.SharePoint.PowerShell"}))
{
      Add-PSSnapin Microsoft.SharePoint.PowerShell;
}

$sSite = Get-SPweb "http://reinmoto.com/sites/taco"
$sList=$sSite.Lists["SP Group Permissions"]
$i = 0

foreach($item in $sList.Items)
{
	$sFieldValue = $item["SPgroup"].ToString().Split('#')[1]
	$sGroup = $sSite.SiteGroups[$sFieldValue]

	If($sGroup.Users.Count -ge 0)
	{
		$item["Users"] = ""
		$item.Update()

		foreach($usr in $sGroup.Users)
			{
				if($i -eq 0)
				{
					$item["Users"] = $usr.DisplayName
				}
				else
				{
					$item["Users"] = $item["Users"] + ", " + $usr.DisplayName
				}
				$item.Update()
				$i=$i+1
			}
		$i=0
	}
}
$sSite.dispose()

Save the PowerShell script to your server.

Create a scheduled task to run the script hourly, daily, weekly, monthly…

Use PowerShell to Export a List of My Sites

How many My Sites (MySites) are currently enabled in my Farm?

if(-not(Get-PSSnapin | where { $_.Name -eq "Microsoft.SharePoint.PowerShell"}))
{
      Add-PSSnapin Microsoft.SharePoint.PowerShell;
}

$site = Get-SPsite "http://mysite.sharepointed.com/"
$spWebApp = $site.WebApplication

$log = "c:\test.txt"

foreach($site in $spWebApp.Sites)
{
    $site.url |	Out-File $log -Append
    $site.Dispose()
}

load the powershell snapin.
get the Web App hosting your My Sites.
set a variable to where you want the script to output the results to.
loop through all the sites in the Web App, and output them to your text file.