search

Tuesday, 17 March 2015

How to Disable "Open with Explorer" View in SharePoint 2013

Requirement: Got a requirement to Hide "Open with Explorer" button from a particular library's ribbon menu due to some security reasons.

Solution: Open with Explorer button can be disabled in multiple approaches.
  1. Disable "Client Integration" from Web Application's Authentication Providers.
  2. Remove permissions "Use Remote Interfaces" which also removes "Use Client Integration Features" from permission levels.
  3. Edit the "CustomDefalutTemplates.ascx" file located at: C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES. Find and Replace PermissionString from "UseClientIntegration" to PermissionString="MangeWeb" of nodes with ID "OpenInExplorer"
  4. CSS/JavaScript-jQuery methods to Turn-Off explorer view.
  5. Create a custom action with EMPTY CommandUIDefinition, so that it overrides existing ribbon button.
Lets stick with the last one!

Add Custom Action to Hide Open with Explorer:
While any ribbon button, group, tab can be hidden by overriding the specific custom action using Visual Studio based solution as in How to Hide SharePoint 2010 Ribbon Button, Group, Menu, Tab, Here I'm using PowerShell to add/remove custom action to hide Open with Explorer view in SharePoint 2013.
disable open with explorer in sharepoint 2013
Add custom action to disable Open with Explorer button in SharePoint 2013:
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
 
#Variables
$ListName = "2015 Documents"
 
#Get Web and List objects
$web = Get-SPWeb $SiteURL
$list = $web.Lists[$ListName]
 
#Add an empty Custom Action to Override default custom action
$CustomAction = $list.UserCustomActions.Add()
 
$CustomAction.Title = "Hide Explorer View"
$CustomAction.Location = "CommandUI.Ribbon"
$CustomAction.commandUIExtension = "
            <CommandUIExtension>
               <CommandUIDefinitions>
                     <CommandUIDefinition
                             Location='Ribbon.Library.Actions.OpenWithExplorer' />
                     </CommandUIDefinitions>
              </CommandUIExtension>"
 
$CustomAction.Update();
 
write-host "Custom Action has been Added successfully!"
and our Output!hide open with explorer button in SharePoint 2013
Delete the custom action from list:
Lets remove the custom action we've created to hide Open with Explorer button.
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
 
#Variables
$ListName = "2015 Documents"
$CustomActionTitle = "Hide Explorer View"
 
#Get Web and List objects
$web = Get-SPWeb $SiteURL
$list = $web.Lists[$ListName]
 
#Get the custom action
$CustomAction = $list.UserCustomActions | where {$_.title -eq $CustomActionTitle}
 
#Delete the custom action from list
if ($CustomAction)
{
    $CustomAction.Delete()
}

You can also remove a custom action from SharePoint list via SharePoint designer, as in below screen:
remove custom action from sharepoint designer 2013

You might also like:
SharePoint Usage Reports 
Usage reports, collaboration and audit for SharePoint.
Five Challenges in SharePoint Security 
...And How to Solve Them. Free White Paper
*Sponsored 

 71  70 
 Google +12  12  3421

SharePoint Analytics

Saturday, March 7, 2015

"Upgrade Required" Status in SharePoint 2013 Central Administration Servers in Farm

Getting "Upgrade Required" error message in SharePoint 2013? Well, Ideally, We have to run the SharePoint Products Configuration Wizard on the server(s) right after installing the service pack/patches.

In Windows Server 2012, SharePoint updates are part of Windows Server Update. It installs patches but never runs Products configuration wizard automatically! You still have to run psconfig wizard to complete patching!
sharepoint 2013 upgrade required error
SharePoint Patching is a two-step process:
  1. Install the patch binaries
  2. Run psconfig wizard manually.
Launch and run SharePoint configuration wizard to perform the configuration tasks. Once its finished, You should see  "No action Required" message in farm information status instead of upgrade required.
sharepoint 2010 central administration upgrade required
If you get any errors while running psconfig, the next step is to force SharePoint upgrade with this command line:
psconfig.exe -cmd upgrade -inplace b2b -force -cmd applicationcontent -install -cmd installfeatures

If you are using SQL aliases, make sure its configured in Every SharePoint server!

To apply patches on SharePoint 2013, Follow my step by step guide at: SharePoint 2013 Patching Guide - Step by Step

You might also like:
SharePoint Usage Reports 
Usage reports, collaboration and audit for SharePoint.
Five Challenges in SharePoint Security 
...And How to Solve Them. Free White Paper
*Sponsored 

 71  70 
 Google +12  12  3421

SharePoint Analytics

Wednesday, February 18, 2015

How to Hide Share, Follow and Sync Buttons in Sharepoint 2013

We got a requirement to remove Share, Follow and Sync buttons in SharePoint 2013. Let me summarize various ways to disable these buttons.
sharepoint 2013 disable share, follow, sync buttons
How to disable "Share" button in SharePoint 2013?
Share button is relying on "Access requests" configuration of the site. To disable "Share button" in SharePoint 2013, simply disable access requests.
  • Go to Site settings page of your SharePoint site.
  • Click on "Site Permissions" link under "Users and Permissions" group
  • Click on "Access Request Settings" in the ribbon.
  • Uncheck "Allow access request" and click on "Ok" to save your changes. This should hide Share button in SharePoint 2013.sharepoint 2013 disable share button
Remember, You will have to do this change for each site! However, Share button will still be visible for Site owners and administrators!

How to Disable Sync buttons in SharePoint 2013 
To disable sync, Navigate to  Site settings >> Click on "Search and offline availability" >> set offline client availability to "No". There are few more ways discussed in my another article: Hide Sync Button in SharePoint 2013

How to disable "Follow" button in SharePoint 2013? 
To disable "Follow" button in SharePoint 2013, You'll have to disable a feature called "Following Content". Navigate to:
  • Site Settings >> Click on "Manage Site Features"
  • Click on "Deactivate" on " Following Content" feature
This removes following button in SharePoint 2013. If you want to disable "Following" feature at Farm level, disable "ContentFollowingStapling" feature at Farm features page in SharePoint 2013 Central Administration.

Disable Access Request, Deactivate Features using PowerShell:

  • Sync: To exclude from offline client, run:
    ?
    1
    Get-SPSite -limit all | get-SPWeb -limit all | Foreach { $_.ExcludeFromOfflineClient=1; $_.Update()}

Remove Share, Follow, Sync buttons at Master page level:

These promoted action buttons are in master page as follows:
Share Button:
?
1
<SharePoint:SPSharePromotedActionButton ID="SPSharePromotedActionButton1" runat="server" />
Follow Button:
?
1
<SharePoint:DelegateControl ID="DelegateControl2" runat="server" ControlId="PromotedActions" AllowMultipleControls="true" />
Sync Button:
?
1
<SharePoint:SPSyncPromotedActionButton ID="SPSyncPromotedActionButton1" runat="server" />
To hide these controls, simply move them inside Comment block. <!--  -->. Do not delete this controls from the Master page! You'll end-up in crash!!

CSS to hide Share, Follow and Sync Buttons:

Lets hide them based on their IDs. You can place this CSS code with "Script Editor" web part or you can place it in Master page.
  • Sync button's id: ctl00_SyncPromotedAction
  • Follow button id: site_follow_button
  • Share button's id:  ctl00_site_share_button
?
1
2
3
4
5
6
7
8
<style type="text/css">
 
a[id$=site_share_button], a[id$=SyncPromotedAction], a#site_follow_button
{
    display: none !important;
}
 
</style>
Tips: This hides Share button from promoted actions section. But share button is present in ECB/Callout menu and in list view quick control also. To hide them all as well, use selectors:  a[id$="site_share_button"], a.ms-calloutLink[title="Share"], button.js-listview-qcbShareButton.

You might also like:
SharePoint Usage Reports 
Usage reports, collaboration and audit for SharePoint.
Five Challenges in SharePoint Security 
...And How to Solve Them. Free White Paper
*Sponsored 

 71  70 
 Google +12  12  3421

SharePoint Analytics

Sunday, February 1, 2015

Application Pool Monitoring for SharePoint using PowerShell Script

If SharePoint Application Pools are stopped that would cause "Service Unavailable" outages to your SharePoint environment! While SCOM can monitor SharePoint IIS web application's application pool status, it makes bit more noisy with alerts and doesn't start the application pool automatically - when stopped. So, lets address this issue with the help of PowerShell! Here is my nifty PowerShell script to monitor application pools on all SharePoint web front end servers.

This script not only scans IIS Application Pool status on SharePoint Web-Front end servers, But also:
  • Logs application Pool status if its not in Started state
  • Automatically starts AppPool if its in stopped state
  • Sends out an Alert-Email to SharePoint Admin team (or whoever configured!)
PowerShell script to Monitor IIS Application Pool statues:
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Import-Module WebAdministration
 
#Array to hold Server names - Change it to YOUR SharePoint front end servers
$WFEServers =("HS-WFE01", "HS-WFE02", "HS-WFE03")
 
#Log file location
$LogFile = "D:\Scripts\AppPool-Log.txt"
 
#Loop through each server and Check Application Pool status
foreach ($Server in $WFEServers)
{
    $ServerMgr = [Microsoft.Web.Administration.ServerManager]::OpenRemote($Server)
 
    #Get all Application Pools which are not in Started State
    $AppPoolColl = $ServerMgr.ApplicationPools | Where-Object {$_.State -ne "Started"}
 
    foreach($AppPool in $AppPoolColl)
    {
        #Get the time to Log
        $now = Get-Date –f "yyyy-MM-dd HH:mm:ss"
 
        #Log to file
        "`n Found Application Pool: $($AppPool.name) in stopped state at the server : $($Server) on $($now)" >> $LogFile
        "Trying to Start the application Pool...">> $LogFile
         
        #Try Starting the application Pool
        $AppPool.Start()
        Start-Sleep -s 10
        "Application Pool's current Status: $($AppPool.State)" >> $LogFile
 
        #Send Alert-Mail message
        $emailFrom = "AppPoolMonitor@crescent.com"
        # Use commas for multiple addresses
        $emailTo = "SPAdmins@crescent.com"
        $subject = "Application Pool: $($AppPool.Name) in stopped state in Server: $($Server) at $($now)"
        $body = "Hi SharePoint Team, `n `n The Application Pool $($AppPool.name) was in stopped state in server: $($server). `n`n We tried Re-starting it... Current State of the Application Pool: $($AppPool.State). `n`n Please take necessary actions if its not started !. `n `nThanks, `nSharePoint AppPool Monitoring Script."
        $smtpServer = "smtp.crescent.com" #IP or HOST Name of SMTP Server
        $smtp = new-object Net.Mail.SmtpClient($smtpServer)
        $smtp.Send($emailFrom, $emailTo, $subject, $body)
    }
}
Here is the sample alert from IIS AppPool monitoring script:

Schedule this PowerShell script in Windows Task scheduler in any Application server (or any other server will do!) to periodically scan App Pool status, Say once per 5 Min! run interval can be adjusted based on your application priority.

Here is my another post on Scheduling PowerShell scripts using Windows Task scheduler: Create a Scheduled Task for PowerShell Script with Windows Task Scheduler

You might also like:
SharePoint Usage Reports 
Usage reports, collaboration and audit for SharePoint.
Five Challenges in SharePoint Security 
...And How to Solve Them. Free White Paper
*Sponsored 

 71  70 
 Google +12  12  3421

SharePoint Analytics

Sunday, January 25, 2015

Delete Button Missing in SharePoint Column? Here is How to Delete them.

How to delete a Column when Delete Button is missing:
Unable to delete list column in SharePoint since there is no delete button in field properties? In some cases, columns added through "Add existing columns" doesn't provide the option to delete! To make them deletable, just revert these two properties: AllowDeletion & Sealed
sharepoint column no delete button - sharepoint list sealed and non-deletable columns
Here is how to delete SharePoint list column programmatically with PowerShell: 
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#Get the Web
 
#Get the List
$list = $web.Lists["Design Documents"]
 
#Get the column
$column = $list.Fields["Category"]
 
#Disable Delete
$column.AllowDeletion = $true
$column.Sealed = $false
$column.Update()
 
#To delete a SharePoint list column in PowerShell, use: $column.Delete()
 
$web.Dispose() 
sharepoint column delete button missing
We can also make fields to Sealed, So that nobody can change the field settings.

SharePoint Manager tool  can be used to set these properties. Just navigate to the site, list or library and set the "AllowDeletion" property to false, save the changes. This hides delete option in SharePoint list.sharepoint list column enable disable delete option


Read more: http://www.sharepointdiary.com/#ixzz3UckFOs3M

No comments:

Post a Comment