Interview Questions administrator

Best SharePoint administrator Interview Questions and Answers with topic wise:


Recycle Bin | MMS | ManagedVsCrawledProperties |

Thursday, September 25, 2014

create sharepoint boolean field using powershell script

Please visit my below post which helps on how to create sharepoint list using powershell script:
Create sharepoint list using powershell script

Note: By default, below method sets the boolean field as Yes(1). If you want as No(0), provide the 0 value to the "DefaultValue"
****************************************************************************************
$lncustomListName listName
$docSite = new-object Microsoft.SharePoint.SPSite($siteURL)
$docWeb = $docSite.OpenWeb()

/* To create Boolean field */
Add-SPBooleanField -listName $lncustomListName -Name EmailFlag -DisplayName EmailFlag -Required TRUE -DefaultValue 1

/* Method to create boolean field */
function Add-SPBooleanField([string]$listName, [string]$DisplayName, [string]$Name, [string]$Required,[string]$DefaultValue)
{
  $OpenList = $docWeb.Lists[$listName]
  $fldXml = "<Field Type='Boolean' DisplayName='"+$DisplayName +"' Required='"+ $Required +"' Name='"+ $Name +"'>
           <Default>$DefaultValue</Default>
           </Field>"
  $OpenList.Fields.AddFieldAsXml($fldXml,$true,
  [Microsoft.SharePoint.SPAddFieldOptions]::AddFieldToDefaultView)
}

*****************************************************************************************
Please let me know if faced any issues.

Sunday, September 21, 2014

Create sharepoint datetime control using powershell script

Visit my previous post for to create a list through powershell script
Create list using powershell script
*********************************************************************************
$lncustomListName listName
$docSite = new-object Microsoft.SharePoint.SPSite($siteURL)
$docWeb = $docSite.OpenWeb()

/* To create DateTime field for allow only one user/group */
Add-SPDateTimeField -listName $lncustomListName -Name DateTimeFieldName  -DisplayName DateTimeFieldName  -DateType DateOnly -Required FALSE

/* Method to create people DateTime field */
function Add-SPDateTimeField([string]$listName, [string]$DisplayName, [string]$Name, [string]$Required, [string]$DateType)
{
   $OpenList = $docWeb.Lists[$listName]
   $fldXml = "<Field Type='DateTime' DisplayName='"+ $DisplayName +"' Format='"+ $DateType +"' Required='"+ $Required +"' Name='"+ $Name +"'/>"
   $OpenList.Fields.AddFieldAsXml($fldXml,$true,
   [Microsoft.SharePoint.SPAddFieldOptions]::AddFieldToDefaultView)
}
**********************************************************************************
Please let me know if faced any issues.

Saturday, September 13, 2014

Create sharepoint multi people picker field through powershell script

Visit my previous post for to create a list through powershell script and to create people picker for allow single user/group
Create a new sharepoint list using powershell script
Create a people picker column to allow single user/group

**********************************************************************************
$lncustomListName listName
$docSite = new-object Microsoft.SharePoint.SPSite($siteURL)
$docWeb = $docSite.OpenWeb()

/* To create people picker field for allow mutliple users and groups */

Add-SPUserField -listName $lncustomListName -DisplayName MyList -Name MyList -Required TRUE

function Add-SPMultiUserField([string]$listName, [string]$DisplayName, [string]$Name, [string]$Required)
{
   $OpenList = $docWeb.Lists[$listName]
   $fldXml = "<Field Type='User' DisplayName='"+ $DisplayName +"' Required='"+ $Required +"' Name='"+ $Name +"'/>"
   $OpenList.Fields.AddFieldAsXml($fldXml,$true,
   [Microsoft.SharePoint.SPAddFieldOptions]::AddFieldToDefaultView)
   $fieldname=$OpenList.Fields[$DisplayName]
   $fieldname.AllowMultipleValues=$true
   $fieldname.update()  
}
*********************************************************************************

Create sharepoint People Picker field through powershell script

Visit my previous post for to create a list through powershell script
Create list using powershell script

********************************************************************************
$lncustomListName listName
$docSite = new-object Microsoft.SharePoint.SPSite($siteURL)
$docWeb = $docSite.OpenWeb()

/* To create people picker field for allow only one user/group */
Add-SPUserField -listName $lncustomListName -DisplayName MyList -Name MyList -Required TRUE

/* Method to create people picker field
function Add-SPUserField([string]$listName, [string]$DisplayName, [string]$Name, [string]$Required)
{
   $OpenList = $docWeb.Lists[$listName]
   $fldXml = "<Field Type='User' DisplayName='"+ $DisplayName +"' Required='"+ $Required +"' Name='"+ $Name +"'/>"
   $OpenList.Fields.AddFieldAsXml($fldXml,$true,
   [Microsoft.SharePoint.SPAddFieldOptions]::AddFieldToDefaultView)   
}
*******************************************************************************
Please let me know if faced any issues.

Wednesday, September 3, 2014

SharePoint administrator interview questions and answers: Recycle Bin 2


<<Previous page>>                                                                                            


How can we restore the deleted sub site from the Recycle Bin in SharePoint 2007?
There is no direct way to restore the deleted sites from the Recycle Bin in SharePoint 2007. But there was a wonderful tool from Codeplex: Site Delete Capture http://governance.codeplex.com/ to back up sites automatically when they gets deleted, So that we can restore a deleted site collection in SharePoint 2007.

From the SharePoint 2010 onwards, we can restore the deleted sub site from the second stage of recycle Bin. If we delete the sub site, SharePoint will keep the deleted site in site collection recycle bin.
Note: You can find the deleted site secondary recycle bin i.e  “Deleted from end user Recycle Bin

Is it possible to recreate the deleted site in sharepoint? [Means i have deleted a  site(http://ab.com) and trying to recreate with the same]?
Sol: In MOSS2007, When you delete a Site from the site settings it is deleted permanently. That meanns we can able to recreate the same once got deleted but from SharePoint 2010 onwards, When you delete a Site from the site settings it is deleted gradually.
Means, if you delete a site, and then create the site with the same name, SharePoint will ask you if you wish to permanently delete the site from the recycle bin so that you can re-create the site


How to restore the deleted site collection in SharePoint?
In prior versions of SharePoint Server 2010, if a site collection (that is, an SPSite object) was accidentally deleted, there was not a direct way of restoring a specific deleted site collection. The only method to restore a deleted site collection was to restore the entire farm from a backup. This was costly and time consuming, and typically was not performed.

When a site collection is accidentally deleted in SharePoint Server 2010 with SP1, the deleted site collection is stored in the SPDeletedSite object, not the SPSite object. Therefore, to restore a deleted site collection, you must use the Restore-SPDeletedSite Windows PowerShell cmdlet or programmatically access the object model.

E.g.:  Get-SPDeletedSite -Identity /sites/sitename | Restore-SPDeletedSite

My SharePoint site has exceeded the mentioned  Quota size limit but users still wants to add new doc to the document library? How can we achieve this?
Shorter way: Delete the unwanted data from the second stage of Recycle Bin.

Longer way: Increase Quota limit to the web application.

Note: Go with the second option only in case of if there is no unwanted data available in Recycle Bin. But keep in mind Release required to change the Quota limit [Why I mentioned “Release” point here we cannot directly change anything until unless get approval from the business users in higher level organizations].

Realtime Scenerio: I created site with 200MB of size and uploaded 200MB size of files to the document library[e.g:  2files and each one is having 100MB of size]. Later on, deleted those documents from the document library. But when I try to upload the 50MB of file again to the document library got the exception and it says: site Quota is FULL.
The reason for the exception is, those deleted 200MB files are still stays in first stage of Recycle Bin. Solution: Delete those from the both first stage/second stage Recycle Bin and then try to upload or increase the site Quota.

Note :2nd stage of Recyle Bin, overwritten the old data when it exceeds.

<<Previous page>>