Friday, 16 December 2011

InfoPath forms error - System.Net.WebException: The remote server returned an error: (401)

Brower based InfoPath forms making calls to webservices on same server giving:

System.Net.WebException: The remote server returned an error: (401) Unauthorized. Microsoft.Office.InfoPath.Server.SolutionLifetime.DataAdapterException: The remote server returned an error: (401) Unauthorized.

Solution was to disableloopbackcheck >> http://support.microsoft.com/kb/896861

VSS to TFS migration without local SQL Server Express

The VSSConverter is a handy tool if a little light on documentation. I was running into an issue with VSSConverter failing where there was no local instance of SQL Server Express.
After a few moments reflection with a glass of my favourite tipple I resumed attack on this obstacle and discovered it is possible to enter a SQL parameter on the migration settings file as follows:-
<Source name="VSS">
      <VSSDatabase name="D..."></VSSDatabase>
      <UserMap name="..."></UserMap>
      <SQL Server="SQLServerHost" />
</Source>
Job done.

Changing port of existing web application

Two step procress.
First in Central Administration navigate to Application Management \ Configure Alternate Access Mappings
In the Alternate Access Mapping Collection dropdown select the required web application
Click Edit Public URLs
Change port as required in default and any other existing URLs

Then in IIS Manager
Select the site in the Connections pane
Click Bindings
Change port bindings as required


Note: This does not update the IIS bindings: "If you update the alternate access mapping URLs of a Web application, SharePoint Foundation 2010 does not automatically update the IIS bindings." (Technet). Therefore, you must also change the port in IIS.

Tuesday, 23 August 2011

Crawl Component stuck at 'Recovering' status

Various blogs suggest to delete entirely the search service and start afresh. This a fairly drastic approach and not always practical with a production environment. Our fix was to create a new crawl component on the same server within Central Administration, this took 10 minutes to process but when it came back both the new and existing crawl components where online.


Crawl component stuck on ‘Recovering’








Two crawl components on same server.









Delete the new crawl component.


Wednesday, 10 August 2011

Export User Profile Data to CSV using PowerShell

I wanted to view all user profiles in SharePoint. However, SharePoint only allows to see 50 users. I wrote the following PowerShell script which exports all user profiles.

[Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
[Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server")
 
$siteurl = "http://mysite/"   
 
$site = New-Object Microsoft.SharePoint.SPSite($siteurl)
$context = [Microsoft.Office.Server.ServerContext]::GetContext($site)
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)


$upm.Count;
$profiles = $upm.GetEnumerator()
foreach ($userobject in $Profiles )
{
 $ln = $userobject.item("Lastname")
 $fn = $userobject.item("Firstname")
    $account = $userobject.item("AccountName")
 $user = $userobject.item("PreferredName")
 $office = $userobject.item("Office")
 Write-output "$fn;$ln;$user;$account;$office"
}
$site.Dispose()

Monday, 25 July 2011

Granular Restore of SharePoint Content

There are occasions when the site and site collection recycle bins are insufficient for recovering deleted content.
Examples
· When a site itself is deleted it does not go into a recycle bin.


· When the various thresholds for the recycle bins have been exceeded.


Restore Process
Restore is performed as three steps:
· Restore of a content database
· Inside SharePoint Central Administration, Unattached Content Database Recovery
· Powershell on SharePoint Application Server


Restore of a content database
Ask Infrastructure team to restore a copy of the intranet content database to database server with a different name. It is important to have a different name otherwise the production content database will be overwritten.


Unattached Content Database Recovery
Open the Central Administration site


Navigate to Back and Restore \ Recover Data from an Unattached Content Database



Enter the Database Server and Database Name of the restored database.


In the Operation to Perform I used Export Site or List but could also use Browse Content.
Click Next
Select the Site Collection, Site and optionally List to restore. Click Next
In the File Location enter something relative to application server e.g. \\melap01\f$\export.cmp



Click Start Export.
Wait for it to finish, use the Refresh button to check status.


Create a Temporary Site to receive the restored content
Too high risk to restore directly into the production site so create a new temporary restore site somewhere, ideal candidate would be beneath the site where the content is missing from.
Open SharePoint 2010 Management Shell (PowerShell) prompt on application server.
Type: Import-SPWeb
When prompted for the identity, enter the URL for the new restore site.
When prompted for the path, enter the path for the backup file that you created in previous step, e.g. \\MELAP01\F$\export.cmp


Click Enter.



Open the generated log file and check for errors.
Navigate to the temporary site and examine restored content. Pull out required documents and upload to the required site, check with user before deleting temporary site.
Delete .cmp file and log form MELAP01.

Wednesday, 13 July 2011

Changing Date Format In SharePoint

To change a date format to YYYY-MM-DD, follow the below steps:
+ On the root site go to Site Actions
+ Site Settings
+ Under site Administration, click Regional Settings, select appropriate Time Zone