Monday, September 28, 2015

Export and Import Subsite in SharePoint 2013 using PowerShell

Export-Import subsite using PowerShell in SharePoint 2010
how to export SharePoint subsite? export subsite SharePoint 2013 PowerShell, Unlike SharePoint 2013, you'll have to create a subsite first and then import. Export-SPWeb cmdlet used to export a sub site, list or document library.

Open SharePoint 2013 Management Shell and run this command. Change Site URL and Path values accordingly.
Export-SPWeb "http://sharepoint.company.com/sites/Sales/US/" ` 
         -Path "C:\sales-us.cmp" -IncludeVersions All -includeusersecurity

To export a site, list or document library by using Central Administration:
You can also export a Subsite from SharePoint 2010/2013/2016 Central Administration via "Export a site or list"  capability. Go to SharePoint Central Administration >> Backup and Restore >> Click on "Export a site or list" link under "Granular Backup" group.
Export subsite sharepoint 2013 powershell
Important: Both the source and destination sites should be using same template!

Import subsite in SharePoint 2013 using PowerShell
Import-SPWeb PowerShell cmdlet used to import a sub site from backup.
Import-SPWeb "http://sharepoint.company.com/sites/Sales/US/" ` 
        -Path "C:\sales-us.cmp"  -includeusersecurity -UpdateVersions overwrite 
With these cmdlets, we can Export and Import a particular sub site, list or document library. You can also use Export-SPWeb & Import-SPWeb cmdlets to copy list with data between SharePoint Sites/Web Apps/or between different environments. E.g. Copy a SharePoint list from Dev to Staging server.

Please note, export-import is not as same as backup-restore. Certain artifacts will not be copied during export-import. Such as:
  • Workflow association-data
  • Audit logs
  • Recycle bin items
  • Created By, Modified By details, etc.


You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Sunday, September 27, 2015

Get SharePoint Timer Job History using PowerShell

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

Solution: SharePoint 2013 Central Administration site provides an interface to get 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 get timer job history powershell
  • Click on "Job History" link from left navigation
    sharepoint 2013 timer job history powershell
  • 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 timer job history powershell
  • 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 2013 get timer job history powershell
  • Now, you'll find the jobs history for selected timer job as below.
    sharepoint 2013 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

SharePoint PowerShell get timer job history: 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

SharePoint timer job history using PowerShell: 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.

Tags: sharepoint 2013 get timer job history powershell, sharepoint timer job history powershell, sharepoint 2013 timer job history powershell, sharepoint powershell get timer job history

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Saturday, September 26, 2015

Open with Explorer: Network Error - Windows cannot access URL@SSL\DavWWWRoot\SiteURL

Problem: 
Open with Explorer button in SharePoint 2010 site gave this error message on a particular document library.
Network Error - Windows cannot access URL@SSL\DavWWWRoot\SiteURL\Library  You do not have permission to access \\web-app-url@com@SSL\DavWWWRoot\Library-URL. Contact your network administrator to request access.
Network Error - Windows cannot access URL@SSL\DavWWWRoot\SiteURL\Library
You do not have permission to access \\web-app-url@com@SSL\DavWWWRoot\Library-URL. Contact your network administrator to request access.

Observation: 
  • Issue is happening only with a particular library. Explorer view works fine with all other document libraries in the same environment. Issue is not specific to a particular client machine or user.
  • Open with explorer from the Root level of the library and got the above error. Tried going into each sub-folders and clicking on "Open with Explorer" worked fine, Except for one folder where SharePoint prompted for credentials three times and gave "Your client does not support opening this list with Windows Explorer." - So that's the culprit.
Solution:
Tried running Windows update, Various hot fixes from Microsoft KB's.. But finally, renamed the problematic folder by manually typing the same name and it worked!

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Friday, September 25, 2015

Open SharePoint List Items in Edit Mode by Default

Requirement: Open SharePoint Task list items in Edit form directly instead of "Display form".

Solution:
  1. Go to your SharePoint task list, Click on Site settings gear, Choose "Edit page" 
  2. Add a script editor and place this code:

    jQuery to launch list items in Edit mode:
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function() 
    {
      //Change display form links to edit form links
      $('.ms-vb a[href*="listform.aspx"]').each(function(){
          var url = $(this).attr('href');
          url = url.replace("PageType=4", "PageType=6");
          $(this).attr('href', url);
      });
    });
    </script>
  3. Save and close!
Now, on clicking any task item link, you'll be taken into Edit form directly.






You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


SPD Error: Microsoft SharePoint designer does not support editing non-SharePoint sites

Error:
"Microsoft SharePoint designer does not support editing non-SharePoint sites" - while trying to open a SharePoint 2016 site with SharePoint designer 2013, got this error message.
Microsoft SharePoint designer does not support editing non-SharePoint sites

Solutions:
  1. Simply close all instances of your SharePoint Designer and then reopen it.
  2. Check if client integration is enabled https://support.microsoft.com/en-us/kb/981223
  3. Clear SharePoint designer cache. Here is How to Clear SharePoint Designer Cache
  4. Try re-installing SharePoint designer!


You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Wednesday, September 23, 2015

SharePoint Online: Get List Items using CSOM PowerShell Script

SharePoint online: PowerShell to get all list items
#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
  
#Variables for Processing
$SiteUrl = "https://crescent.sharepoint.com/"
$ListName="Projects"

$UserName="admin@crescent.com"
$Password ="Password goes here"
 
#Setup Credentials to connect
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,(ConvertTo-SecureString $Password -AsPlainText -Force))
 
#Set up the context
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl) 
$Context.Credentials = $credentials
  
#Get the List
$List = $Context.web.Lists.GetByTitle($ListName)
$ListItems = $List.GetItems([Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery()) 
$Context.Load($ListItems)
$Context.ExecuteQuery()       

write-host "Total Number of List Items found:"$ListItems.Count

#Loop through each item
$ListItems | ForEach-Object {
    #Get the Title field value
    write-host $_["Title"]
}  

Get a single List Item using PowerShell:
If you want to get a single item, use:
#Get the List Item
$List = $Context.web.Lists.GetByTitle($ListName)
$ListItem = $List.GetItemById(15)
$Context.Load($ListItem)
$Context.ExecuteQuery()

#Get the Title field value
write-host $ListItem["Title"]

PowerShell to Filter and Get List Items with CAML:
How about filter and get List Items using CAML Query:
#Filter and Get the List Items using CAML
$List = $Context.web.Lists.GetByTitle($ListName)
$Query = New-Object Microsoft.SharePoint.Client.CamlQuery;
$Query.ViewXml = "<View><Query><Where><Eq><FieldRef Name='Priority' /><Value Type='Choice'>(3) High</Value></Eq></Where></Query></View>"
$ListItems = $list.GetItems($Query);
$Context.Load($ListItems)
$Context.ExecuteQuery()

#Loop through each item
$ListItems | ForEach-Object {
    #Get the Title field value
    write-host $_["Title"]
}  


You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Friday, September 18, 2015

Access Denied Error After Migrating from SharePoint 2010 to SharePoint 2013

Problem: After migrating from SharePoint 2010 to SharePoint 2013 using database attach method, all users received "access denied" error and they were unable to login. Made sure, both the source and destination SharePoint farms are in same Active Directory domain.

Root cause:
This is because, by default SharePoint 2013 web applications are created with Claims authentication. So existing classic mode accounts (domain\UserName) are not recognized by claims mode (i:0#.w|domain\username) web application.
Tips: You can verify if your SharePoint 2013 is using claims mode by using: 
(Get-SPWebApplication "<Web App URL").UseClaimsAuthentication

Solution: 
After some trial and error, found granting permission again to the users resolves the problem. However, its impossible to provide access to all users to wherever they have had permissions again manually, isn't it?

Well, the right solution is: Convert the authentication method from classic-mode to claims-based authentication of the new SharePoint 2013 Web Application!  Converting from Classic mode to Claims based authentication is done in two steps:
  1. Set the authentication method of the web application to claims:
    $WebApp = Get-SPWebApplication -identity http://Your-webapp-url
    $WebApp.UseClaimsAuthentication = $true
    $WebApp.Update()
    Alternatively, You can convert web application authentication:
    Convert-SPWebApplication -Identity $WebApp -To Claims –RetainPermissions -Verbose 
  2. Migrate users from classic mode to claims:
    $WebApp = Get-SPWebApplication -identity http://Your-webapp-url
    $WebApp.MigrateUsers($true)
    $WebApp.ProvisionGlobally()
    
This converts all user accounts to claims format. Do an IISReset, and all should be OK now!

How about the web application policies and Object Cache Accounts?
Don't forget to re-add users granted permission via web application user policies. Here is how to Configuring Web Application User Policy in SharePoint 2013 / 2016. Often, This applies to SPSuperUser and SPSuperReader accounts! Follow this article to grant permission to SharePoint 2013 cache accounts: Configure SharePoint 2013 Object Cache Super User, Super Reader Accounts.

Your new master page could be a culprit in some cases. Try changing to default master page once. In an another case, I ended up adding "NT AUTHORITY\authenticated users" with read access at web application policy. This technet article describes in detail on converting classic mode authentication to claims: https://technet.microsoft.com/en-us/library/gg251985.aspx

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Tuesday, September 15, 2015

How to Create a Service Application Pool in SharePoint using PowerShell

Service Application pools runs service application proxy web services inside IIS. Typically all of the service applications can be run with the same application pool. You can create a new service application pool while creating new service applications in SharePoint 2013.
create new service application pool sharepoint 2013
Ever wanted to create an new service application pool in SharePoint using PowerShell? Well, Here is my PowerShell script to create new AppPool.

Prerequisites: We need a managed account (or login credentials of a service account) to create a service App Pool.

PowerShell Script to Create New Service Application Pool in SharePoint 2013:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Configuration Parameters
$AppPoolAccount = "Crescent\SP16-SearchAppPool"
$AppPoolName = "Search Service Application App Pool"

#Check if Managed account is registered already
Write-Host -ForegroundColor Yellow "Checking if Application Pool Accounts already exists"
$AppPoolAccount = Get-SPManagedAccount -Identity $AppPoolAccount -ErrorAction SilentlyContinue
#Create a managed account, if it doesn't exist
if($AppPoolAccount -eq $null)
{
    Write-Host "Please Enter the password for the Service Account..."
    $AppPoolCredentials = Get-Credential $AppPoolAccount
    #Create new managed account
    $AppPoolAccount = New-SPManagedAccount -Credential $AppPoolCredentials
}
 
#Check if the application pool exists already
Write-Host -ForegroundColor Yellow "Checking if the Application Pool already exists"
$AppPool = Get-SPServiceApplicationPool -Identity $AppPoolName -ErrorAction SilentlyContinue
if ($AppPool -eq $null)
{
    #Create new App Pool
    Write-Host -ForegroundColor Green "Creating Application Pool"
    $AppPool = New-SPServiceApplicationPool -Name $AppPoolName -Account $AppPoolAccount
}


You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Monday, September 14, 2015

Server Error in '/x' Application - Excel Web App Error Solution

Problem:
All of a sudden Office Web Apps Excel Web App stopped working and gave this Runtime error message on opening Microsoft Excel files from SharePoint 2013:
Server Error in '/x' Application.
SharePoint Office Web Apps Server Error in '/x' Application

Solution: 
This occurs due to the public key which connects to the WOPI application such as Office Web Apps Server to the SharePoint farm goes out of sync! To resolve the issue, Run from any SharePoint Server:  
Update-SPWOPIProofKey

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Sunday, September 13, 2015

Access Denied Error on Insert Picture/Link/Upload File in SharePoint 2010

Problem: Users getting "Access Denied" error message while trying insert a picture via SharePoint 2010 Rich text editor. Verified that the user has "Full Access" permissions on the specific list, Still gets access denied on accessing layout pages such as: /_layouts/RteUploadDialog.aspx, /_layouts/RteDialog.aspx.
sharepoint 2010 access denied on inserting picture
Found it happens to other ribbon actions as well: Insert Link or Upload file.
access denied on insert Link or Upload File in SharePoint 2010 Rich text editor

Solution: Found that the particular list is with broken permissions! Although not a perfect solution, Granting "Read" access at site level fixed this problem!

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Wednesday, September 9, 2015

SharePoint Online: Import CSV File into SharePoint List using PowerShell-CSOM

Scenario: My requirement is to import data from CSV file to SharePoint online list from a local drive, every day!
import CSV data into SharePoint Online List - PowerShell Script

PowerShell Script to import SharePoint List Items from CSV File:
#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
 
##Variables for Processing
$SiteUrl = "https://crescent.sharepoint.com/sites/POC/"
$ListName="Contacts"
$ImportFile ="c:\Scripts\EmpData.csv"
$UserName="Salaudeen@crescent.com"
$Password ="Password goes here"

#Setup Credentials to connect
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,(ConvertTo-SecureString $Password -AsPlainText -Force))

#Set up the context
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl) 
$Context.Credentials = $credentials
 
#Get the List
$List = $Context.web.Lists.GetByTitle($ListName)

#Get the Data from CSV and Add to SharePoint List
$data = Import-Csv $ImportFile
Foreach ($row in $data) {
    
    #add item to List
    $ListItemInfo = New-Object Microsoft.SharePoint.Client.ListItemCreationInformation
    $Item = $List.AddItem($ListItemInfo)
    $Item["FirstName"] = $row.FirstName
    $Item["LastName"] = $row.LastName
    $Item["Department"] = $row.Department
    $Item["Mobile"] = $row.Mobile
    $Item.Update()
    $Context.ExecuteQuery() 
   
}
Write-host "CSV data Imported to SharePoint List Successfully!"


You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Top 50 Use Cases of SharePoint in the Industry

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


You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Monday, September 7, 2015

How to Add a Link to SharePoint 2013 Suite Bar

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>


You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Saturday, September 5, 2015

Cannot show the value of the filter. The field may not be filterable, or the number of items returned exceeds the list view threshold enforced by the administrator

Problem:
When trying to filter a list with large items, got this error message: "Cannot show the value of the filter. The field may not be filterable, or the number of items returned exceeds the list view threshold enforced by the administrator"
Cannot show the value of the filter. The field may not be filterable, or the number of items returned exceeds the list view threshold enforced by the administrator
Root cause:
Identified that the particular list has more than 25,000 rows in it. Filter fails as it exceeds the default threshold value configured.

Solution:
As the error message says: Your SharePoint Administrator got to update the Resource throttling threshold values from SharePoint 2010/2013 Central Administration site.Here are the steps to increase 'List View Threshold' value:
  • Open SharePoint 2010 Central Administration site
  • Go to Application Management' >> Manage Web Applications
  • Choose the web application in which you want to make the changes
  • Now from the ribbon, Click on 'General Settings >> Resource Throttling
  • In the resource throttling page, increase the "List View Threshold" value from 5000 to large number (say: 15000)
    How to Increase List view threshold value in sharepoint 2010
Please note, You may face performance issues if you increase the throttling threshold values! To avoid consider:
  • You can set predefined filters via "Modify list view" page and mitigate this issue. 
  • You can archive old list items either to a new list or a folder inside the same list.
Another Case: If its a People picker column, Set it to "People Only" instead of "People and Groups"

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Friday, September 4, 2015

Disable Redirect from User Information Page (userdisp.aspx) to MySite Profile Page (Person.aspx)

If you want to quickly check SharePoint user profile properties, You can get it from user information list or by simply clicking on user name hyperlinks from metadata fields such as: Created by. Usually, user profile page points to:
  • http://sharepointsite.com/_layouts/userdisp.aspx?ID=123
When clicked on user name hyperlink, will get redirected to My Site profile page (E.g. http://mysite/person.aspx?accountname) if the user has a my site profile created.

If the user has My site profile created, then the UserDisp.aspx page redirects to his/her My site profile page automatically.

Is there any way to get the basic version of userdisp.aspx, instead of redirecting them to the MySite profile of that person when someone clicks on such links? Well, Here is a nifty trick to stop redirecting to user's Mysite profile page and get the simple User Information.
  • Add:Force=True parameter to the above URL. So, it will be:
    http://portal.ad2012.loc/_layouts/userdisp.aspx?Force=True&ID=20
What if You want to avoid profile redirect permanently?
Behind the scenes, there is a OOTB user control called "MySiteRedirection.ascx" User control tied to a delegate control "DelctlProfileRedirection" on userdisp.aspx page that does this re-direction. You can either replace this delegate control or you can simply disable the feature: "MySite" To avoid profile redirect.

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Thursday, September 3, 2015

Fix "The site is not valid. The 'Pages' document library is missing" Error

Problem: After trying to deactivate and activate the publishing feature in a site, users started receiving this error: "The site is not valid. The 'Pages' document library is missing". It also happened after importing a subsite backup! Additionally, when tried creating a Publishing Pages they got this error:

The site is not valid. The 'Pages' document library is missing.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.SharePoint.Publishing.InvalidPublishingWebException: The site is not valid. The 'Pages' document library is missing.

Fix "The site is not valid. The 'Pages' document library is missing" Error
Root Cause: SharePoint Publishing feature stores the ID of the "Pages" library in the "__PagesListId" property  of SPWeb property bag. If this property doesn't match with the current "Pages" library, then we get this error! Made sure publishing feature is active and tried de-activate and activate the publishing feature once again. Didn't help.

Solution:
To fix this error, We'll have to set the "__PagesListId" property on the affected web's property bag!

PowerShell Script to Update the Pages List ID:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$WebURL="http://SharePoint-Site-URL"

$Web = Get-SPWeb $WebURL
$PagesListID = $web.Lists["Pages"].ID
$Web.AllProperties["__PagesListId"] = $PagesListID.ToString()
$Web.Update()

This PowerShell script to updates the property and corrects the problem.

Update Property Bag Settings using SharePoint designer:
You can also use SharePoint Designer to fix this problem. Here is how:
  • Get your "Pages" library's ID first! Here is How to get SharePoint list GUID
  • Open the SharePoint site which has this issue in SharePoint Designer
  • Select the site object in the tree view and Click on "Site Options" button from the ribbon
  • Check if the property "__PagesListId" exists, If so, update its value to current Pages library ID.
  • If the Property doesn't exists, Click on Add button to add the property. Enter "__PagesListId" as property name and value as the "Pages" Library GUID
  • Save your changes.
That's all!

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Get and Export User Profile Properties using PowerShell in SharePoint 2013

Its a common requirement in SharePoint to prepare reports from user profile properties. Here is my PowerShell scripts to get user profile properties in SharePoint.
Important: Make sure User Profile Service Application is created , up and running before running these scripts! and run as Farm Administrator!!

Get user profile Properties in SharePoint 2013 using PowerShell
#Configuration Variables
$SiteURL = "http://mysite.crescent.com"
$UserLogin="Crescent\Salaudeen"

#Get Objects
$ServiceContext  = Get-SPServiceContext -site $SiteURL
$UserProfileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext)

#Get the User Profile
$UserProfile = $UserProfileManager.GetUserProfile($UserLogin) 

#Retrieve User Profile Properties
Write-host $UserProfile["PreferredName"]
Write-host $UserProfile["WorkEmail"]

You are not limited to these fields, But there are plenty of more fields in User Profiles. To get all available user profile properties, use:
$UserProfile.Properties | Select DisplayName, Name

PowerShell to Query & Export user profile properties of all users in SharePoint:
Lets use PowerShell to get and export user profile properties of all users.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Configuration Variables
$SiteURL = "http://portal.crescent.com"
$outputReport = "c:\user_profiles.csv"

#Get Objects
$ServiceContext  = Get-SPServiceContext -site $SiteURL
$UPM = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext)

#Get All User Profiles
$UserProfiles = $UPM.GetEnumerator()
Write-host "Total Number of User Profiles found:"$UserProfiles.Count

#Array to hold Profiles
$ProfileDataCollection = @() 

#Iterate through each profile
foreach ($Profile in $UserProfiles)
{
    $ProfileData = New-Object PSObject 
    #Retrieve User profile Properties  
    $ProfileData | Add-Member -MemberType NoteProperty -name "Account" -value $Profile["AccountName"]
    $ProfileData | Add-Member -MemberType NoteProperty -name "Display Name" -value $Profile["PreferredName"]
    $ProfileData | Add-Member -MemberType NoteProperty -name "E-Mail" -value $Profile["WorkEmail"]
    $ProfileData | Add-Member -MemberType NoteProperty -name "Manager" -value $Profile["Manager"]
    $ProfileData | Add-Member -MemberType NoteProperty -name "Department" -value $Profile["Department"]
   
    #Add to Array
    $ProfileDataCollection+=$ProfileData
    write-host "Processed Profile:"$profile["PreferredName"]
}
#Export User Profile data to CSV
$ProfileDataCollection | Export-Csv $outputReport –NoType

This script exports given user profile properties of all users as CSV file:
get user profile powershell sharepoint 2013



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


You might also like:

Related Posts Plugin for WordPress, Blogger...