Monday 1 October 2012

Internal server error in SharePoint search

When running SharePoint search  I stuck with the error saying nothing but Internal Server error.
After much hit and try I found that below steps helped me in solving the error.


  • Restart the SharePoint timer services/ IIS/ SharePoint Search service / Restart Server
  • Enable "Search Server WebParts" feature on the Site Collection level.
  • Run the "Search and Process" Timer Job
  • Make sure your search service application is associated with right proxy! (Go to Application Management >> Select Configure service application associations under the Service Application heading >>Select the default Application, select Your sevice app, Then click on set as default)
  • ensure that the "SharePoint Server Search" and "Search Query and Site Settings Service" services are running
  • Verify your AAM Settings
  • ensuring that the application pool is assigned correctly
  • Remove and reinstall the search application


 

Monday 17 September 2012

NetBiosDomainNamesEnabled and SharePoint User Profile Service Application

NetBiosDomainNamesEnabled  property is set for every UPA (User Profile Service Application). By default this property is set false. We need to enable NetBios Domain Names for UPA when Domain Fully Qualified Domain Name (FQDN/DNS) is different then NetBIOS name.

Now the question araises how do we check whether the DNS and NetBIOS names.

Open Active Directory Users and Computers, right click and choose Properties.
you will see the below properties.

1 is your DNS/FQDN and 2 is your NetBios Domain Name.


If you dont have access to your domain Active Directory you can get the information using PowerShell command.

To find FQDN

[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().Name
To find NetBIOS name
Get-ADDomain -Identity "YourFQDN"
Now if you find that DNSRoot and NetBIOSName properties are not same then before synchronizing your UPA enable the NetBiosDomainNamesEnabled.
Below is the PowerShell command to enable the import of NetBios Domain Names.
Get-SPServiceApplication 
(lists the Service Applications and their GUIDs)
$UPA = Get-SPServiceApplication –Id <GUID of User Profile Service Application>
$UPA.NetBIOSDomainNamesEnabled=1
$UPA.Update()

Then start the UPA synchronizartion.

Hope this help!!
Cheers!!
Isha Jain




Friday 14 September 2012

User Profile Synchonization Service Stuck on Starting

Starting User Profile Synchonization Service in SharePoint is always a big pain. Most of the time it stuck on Starting mode and you dont have controll to stop this.

You can stop the User profile Synchronization Service.
http://donalconlon.wordpress.com/2010/08/27/deleting-the-search-service-application/

There are many reasons for this.

1. The account which you are using to run the service might not have "Replicate Directory Changes" permission in your AD.

Solution:
http://www.codeproject.com/Articles/358855/user-profile-synchronization-service-not-starting

2. This account which you are using to run the service  might not have explicit access to the folder C:\Program Files\Microsoft Office Servers\14.0.

The reason we need to give explicit access to the folder is User Profile Synchronization service access AD through ForeFront Identity Manager Synchronization Service.

Thus in order to start User Profile Synchronization Service, Microsoft Forefront Identity Manager Synchronization Service have full access and this Forefront Synchronization service sits at C:\Program Files\Microsoft Office Servers\14.0.\Synchronization Service\UIShell called as miisclient (Microsoft ForeFront Identity Manager).

Solution: Give access
http://melick-rajee.blogspot.com.au/2011/07/user-profile-synchronization-service.html

3.The password for the account which you are using to run the service is not correct.

Solution: Enter proper password or if the password is expired reset the password in AD and then  following the below link
http://info.izzy.org/Blog/archive/2010/08/04/how-to-fix-an-out-of-sync-password-issue-in-sharepoint-2010.aspx
http://blogs.technet.com/b/seanearp/archive/2011/01/25/updating-passwords-on-sharepoint-2010.aspx

Hope this help.
Cheers
Isha
 

Thursday 13 September 2012

Fix for SharePoint Search 2010 not able to connect to machine that hosts the admin component.

I faced a ugly error today on my central admin says Search Service not able to connect to the machine that host the administration component.

I read many blogs and mostly said create a new Search Service Application. I tried that but still the problem exists.

Below are the steps I followed to solve the issue of Serch Service Application.

1. Deleted the existing Search Service Application.
  
a. Get-SPServiceApplication
This will help to get the Search Service Application GUID.Copy the Search Service Application GUID
b. stsadm -o deleteconfigurationobject -id <GUID> from step a.

2. Delete the Application Pool for Search Service Application

a. Get-SPServiceApplicationPool
This will lists all the Service Application Pool. Find the one associated with Search Service Application
b.Remove-SPServiceApplicationPool <ApplicationPoolName>

3.Delete the CrawlStoreDB, PopertyStoreDB and AdminDB from the SQL Server responsible for holding all information related to Search Service Application.

Above three steps are just the clean up steps

4.Now Create the Search Service Application using the below blog
http://waelmohamed.wordpress.com/2011/05/31/configure-sharepoint-2010-search-service-application/

5.Now If you still see the error then the trick is beloe simple STSADM command
Resolution: Run the following stsadm command

stsadm -o provisionservice -action start -servicename osearch14 -servicetype "Microsoft.Office.Server.Search.Administration.SearchService, Microsoft.Office.Server.Search, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"

do a simple iisreset /noforce

Thats it!!! it will start working!!!

Hope this will help and fix the issue.
 

Tuesday 11 September 2012

How to split one file into many based on condition using PowerShell


I have been in a scenario where I have to spilt the CSV file content into many .CSVs based on some condition.
Below are the steps I have followed to achieve this using PowerShell.

At First I import the CSV file which I need to spit and then for each data row in the csv file call the function “CreateOrAppendCSV “  by passing two parameters each data row entry and filename.

IMPORT-CSV “C:\Source.csv” | Foreach-Object { $path=$filePath+".csv"; select-object -input $_ -prop @{Name='Name';expression={$_.Name;}},@{Name='Url';expression={$_.Url;}} |  CreateOrAppendCSV  $_ $path }

# This will create the new csv file if not exists or append to the existing csv file for position
Function CreateOrAppendCSV{
Param($item,$path)
If(Test-Path $path -PathType Leaf) # This Test-Path command checks for file exists or not
{
    # If file exists then append using ADD-Content Command  
   $fileImport= Import-Csv $path
   $newItem= New-Object PsObject     
   $newItem | Add-Member -MemberType NoteProperty -Name "Name" -Value $item.Name
   $newItem | Add-Member -MemberType NoteProperty -Name "Url" -Value $item.Url
   $newItem | ConvertTo-Csv  -NoTypeInformation|select -Skip 1 | Add-Content $path
}
Else
{
   $item | Export-Csv -Path $path -NoTypeInformation #Export if file not exists.
}
}

Hope this help.
Isha Jain

Friday 7 September 2012

PowerShell with Exchange

Here is something new I learnt today.

In order to create a mailbox for an active directory user using powershell we need to Get-PSSnapin for Exchange and Import-Module for Active Directory.

Clear-Host

#SnapIn for Exchange Mailbox
if(-not(Get-PSSnapin | Where-Object {$_.Name -eq "Microsoft.Exchange.Management.PowerShell.E2010"}))
{
  Add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010
}

#SanpIn For SharePoint
if(-not(Get-PSSnapin | Where-Object {$_.Name -eq "Microsoft.SharePoint.PowerShell"})) {
  Add-PSSnapin Microsoft.SharePoint.PowerShell;
}

# Add Active Directory Snap-In
Import-Module ServerManager
Add-WindowsFeature RSAT-AD-PowerShell
Import-Module ActiveDirectory

Once this Import is done we can call the "New-Mailbox" command which will create the mailbox and AD user.

This command will create mailbox along with user creation in AD.

New-Mailbox -Name $displayName -Database $dbName  -Password $password -UserPrincipalName $userPrincipalName -Alias $samAccountName  -DisplayName $displayName -FirstName $givenName -LastName $surname -OrganizationalUnit $ouPath    

This command will create user in AD and then you can enable the mailbox

New-ADUser -Enable $True -PasswordNeverExpires $enable -PassThru  -Name $displayName -GivenName $givenName -Surname $surname -DisplayName $displayName -EmailAddress $emailAddress -SamAccountName $samAccountName -Title $title -Department $department  -UserPrincipalName $userPrincipalName -Path $path -AccountPassword $password

Enable-Mailbox $userPrincipalName –Database $dbName

Hope this help.
Isha
 

Thursday 30 August 2012

Export SharePoint List data into CSV file

Hi,

I have found couple of blogs explaning the reverse way of expoting csv file data into SharePoint list. I have accomplished the other way around and hence thought of sharing this with you.

InOrder to export data from SharePoint list into CSV file, lets first query SharePoint list and get the required items and then we will export these items into CSV file.


$spSiteUrl = "http://sharepointwebapplication"
$listtitle="My Custom List"
$spWeb= Get-SPWeb -Identity $spSiteUrl
Function ImportDataFromListToCSV
{
  IF($spWeb -ne $null)
  {
  $list = $spWeb.Lists.TryGetList($listtitle)
  $exportlist = @()
  $items = $list.Items
  Write-Host "Exporting........" -ForegroundColor Yellow
  if($items -ne $null)
  {
    #Here "givenName" column name for CSV file and "Given Name" column name SharePoint List
    $items | %{ select-object -input $_ -prop @{Name='givenName';expression={$_["Given     Name"];}},@{Name='surname';expression={$_["Family Name"];}};}| Export-Csv -Path C:\Demo.csv -NoTypeInformation
    Write-Host "SharePoint list data is exported successfully." -ForegroundColor Green
    $spWeb.Dispose()
 }
 Else
 {Write-Host "No data found in the list "$listtitle -ForegroundColor Yellow}}
}

Enjoy PowerShell,
Isha Jain
 

Wednesday 29 August 2012

SharePoint and PowerShell

I have realised the importance and power of PowerShell and hence thought about sharing.

These days I am working very deeply with PowerShell in SharePoint.

Sending an email using PowerShell...

Function SendMail
{
  $smtpServer = "your SMTP server name"
  $logFileName= "C:\test.txt"
  $att = new-object Net.Mail.Attachment($logFileName)
  $msg = new-object Net.Mail.MailMessage
  $smtp = new-object Net.Mail.SmtpClient($smtpServer)
  $msg.From ="test@gmail.com"
  $msg.To.Add("he@gmail.com")
  $msg.To.Add("she@gmail.com")
  $msg.Subject = "Test Mail"
  $msg.Body = "This is a test email.
  $msg.Attachments.Add($att)
  $smtp.Send($msg)
  $att.Dispose()
}

Power of SPQuery Object in SharePoint....

$spSiteUrl = "http://webapplication"
$spWeb= Get-SPWeb -Identity $spSiteUrl

Function EmptySPList
{ Param($listname)
  IF($spWeb -ne $null)
  {
   $list = $spWeb.Lists.TryGetList($listname)
   $caml=""
   $query=new-object Microsoft.SharePoint.SPQuery
   $query.ViewAttributes = "Scope='Recursive'"
   $query.Query=$caml
   $items=$list.GetItems($query)
   $items | % { $list.GetItemById($_.Id).Delete()  }
   Write-Host "Items from list '" $listname "' are deleted successfully." -ForegroundColor Green
  }}

Function FindSpecificSPListItems
{
 Param($list)
 $dateFrom=[Microsoft.SharePoint.Utilities.SPUtility]::CreateISO8601DateTimeFromSystemDateTime([DateTime]::Today)
 $dateTo=[Microsoft.SharePoint.Utilities.SPUtility]::CreateISO8601DateTimeFromSystemDateTime([DateTime]::Today.AddMonths(-3))
 $spQuery = New-Object Microsoft.SharePoint.SPQuery
 $spQuery.ViewAttributes = "Scope='Recursive'";
 $spQuery.RowLimit = 100
 $caml = '<Where><And><Leq><FieldRef Name="Date" /><Value  Type="DateTime">'+$dateFrom+'</Value></Leq><Geq><FieldRef Name="Date" /><Value Type="DateTime">'+$dateTo+'</Value></Geq></And></Where><OrderBy><FieldRef Name="Title" Ascending="True" /></OrderBy>'
 $spQuery.Query = $caml
 $listItems = $list.GetItems($spQuery)
 if($listItems -ne $null)
 {
  #do some stuff
 }}

Cheers,
Isha

Saturday 17 March 2012

Site Templates in MOSS 2007 and SharePoint Server 2010

The following are the list of Site Templates in MOSS 2007

Under Collaboration

  • Team Site (STS Template)
  • Blank Site (STS Template)
  • Document Workspace (STS Template)
  • Wiki (WIKI Template)
  • Blog (BLOG Template)
Under Meeting
  • Basic Meeting Workspace (MPS Template)
  • Blank Meeting Workspace (MPS Template)
  • Decision Meeting (MPS Template)
  • Social Meeting (MPS Template)
  • Multipage Meeting (MPS Template)
Under Enterprise
  • Document Center (BDR Template)
  • Record Center (OFFile Template)
  • Site Directory (SPSSITES Template)
  • Report Center (SPSREPORT CENTER Template)
  • Search Centre with Tabs (SPCHEN Template)
  • My Site Host (SPSMSITEHOST Template)
  • Search Center (SRCHCENTERLITE Template)
Under Publishing
  • Collaboration Portal
  • Publishing Portal (BLANKINTERNETCONTAINER Template)

The following are the list of Site Templates in SharePoint Server 2010

Under Collaboration
  • Team Site (STS Template)
  • Blank Site (STS Template)
  • Document Workspace (STS Template)
  • Blog (BLOG Template)
  • Visio Process Repository (VISPRUSTemplate)
  • Group Work Site (SGSTemplate)
Under Meeting
  • Basic Meeting Workspace (MPS Template)
  • Blank Meeting Workspace (MPS Template)
  • Decision Meeting (MPS Template)
  • Social Meeting (MPS Template)
  • Multipage Meeting (MPS Template)
Under Content and Data
  • Document Center (BDR Template)
  • Record Center (OFFile Template)
  • Business Intelligence Centre (BICenterSite Template)
  • Report Center (SPSREPORT CENTER Template)
  • My Site Host (SPSMSITEHOST Template)
  • PowerPoint Broadcast Site (POWERPOINTBROADCAST Template)
  • Personalisation Site (SPSMSITE Template)
Under Publishing
  • Enterprise Wiki (ENTERWIKI Template)
  • Publishing Portal (BLANKINTERNETCONTAINER Template)
Under Web Database
  • Asserts Web Database (ACCSRV Template)
  • Charitable Contribution Web Database (ACCSRV Template)
  • Contacts Web Database (ACCSRV Template)
  • Issues Web Database (ACCSRV Template)
  • Projects Web Database (ACCSRV Template)
Under Search
  • Basic Search Centre (SRCHCENTERLITE Template)
  • FAST Search Centre (SRCHCENTERFAST Template)
  • Enterprise Search Centre (SRCHCEN Template)
Below are the 10 newly added Site Templates and 4 removed Site Template List in SharePoint 2010

10  Newly Added Templates
  • Basic Search Centre
  • FAST Search Centre
  • Enterprise Search Center
  • Group Work site
  • Visio Process Repository
  • Charitable Contribution Web Database
  • Projects Web Database
  • Enterprise Wiki
  • PerformancePoint
  • Business Intelligence Center

4  Removed Templates
  • Site Directory
  • Search Centre with Tabs
  • Search Center
  • Collaboration Portal

Friday 16 March 2012

Thursday 8 March 2012

Yahoo! User Interface Library and Controls

YUI Library is a free open source JavaScript and CSS framework that helps in building rich interactive web applications.

More Information is available at : http://developer/yahoo.com/yui/

This library contains numerous controls like TabView,ProgressBar,Color Picker, TreeView etc.

The YUI TreeView control provides rich visual presentation of hierarchical data representation.

The following line of code will give the tree view output as shown below.



Cheers!!