Quantcast
Channel: SharePoint Diary
Viewing all 1058 articles
Browse latest View live

Set Default Home Page in SharePoint 2013

$
0
0
Its a common requirement in SharePoint 2013 to change its home page to some customized ones. In SharePoint 2013, to set homepage these options are available:

Change default home page on SharePoint 2013 Team sites:
  •  Navigate to your desired page
  • Click on "Page" tab, Click on "Make Homepage" button from the ribbon.
    sharepoint 2013 set homepage
  • Confirm to the "If you make this page the home page for this site, users will no longer be able to see the old site home page. Do you want to set this page as this site's home page?" message box.
    sharepoint 2013 default home page
  • Done!

SharePoint 2013 set default home page on Publishing sites:
The above method works for Publishing sites also. However, there is an another method too!
  • Navigate to site settings >> Click on "Welcome Page"
    link under "Look and Feel" sectionsharepoint 2013 change home page
  • Enter the home page URL either directly or by Clicking on "Browse" button and choosing the right page.
    sharepoint 2013 default home page
  • Click on "Ok" to save your changes.
Using SharePoint Designer to to change home page in SharePoint 2013
To change home page in SharePoint 2013 with SharePoint designer, follow these steps:
  • Navigate to "Site Pages" library, or any other library where your target page exists
  • Right click on the page and choose "Set as Home page" menu item from the context menu. Alternatively, you can use the Ribbon button also as highlighted.
    sharepoint 2013 edit home page
Set home page programmatically in SharePoint 2013:
If you want to set home page programmatically, Here is the code:

Change Home page using PowerShell:
Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue

#Variables
$WebURL="http://intranet.crescent.com"
$HomePageURL="SitePages/default.aspx"

#Get the Web
$web = Get-SPWeb $WebURL

#Change Welcome page
$RootFolder = $Web.RootFolder
$RootFolder.WelcomePage = $HomePageURL
$RootFolder.Update()

$web.Dispose()

Related post: How to Set Welcome Page Programmatically in SharePoint

Get All Site Collections Size (Storage Used, Allocated), Owners, Database Details with STSADM

$
0
0
Do you know the STSADM command line tool can do this still in SharePoint 2013? Yes! it can get you the quick peek view of all site collections in the given web application. It gets you details such as:
  • Storage space allocated - Storage used, warning and maximum levels
  • Site collection GUIDs
  • Site collection database names
  • Primary and Secondary Owners
Simply trigger command line and run: 
Stsadm -o EnumSites -url http://Sharepoint-web-app-URL 

This command line retrieves all details as listed above in XML format. Lets export that XML to a file and get it in Excel for better analysis. Run:
Stsadm -o EnumSites -url http://Sharepoint-web-app-URL > SitesInfo.xml 

Once completed, Open the XML file in Microsoft Excel, choose "As an XML Table"
and you should get the table as below:

How to Remove a Column from SharePoint List using PowerShell

$
0
0
Requirement: User created a calculated column with error in its formula! That caused the list view web part to crash! couldn't remove the column from SharePoint list using web UI.

Solution: PowerShell script to delete the column from SharePoint list!
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Variables
$SiteURL="http://intranet.crescent.com/"
$ListName="Change Request"
$ColumnName="Activity Status"

#Get Internal Name of the columns
$web = Get-SPWeb $SiteURL

#Get the list
$list = $web.Lists.TryGetList($ListName)

if($List -ne $null)
{
#Get the column
$column = $list.Fields[$ColumnName]

if($column -ne $null)
{
#Reset column properties to allow delete
$column.Hidden = $false
$column.ReadOnlyField = $false
$column.Sealed = $false
$column.Update()

#Delete the column from list
$list.Fields.Delete($column)
write-host "Column has been deleted!" -f Green
}
else
{
write-host "Specified column name not found!" -ForegroundColor Red
}
}

Bulk remove columns from SharePoint list using PowerShell:
To make it reusable, lets wrap the code inside a function and call, to bulk delete columns from SharePoint list. 
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Custom Function to delete a column with PowerShell
Function Remove-Column($WebURL, $ListName, $ColumnName)
{

#Get Internal Name of the columns
$web = Get-SPWeb $WebURL

#Get the list
$list = $web.Lists.TryGetList($ListName)

if($List -ne $null)
{
#Get the column
$column = $list.Fields[$ColumnName]

if($column -ne $null)
{
#Reset column properties to allow delete
$column.Hidden = $false
$column.ReadOnlyField = $false
$column.Sealed = $false
$column.Update()

#Delete the column from list
$list.Fields.Delete($column)
write-host "Column '$ColumnName' has been deleted!" -f Green
}
else
{
write-host "Specified column name not found!" -ForegroundColor Red
}
}
else
{
write-host "Specified List is not found!" -ForegroundColor Red
}
}

#Variables
$WebURL="http://intranet.crescent.com"
$ListName="Change Request"

#Array to hold column titles
$ColumnNames=@("Change Type","Approvers","Proposed Date and Time")

#Process each column
$ColumnNames | foreach {

#Call the function to remove column
Remove-Column $WebURL $ListName $_
}

Send HTML Format E-Mails with Send-MailMessage in PowerShell

$
0
0
Requirement: Send E-mail from PowerShell script with HTML formatted body.

Solution: Here is an example for sending E-mail as HTML from PowerShell script with Send-MailMessge cmdlet:
#Get Date
$ReportDate = Get-Date -format "MM-dd-yyyy"

#Configuration Variables for E-mail
$SmtpServer = "smtp.crescent.com" #or IP Address such as "10.125.150.250"
$EmailFrom = "Site Delete Script <SiteDeleteScript@Crescent.com>"
$EmailTo = "SharePointSupport@Crescent.com.com"
$EmailSubject = "Site Delete Script - Daily Report on: "+$ReportDate

#HTML Template
$EmailBody = @"

<table style="width: 68%" style="border-collapse: collapse; border: 1px solid #008080;">
<tr>
<td colspan="2" bgcolor="#008080" style="color: #FFFFFF; font-size: large; height: 35px;">
Site Delete Script - Daily Report on VarReportDate
</td>
</tr>
<tr style="border-bottom-style: solid; border-bottom-width: 1px; padding-bottom: 1px">
<td style="width: 201px; height: 35px">&nbsp; Number of requests Approved</td>
<td style="text-align: center; height: 35px; width: 233px;">
<b>VarApproved</b></td>
</tr>
<tr style="height: 39px; border: 1px solid #008080">
<td style="width: 201px; height: 39px">&nbsp; Number of requests Rejected</td>
<td style="text-align: center; height: 39px; width: 233px;">
<b>VarRejected</b></td>
</tr>
</table>

"@

#Get Values for Approved & Rejected variables
$ApprovedCount= Get-ApprovedReq()
$RejectedCount= Get-RejectedReq()

#Replace the Variables VarApproved, VarRejected and VarReportDate
$EmailBody= $EmailBody.Replace("VarApproved",$ApprovedCount)
$EmailBody= $EmailBody.Replace("VarRejected",$RejectedCount)
$EmailBody= $EmailBody.Replace("VarReportDate",$ReportDate)

#Send E-mail from PowerShell script
Send-MailMessage -To $EmailTo -From $EmailFrom -Subject $EmailSubject -Body $EmailBody -BodyAsHtml -SmtpServer $SmtpServer

and the output:
powershell send mailmessage body as html
Instead of directly embedding the HTML into the script, you can also store it in an external file and retrieve the HTML format/template with Get-Content cmdlet in the script.

Tail: 
Send-mailmessage in PowerShell with attachments:
Just specify the -attachments parameter in Send-Mailmessage cmdlet. Here is an example:
#send-mailmessage in powershell with attachment
$attachment = "D:\Reports\SiteDeleteRpt.csv"

#send-mailmessage in powershell multiple attachments
$attachment = "D:\Reports\SiteDeleteRpt1.csv","D:\Reports\SiteDeleteRpt2.csv"

Send-MailMessage -To $EmailTo -From $EmailFrom -Subject $EmailSubject -Body $EmailBody -BodyAsHTML -Attachments $attachment -SmtpServer $SmtpServer

Send-mailmessage in PowerShell to multiple recipients:
It Just needs an array!
$EmailTo = "marcm@crescent.com", "victor <victor@crescent.com>"
#or use:
$recipients = @("Marc M <marcm@crescent.com>", "victor <victor@crescent.com>")

How to Add a Link to SharePoint 2013 Suite Bar

$
0
0
Requirement: Add a link to SharePoint 2013 suite bar.

Solution:Edit SharePoint 2013 Master page to add a new link in Suite Bar
Adding link to suite bar in SharePoint 2013 can be achieved by following these simple steps:
  • Open your SharePoint 2013 site in SharePoint designer 2013. Navigate to "Master Pages" folder
  • Right click on your master page (by default: Seattle.master) and choose "Edit file in Advanced Mode"
    adding link to suite bar in sharepoint 2013
  • Locate the text: id="DeltaSuiteLinks" and add the below code just below the DeltaSuiteLinks tag to add link to suite bar of SharePoint 2013
    <span id="CustomerSupport" class="ms-core-suiteLink">
    <a class="ms-core-suiteLink-a" href="http://support.crescent.com">
    <asp:Label ID="lblCS" runat="server" Text="Customer Support"></asp:Label>
    </a>
    </span>
    add link to sharepoint 2013 suite bar
  • Save and close SharePoint designer. This adds link to SharePoint 2013 suite bar and you should see the new link as below:add link to suite bar sharepoint 2013

Approach 2: Add New Link to SharePoint 2013 Suite Bar using jQuery
Edit and Place this jQuery in your master page, just above closing of HEAD tag (</head>).
<script type="text/javascript" src="http://code.jquery.com/jquery-1.2.6.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
//Define new links
var newLinks = "<li class='ms-core-suiteLink'> \
<a class='ms-core-suiteLink-a' href='http://extranet.crescent.com'>Extranet</a> \
</li> \
<li class='ms-core-suiteLink'> \
<a class='ms-core-suiteLink-a' href='http://support.crescent.com'>Customer Support</a> \
</li> ";

$('.ms-core-deltaSuiteLinks').prepend(newLinks);
alert('works');
});

</script>

Get SharePoint Timer Job History using PowerShell

$
0
0
Requirement: Retrieve and review the SharePoint timer job history for troubleshooting an issue.

Solution: SharePoint 2013 Central Administration site provides an interface to review timer job history. Here are the steps to get SharePoint timer job history in SharePoint.
  • Navigate to SharePoint 2013 Central Administration site
  • Go to Monitoring >> Check Job statussharepoint 2013 export timer job history
  • Click on "Job History" link from left navigation
     sharepoint 2013 timer job history
  • Under the "View" filter, choose "Job Definition". You'll find an cascading filter appears as "Job Definition" once you choose View filter as "Job definition". You can also choose options such as: Service, Web Application, Server.sharepoint 2013 powershell timer job history
  • Click on the job definition filter to "change job definition"
    sharepoint powershell get timer job history
  • Pick the relevant timer job definition. E.g. Audit Log Trimming, Immediate Alerts, etc.
    sharepoint 2010 get timer job history powershell
  • Now, you'll find the jobs history for selected timer job as below.
    sharepoint 2010 export timer job history
PowerShell script to search and export timer job history for a particular time period:
Why PowerShell? Well, the above central admin page provides the interface to analyze timer jobs associated with particular job or service, but there isn't any easy way to get timer job history for a specific time period other than navigating page by page. So, lets use PowerShell script to find and extract timer job history.

Get all timer jobs of a web application:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

# Variables
$WebAppURL = "http://intranet.crescent.com"
$StartTime = "09/26/2015 01:00:00 AM" # mm/dd/yyyy hh:mm:ss
$EndTime = "09/26/2015 01:30:00 AM"

#Get all timer jobs associated with a web application
$WebApp = Get-SPWebApplication $WebAppURL

$Results = $WebApp.JobHistoryEntries |
where { ($_.StartTime -ge $StartTime) -and ($_.EndTime -le $EndTime) } |
Select JobDefinitionTitle,WebApplicationName,ServerName,Status,StartTime,EndTime

#Send results to Grid view
$Results | Out-GridView

Get timer job history for a specific timer job:
# Variables
$StartTime = "09/26/2015 01:00:00 AM" # mm/dd/yyyy hh:mm:ss
$EndTime = "09/26/2015 01:30:00 AM"
$TimerJobName = "Immediate Alerts"

#To Get Yesterday's use:
#$StartDateTime = (Get-Date).AddDays(-1).ToString('MM-dd-yyyy') + " 00:00:00"
#$EndDateTime = (Get-Date).AddDays(-1).ToString('MM-dd-yyyy') + " 23:59:59"

#Get the specific Timer job
$Timerjob = Get-SPTimerJob | where { $_.DisplayName -eq $TimerJobName }

#Get all timer job history from the web application
$Results = $Timerjob.HistoryEntries |
where { ($_.StartTime -ge $StartTime) -and ($_.EndTime -le $EndTime) } |
Select WebApplicationName,ServerName,Status,StartTime,EndTime

#Send results to Grid view
$Results | Out-GridView

Failed Timer Jobs History Report:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

# Variables
$WebAppURL = "http://intranet.crescent.com"
$StartTime = "01/01/2016 01:00:00 AM" # mm/dd/yyyy hh:mm:ss
$EndTime = "05/01/2016 01:30:00 AM"
$OutPutFile="D:\FailedJobHistoryRpt.csv"

#Get all timer jobs associated with a web application
$WebApp = Get-SPWebApplication $WebAppURL

#Get all Failed Timer jobs in between given Time
$Results = $WebApp.JobHistoryEntries | Where {($_.StartTime -ge $StartTime) -and ($_.EndTime -le $EndTime) -and ($_.Status -ne 'Succeeded')}

#Export to CSV
$Results | Export-Csv $OutPutFile –NoType

write-host "Failed Timer jobs history Exported to CSV!" -F Green

and the output report:
sharepoint timer job history powershell
This CSV gives you the real quick way to analyze timer job history.

Top 50 Use Cases of SharePoint in the Industry

$
0
0
Most of the people knows Microsoft SharePoint as a File Share, But apart from File Share, there are number ways SharePoint is being used by organizations. Here is the list of top 50 use cases in my experience:
  1. Document Management System
  2. File Shares
  3. Content Management System
  4. Enterprise Search Centre (Search site to index and search all sites, including non-SharePoint sites of the company)
  5. Enterprise Social Networking Site - Yammer!
  6. Corporate News Portal-Intranet-Extranet-Internet web Sites
  7. Project Management tool (with or without project server integration)
  8. Team Collaboration work space
  9. Employee Self-Service portal - Employee requests center
  10. Business process Automation/Workflows – BPM E.g. Expense Reimbursement, Travel Request
  11. Event Management - Party!
  12. Knowledge Base - KB sites
  13. Issue/bug Tracker system
  14. Reporting Tool - SSRS!
  15. Task Management
  16. Calendar Sharing - Corporate Calendars with important events and schedules
  17. Help desk management - Ticketing system
  18. Incident/Change Management - as part of process!
  19. Learning / Training Management, Competency management, Training Scheduling and Materials
  20. Innovation Management
  21. Blog Sites - Wiki sites
  22. Community Portal
  23. Electronic Forms to capture and process data - InfoPath!
  24. Performance/Goal tracker tool
  25. Organizational Browser – People directory!
  26. Personal sites- My site!
  27. Business Performance Reporting - MIS
  28. Case Management
  29. Inventory Tracking
  30. Competitive Analysis Site
  31. Discussion Forums
  32. Invoice Management
  33. Request/ Change Management
  34. Employee Activities Site - Associations– E.g. Sports League, Toast Master
  35. Request for Proposal
  36. Process Management, Policies and Procedure Templates
  37. Room and Equipment Reservations
  38. Physical Asset Tracking and Management
  39. Job Requisition and Interview Management
  40. Contacts Management
  41. Leave Request and Vacation Schedules
  42. Records / Document Life cycle management
  43. Business Intelligence Tool
  44. Surveys
  45. Meeting Management
  46. Dashboards & Scorecards Solutions
  47. Visio Process Repository
  48. Digital Assets Management - Image management
  49. Vendor & Customer management
  50. Portfolio management

Compare SharePoint List Items using PowerShell

$
0
0
Requirement: We've two task lists with hundreds of rows in it. Wanted to compare these two SharePoint Lists and extract the difference from both of them.

Solution: Lets use PowerShell script to compare and extract the difference between SharePoint lists!
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Variables for Processing
$SiteURL = "http://projects.crescent.com"
$ListOneName ="Team One Tasks"
$ListTwoName ="Tasks Two Tasks"
$ColumnToCompare="Task Name"

#Get site and List objects
$Web = Get-SPWeb $SiteURL
$ListOne = $web.lists[$ListOneName]
$ListTwo = $web.lists[$ListTwoName]

#Fetch specifc Column Values from each lists to compare
$ListOneValues = @()
$ListTwoValues = @()

$ListOne.Items| foreach { $ListOneValues+= $_[$ColumnToCompare] }
$ListTwo.Items | foreach { $ListTwoValues+= $_[$ColumnToCompare] }

#Compare
Compare-Object $ListOneValues $ListTwoValues # -PassThru

Output: Here the InputObject column gives the difference.
Compare SharePoint Lists using PowerShell

The SideIndicator simply denotes where is the difference is.
  • <= - Difference is in Left side - first object we compare
  • => - Difference is in the Right side - Second object in the comparison

Load SharePoint Snapin to Powershell ISE by Default

$
0
0
Problem:  If you use the PowerShell ISE to edit your SharePoint-PowerShell scripts, you may noticed that SharePoint cmdlets are not available by default until you explicitly load them with "Add-PSSnapin" cmdlet. This is because the ISE doesn't load SharePoint PowerShell Snap-ins by default.

Solution: Here is the nifty trick to load SharePoint snap-in in PowerShell ISE by default! All you have to do is: Add the SharePoint snap-in to your PowerShell ISE profile file, which is getting executed each time you fire PowerShell ISE! Here is how:
  1. To make sure that the profile file is created, run:
    #Check if the profile file exists already
    if (test-path $profile)
    {
    write-host "profile file already exists at: $profile"
    }
    else
    {
    #Create the profile file
    New-Item -type file -path $profile -force
    write-host "profile file has been created!"
    }
    This script will create a new profile file, if it isn't created already! Your output will be something like:
    add sharepoint snapin to powershell ise
  2. Open the profile file you received from above script, Add the below line to it. (in my case, its: C:\Users\salaudeen\Documents\WindowsPowerShell\Micro
    soft.PowerShellISE_profile.ps1)
    Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue
  3. Save and close
So, from now on, you don't need to explicitly load SharePoint PowerShell snapins as your first line of script! This will definitely save your time and enhance your scripting experience. To make this change for all users, use: $profile.AllUsersAllHosts instead of $profile in the above script.

Change Log Files Location for Diagnostic (ULS/Trace) Log, Usage and Health Data Collection

$
0
0
No doubts, diagnostic logs and "Usage and health data" logs are extremely helpful. However, it could cause performance issues and slow down SharePoint if not managed properly. These logs can use large amounts of drive space and can affect server performance. Also can quickly fill the system disk which could potentially bringing the entire system down!

So,  it is recommended to change these log files to a different drive.

How to change Diagnostic Logging location in SharePoint 2013?
By default, logging is configured to write logs to the drive and partition where SharePoint 2013 is installed at "C:\Program Files\Common Files\Microsoft shared\Web Server Extensions\15\LOGS". Changing the SharePoint 2013 log settings can be done using PowerShell or Central Admin.
  • Go to Share 2013 Central Administration >> Monitoring 
  • Click "Configure diagnostic logging" Under Reporting groupchange sharepoint 2013 diagnostic log file location
  • Scroll down and set location for diagnostic log files. E.g. Set the log location to "D:\SPLogs\ULS"set log file location for ULS/Trace Logs in sharepoint
  • Click on "Ok" button to save your changes.
Additionally, you can set other related options such as the number of days to keep the log files, maximum disk space for log files.

Set Diagnostic log file location using PowerShell:    
Use the following command to change the diagnostic log file location.

Set-SPDiagnosticConfig -LogLocation "D:\SPLogs\ULS"  

You can combine it with other settings: 
Set-SPDiagnosticConfig -LogLocation "D:\SPLogs\ULS" -DaysToKeepLogs 90 -LogMaxDiskSpaceUsageEnabled -LogDiskSpaceUsageGB 50

Set Usage and Health Data Collection log location:
Click on "Configure usage and health data collection" link under "Reporting Group" of Monitoring section in SharePoint 2013 to change usage and health data collection log files location. E.g. Set the log location to D:\SPLogs\Health.
sharepoint 2013 usage and health logging

Set SharePoint 2013 usage and health log file location using PowerShell
Use this PowerShell command to change the Usage and usage and health data collection log files location:
Set-SPUsageService -UsageLogLocation "D:\SPLogs\UsageLogs"

Related Post: Configure Diagnostic Logging in SharePoint

Copy Alerts from One SharePoint List or Library to Another - Using PowerShell

$
0
0
Requirement: Copy Alerts from one SharePoint list to another list.

Solution: Use this PowerShell script to copy alerts between SharePoint lists or libraries.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

function Copy-SPAlerts($SourceWebUrl,$SourceList, $TargetWebUrl, $TargetList)
{
#Get the source Web & List objects
$SourceWeb = Get-SPWeb $SourceWebUrl
$SourceList= $SourceWeb.lists.TryGetList($SourceList)

#Get the Target Web & List objects
$TargetWeb = Get-SPWeb $TargetWebUrl
$TargetList= $TargetWeb.lists.TryGetList($TargetList)

#Get All Alerts of the Source list
$SourceAlertsColl = $SourceWeb.Alerts | Where-Object { ($_.List.Title -eq $SourceList.Title)}

write-host Found $SourceAlertsColl.count alerts in the source List!

if($SourceAlertsColl.Count -gt 0)
{
foreach ($SourceAlert in $SourceAlertsColl)
{
#Copy alerts from source to destination
$alert = $TargetWeb.Alerts.Add()
$alert.Title = $SourceAlert.Title
$alert.AlertType = [Microsoft.SharePoint.SPAlertType]::List
$alert.User = $SourceAlert.user
$alert.List = $TargetList
$alert.DeliveryChannels = $SourceAlert.DeliveryChannels
$alert.EventType = $SourceAlert.EventType
$alert.AlertFrequency = $SourceAlert.AlertFrequency
$alert.Update()

Write-Host "Copied Alert: $($SourceAlert.Title)" -foregroundcolor Green
}
}

}

#Variables
$SourceWebURL="http://intranet.crescent.com/PMO"
$SourceListName="Project Documents"
$TargetWebURL="http://intranet.crescent.com/sites/projects/BI/"
$TargetListName="Project Documents"

#Call the function to Copy Alerts
Copy-SPAlerts $SourceWebURL $SourceListName $TargetWebURL $TargetListName

Remember, when you copy alerts from one list to another, it triggers "New Alert Created" E-mail as:
Copy Alerts from One List to Another List in SharePoint

You can disable alerts for time being before copying: How to Disable Alerts in SharePoint List or Library

Configure Variations Feature in SharePoint 2013 - Step by Step

$
0
0
What is Variation in SharePoint 2013?
Variations feature provides multi-lingual support for SharePoint 2013 sites. It help us to manage multilingual sites by making the same content available to specific language audiences across different sites by maintaining customizable copies of the content from the source variation in each target variation. A variation consists of a set of labels (sub-sites: Each site for one variation) that is used to create a set of sites in a site collection. For example, if you want four language variations of your site, you must create four labels, one for each language.
Important: Variations feature relies on "SharePoint Server Publishing feature", So it works only on Publishing site template or sites with publishing feature activated!
Configure variation in SharePoint 2013:
Configuring variations in SharePoint 2013 is quite a easy task, just follow below steps:
Info: SharePoint 2013 Variation feature content synchronization is a unidirectional process! It syncs content from a source variation site to one or more target variation sites

Set variations settings:
To setup variation in SharePoint 2013, start with specifying settings for Variations.

Go to Site Settings >> Site Collection Administration >> Click on "Variations Settings "to set variations
settings. These settings are self-explanatory:
  • Create Everywhere -  Selected by default, this means any content created in source label will propagate to all target variations.  Sync will happen automatically
  • Create Selectively -  Variation should be triggered manually 
  • Recreate Deleted Target Page - Page should be re-created on a target variation site if the page was deleted 
  • Update Target Page Web Parts - Source web part changes updated to the target sites 
  • Notification - Email to label contact person
variation settings sharepoint 2013
These settings can be changed if needed, otherwise leave all settings to default and click OK.


Create variation label SharePoint 2013:
After configuring variation settings, proceed with creating variation labels. The very first variation label you are creating will be the "Source Variation" site. In our case, its English, Lets create it.
  • Language: This setting defines SharePoint User interface elements of the variation site. Choices appear on the site template language drop-down depends on the language packs installed.
  • Locale: Locale determines the language site based on your browser settings. It automatically redirects the browser from Variation home to target variation site. Locale helps in creating content in different languages. 
  • Variation Home: is the location site where sub sites for all labels will be created
  • Specify the Label Name for source variation and choose Publishing site template as "Publishing site". 
  • Click "OK" button to create source variation.
create variation labels

Now the source variation has been created. Proceed with creating target variation(s).

Create variation Target Labels:
Lets create target variation for "Arabic" site. Go to Site settings >> Click on "Variation Label" >> Click on "New Label". This time, You'll get a wizard for creating target variations.
  • On "Configure Your Target Label" page, Select the Site Template Language. This depends on language packs you deployed to the SharePoint server. E.g Install Arabic language pack if you want to configure variation for Arabic & to choose Arabic as as a site template language! Select locale for target variation, and then click on "Continue" button.
    SharePoint 2013 create variation
  • Run through the wizard to create a new target variation.  Choose Translation options.  I have  selected "Allow Human and Machine translation" and selected target language as "Arabic".
    create variation in sharepoint 2013
  • Choose the Target label behavior. I've selected the option to push content updates automatically from source label to target label
     language variation in sharepoint 2013
  • Name your Target label.
    Setup Variation Settings
  • Review and Click on Finish to complete target variation label creation.
    variation set up sharepoint 2013

Create Variations Hierarchy:
Once you are done with creating labels, each label should create a variation sub-site! Click on "Create Hierarchies" link from Variation labels page in site settings, that will invoke the timer job "Variations Create Hierarchies Job Definition". This timer job will be run based on its schedule.
sharepoint 2013 variation root

If the hierarchies created successfully, you can see it in the variation labels listing as below.
variation labels sharepoint 2013
Once variation Hierarchy is created, "Hierarchy is Created" status on Variation Label page will change to "Yes" and sites are created successfully, ready to browse!

SharePoint 2013 variation hierarchy not created?
Well, the timer job runs once per hour, and you got to wait! If you don't want to wait, just trigger "Variations Create Hierarchies Job Definition" on-demand. Here is how:
  • Navigate to SharePoint 2013 Central Administration
  • Click on: Monitoring >> Review job definitions under Timer Jobs
  • Pick your web application and click on "Variations Create Hierarchies Job Definition" timer job
  • Click on "Run Now" to run this timer job.
    variation timer jobs sharepoint 2013
If required, you can change the schedule to run shorter time periodtoo.

SharePoint 2013 Variation Timer Jobs:
Here is the list of timer jobs involved in variations feature in SharePoint:
  1. Variations Create Hierarchies Job Definition: Creates all variation sites, lists and pages from the source variation site. It runs hourly.
  2. Variations Propagate List Items Job Definition: Creates and updates list items on target variation Default, every 15 minutes.
  3. Variations Propagate Page Job Definition: Creates and updates pages on target variation after approved. Runs every 15 minutes.
  4. Variations Propagate Sites and Lists Job Definition: Creates variation sites and lists when the "Create Everywhere" option is enabled.  Runs on every 30 minutes.
Here is the snapshot from SharePoint 2013 Central Administration Timer Job definitions page:
SharePoint 2013 Variation Timer Jobs

Variation Logs in SharePoint 2013:
During the variation process, there are several timer jobs run. All activities related to this process are logged  and collected under Variation logs to provide details in troubleshooting any variation related issue such as Hierarchy creation, Page propagation, etc. 

Variation logs are located under root site collection's settings page.
  • Site Settings >> Site Collection Administration >> Variation logs 
SharePoint 2013 variation feature logs
How to test variation feature:
Once you hit variation home, It goes to the variation site based on your browser language settings. E.g. When you hit http://portal.crescent.com, It goes to http://portal.crescent.com/english if your browser language is set to English.

How does variations feature works in SharePoint 2013?
So, How does it works? Well, When you create new pages or update existing pages on source variation site, Target variation(s) automatically updated in draft mode. They'll go live in target variations when published!

Syncing Custom list and Libraries in Variation:
By default custom lists are libraries are not synced from source to destination. It needs to be manually triggered. Here is how:
  • Go to any custom list or library in source variation site
  • Click on Variations Tab >> Click on Settings
    sharepoint 2013 create variation labels
  • Select Variation labels (sites) to sync and click "Continue". You'll get "Your new variations are on the way" message.
    configure variation sharepoint 2013
  • Once done, The particular list will be propagated on selected targets.

Technet Reference Variations overview in SharePoint Server 2013

Cannot navigate to the requested page while user profile synchronization is running. Please wait for the current synchronization run to finish.

$
0
0
Problem: When you try to start the Profile synchronization or try to create a new connection in User profile service application in SharePoint 2013, It gives this error message:

"Cannot navigate to the requested page while user profile synchronization is running. Please wait for the current synchronization run to finish."
Cannot navigate to the requested page while user profile synchronization is running. Please wait for the current synchronization run to finish.
Solution:
Generally, when a profile synchronizing is running, You may get this error message. If you find its running for long time, simply use the "Stop" link to stop the current synchronization job.

Here is how:
  • Open the SharePoint 2013 Central Administration >> Manage Service applications
  • Open User Profile Service application
  • Click the "Stop" link under "Profile Synchronization Settings" section. 
What if you don't find "Stop" link? Well, that's because you don't have any user profile synchronization job running! So, what is the fix? Stop and Start the "User Profile Synchronization Service" from Services on the server page!
start user profile synchronization service in sharepoint 2013
Use this post, if you face any trouble in starting user profile sync service: User Profile Synchronization Service Stuck at "Starting" - Solution

Create List from List Template in Sharepoint using PowerShell

$
0
0
Requirement: Create a SharePoint list from List template using PowerShell

PowerShell script to create a SharePoint list from list template:
Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue

Function Create-ListFromTemplate($WebURL, $ListName, $TemplateName)
{
#Get the Web from URL
$Web = Get-SPWeb $WebURL

#Get the Specific list template
$Template = $web.site.GetCustomListTemplates($Web) | where {$_.InternalName -match $TemplateName }

#Check if given template name exists!
if($Template -eq $null)
{
Write-host "Specified list template not found!" -f Red
exit
}

#Create List instance from given list template
$web.Lists.Add($ListName, $ListName, $Template)
Write-host "List instance Created from List template" -f DarkGreen
}

#Variables
$WebURL="http://intranet.crescent.com"
$ListName="Project-607"
$ListTemplateName="ProjectTemplate"

#Call the function to create list from template
Create-ListFromTemplate $WebURL $ListName $ListTemplateName

How to Create a Web Part Page in SharePoint 2013

$
0
0
To create a web part page in SharePoint 2013, Follow these steps:
  • Go to your SharePoint site, Navigate to "Site Pages" library - Click on "Site Contents" link from Left navigation >> Click on "Site Pages" library. 
  • Go to the "Files" tab, expand the New Document drop-down list and click on the "Web Part Page"how to add a new web part page in sharepoint 2013
  • Enter the Name for your new web part page, select the page Layout and Save Location, and then click on Create button. create new web part page sharepoint 2013
  • This creates a blank web part page in SharePoint 2013 as shown below. Now, We'll have to add some relevant web part to this web part page. Click on "Add a web Part" link shown in web part zoneshow to add a new web part page in sharepoint 2013
  • Select the relevant Web part to insert and click on "Add" button. I've added "Excel Web Access" web part. create a blank web part page in sharepoint 2013
  • Configure web part properties. In my case, I've specified the excel sheet to display in the Excel web access web part. how to create web part page sharepoint 2013
  • Click on "Stop Editing" button from ribbon to Save the page. That's all. We've added a new web part page in SharePoint 2013.
Choosing "Add a page" from Site settings menu, creates a Wiki Page!

Add a Link to SharePoint Top Navigation Menu or Quick Launch using PowerShell

$
0
0
Requirement: Add a new link to SharePoint Global Navigation (Top Link Bar) or Quick Launch using PowerShell.

Add link to SharePoint Top Navigation using PowerShell:
Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue

#Variables for processing
$WebURL="http://sharepoint.crescent.com/teams/marketing"
$NavigationTitle="Employee Profile"
$NavigationLink="https://peoplesoft.crescent.com/employee/profile.aspx"

#Get the Web
$Web= Get-SPWeb $WebURL

#Get Top Navigation
$TopNavigation = $Web.Navigation.TopNavigationBar
#For Quick Launch, Use: Navigation.QuickLaunch

#Create a New Top Navigation Node
$node = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode($NavigationTitle, $NavigationLink, $true)

#Add the Node
$TopNavigation.AddAsLast($node)

#Set the Target Property - Will work only when Publishing features is enabled
$node.Properties["Target"] = "_blank"

$node.Update
You can alter the script to add new link to all sites in a site collection.

Fix for "Could not find stored procedure 'Search_GetRepositoryTimePerCrawl'"

$
0
0
Problem:
When trying to navigate to a content source or crawl history in SharePoint 2013 search service application, received this error message "Could not find stored procedure 'Search_GetRepositoryTimePerCrawl'"
Could not find stored procedure 'Search_GetRepositoryTimePerCrawl'

Solution: Enable and run the timer job "Search Health Monitoring - Trace Events" once!
Here is the step by step solution:
  • Navigate to SharePoint 2013 Central Administration
  • Click on "Monitoring" >> Review Timer job definitions
  • Pick ""Search Health Monitoring - Trace Events" timer job by navigating to the next page in the list.
  • Click on "Enable" button if its not enabled already. Once enabled, Click on "Run Now" button for the same timer job.
  • Give it a minute to run. Once Ran, This issue should be gone away!

SharePoint Group vs Active Directory Group - Which is Best?

$
0
0
So you need to determine the best way to manage SharePoint users, Whether to use SharePoint groups or Active Directory groups to manage permissions in SharePoint? Well, Both SharePoint Group and AD Group have their own advantages and disadvantages. Let me list down some of them:
  • Manageability: Any SharePoint site owner/admin can manage users on SharePoint groups within SharePoint (Self-Service!). But AD group creation and adding/removing users can be done only by AD administrators, unless delegated. So, to create new users or removing accounts you may have to wait for AD Admins/Help-desk! However, AD Groups Serves better in Centralized management, performance, Minimum administration efforts
  • Scope: Since AD Groups are created globally, you can re-use them in any different SharePoint site collections (even in different systems like File Shares, Exchange, etc) . E.g. You may be having existing department wise AD groups created, say "Sales Team" and you can grant permission to any SharePoint site collection to the AD group. But SharePoint groups are scoped at site collection level and can't be re-used beyond that boundary. So, If you have an existing SharePoint group with 5000 users, you'll end-up recreating it in a different site collection (Although PowerShell can help!)
  • Users from Multiple Authentication Sources: AD Group consists of users from AD, but SharePoint groups can be the combination of users from AD as well as non-Active directory authentication sources like SQL Server, LDAP, Live, Google, Facebook, Yahoo, etc.
  • List All Usersof the Group - If you want to list users of the group, SharePoint groups can be listed with "Site Users" web part. But you can't do it with AD Groups - You can't look inside them from SharePoint (without custom solutions!) SharePoint considers AD group as a single user.
  • Nested Groups: AD Groups can be nested, But SharePoint groups can't be added under any other SharePoint group. (However, you can add a AD Group inside SharePoint group!)
  • Group Announcements: If you use SharePoint Group, There is no way to send alerts toall of them OOTB, But you can use E-mail enabled AD Group to subscribe to an Alert in SharePoint! 
  • Audience targeting - does not work with AD groups, only with SP security groups!
  • Orphaned Users - When you delete a user in AD, SharePoint groups can still hold them as orphan users!
  • securable objects with unique permissions - When you have a requirement for dynamically changing security needs, SharePoint groups provides better flexibility.

Delete Web application using PowerShell in SharePoint 2013

$
0
0
To delete SharePoint Web application using PowerShell use this cmdlets:

Delete Web Application and All its zones:
#Web Application URL to delete
$WebAppURL="http://sharepoint.company.com"

#sharepoint 2013 powershell delete web application
Remove-SPWebApplication -identity $WebAppURL -Confirm
This deletes the entire Web application and its all zones:

Remove Web Application Along with All its Databases and IIS Web Site:
To remove the Web application along with its content databases and the IIS Web site, use the switches: -DeleteIISSite and -RemoveContentDatabases
#Web Application URL to delete
$WebAppURL="http://sharepoint.company.com"

#Remove the web application and its databases & IIS Web Application
Remove-SPWebApplication -identity $WebAppURL -Confirm -DeleteIISSite -RemoveContentDatabases
delete sharepoint web application using powershell

Delete the Extended Web Application zone:
To Removes the Extended Web Application zone, say: Internet, use:
#Web Application URL to delete
$WebAppURL="http://sharepoint.company.com"

#sharepoint 2013 powershell delete web app
Get-SPWebApplication http://sitename | Remove-SPWebApplication -Zone "Internet" -Confirm
Make sure you logged in as a "Farm Administrator" with "Shell Access" rights to delete web applications using PowerShell

Reset Search Index in SharePoint 2013 using Powershell

$
0
0
Problem: SharePoint 2013 search crawling process got stuck and we got to reset the corrupted search index.

Solution: Follow these steps to reset search index in SharePoint 2013.
  • Go to SharePoint 2013 Central Administration >> Service Applications 
  • Pick your Search Service Application 
  • In Search Administration page, Click on "Index Reset" link under crawling section of the left navigation menu.
    Reset Search Index in SharePoint 2013
  • In the index reset page, click on "Reset Now" button to reset search index in SharePoint 2013.
After index reset, You must run full crawl to enable search results!

PowerShell script to reset index in SharePoint 2013:
At times, you may have to do it with PowerShell for reasons, such as:
  • When you try to reset search index from Web UI, you get timeouts error on large index
  • You may want to partially reset index for only certain content source
Reset search index in SharePoint 2013 with PowerShell:
Here is the PowerShell to reset search index partially (Reset search index for a specific content source):
Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue

#Get Search service application
$ssa = Get-SPEnterpriseSearchServiceApplication

#Content Source Name
$ContentSourceName = "Crescent Portal"

#Get the content source
$ContentSource = Get-SPEnterpriseSearchCrawlContentSource -Identity $ContentSourceName -SearchApplication $SSA

#Get Each Start Address
$StartAddresses = $ContentSource.StartAddresses | ForEach-Object { $_.OriginalString }

#Clear Indexed content starts with custom contnet source
$ContentSource.StartAddresses.Clear()

#Re-add the start address to content source
ForEach ($Address in $StartAddresses ){ $ContentSource.StartAddresses.Add($Address) }

Reset SharePoint 2013 Search Index:
To Reset SharePoint 2013 search index completely using PowerShell, use this cmdlet:
(Get-SPEnterpriseSearchServiceApplication).reset($true, $true)
Where, the $True parameter denotes: Disable Alerts & Ignore Timeout error.
If you still get Timeout errors, Clear SharePoint configuration cache and then try again!
Viewing all 1058 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>