Monday, May 23, 2011

How to Disable Alerts in SharePoint

Event wanted to disable All the alerts in SharePoint environment? While removing Outgoing Email settings in Central Admin is one option, There is an another-proper way, Here is how:

How To Disable Alerts in SharePoint 2007 / 2010 / 2013
Run this command:
stsadm -o setproperty -propertyname alerts-enabled -propertyvalue false -url http://<Web-APP-URL>

To Enable Alerts
stsadm -o setproperty -propertyname alerts-enabled -propertyvalue true -url http://<Web-APP-URL>

You may need to restart " Windows SharePoint Services timer" or execute stsadm -o execadmsvcjobs once.

Ok, How to Disable Alerts in SharePoint 2010/2013 using PowerShell?
To disable alerts at web application level, Here is the PowerShell script.
$webapp= Get-SPWebApplication "http://your-sharepoint-url"

# To disable alerts for SharePoint Web application
$webapp.AlertsEnabled = $false
$webapp.Update()

# To enable alerts in SharePoint Web application
$webapp.AlertsEnabled = $true
$webapp.Update()

Once alerts are disabled, "Alert Me" option in Ribbon will go hidden.
disable sharepoint alerts
See the "Alert Me" button, once alerts are enabled!
disable alert sharepoint
To disable alerts on SharePoint list, refer: Disable Alerts from a SharePoint List or Library

Technet reference: http://technet.microsoft.com/en-us/library/cc287751.aspx

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


Saturday, May 21, 2011

Using Log Parser with SharePoint

What is Log parser? Well, as per Microsoft's definition: Log parser is a powerful, versatile tool that provides universal query access to text-based data such as log files, XML files and CSV files, as well as key data sources on the Windows operating system such as the Event Log, the Registry, the file system, and Active Directory.

With Log parser, we can analyse the IIS Logs and get info like:
     • Number of unique users
     • Top IP hits
     • What referrers were sending people to my site
     • Which pages were most popular
     • How much data out
    • Which HTTP status codes are being generated , etc

say for example, I would like to retrieve the user information in CSV format for my SharePoint site, from Multiple WFEs, I can do by the following query:

LogParser -i:W3C "SELECT distinct TO_LOWERCASE(cs-username) As UserName INTO 3319_User_names.csv FROM <IIS LOG FOLDER>,<IS LOG FOLDER of another server> WHERE UserName Is Not Null" -o:CSV

IIS LOG FOLDER: Its a folder where IIS Logs are stored. you can retrieve the from Multiple servers too. e.g. //mywfe2/D$/Logs/IIS/MyWebApp/W3SVC1126740424/*

Query to Find When a SharePoint Site was accessed last time:
Logparser -i:iisw3c "SELECT Date, cs-username, cs-uri-stem, COUNT (*) FROM c:\WINDOWS\system32\LogFiles\W3SVC2133324272\*.log WHERE cs-username <> NULL AND cs-uri-stem LIKE '/sites/Sales/%' GROUP BY DATE,cs-username,cs-uri-stem" -q:Off -e:1 -o:datagrid 

Find a particular User's activity:
LOGPARSER -i:IISW3C "SELECT date, time, cs-uri-stem, c-ip, cs-username INTO c:\UserActivity.csv from C:\inetpub\logs\LogFiles\W3SVC222984324\*.log where date > '2015-01-31' AND cs-username like '%salaudeen%'" -o:CSV

Query to find Most Accessed Site URLs:
@path=C:\Program Files\Log Parser 2.2\

LogParser -i:W3C "SELECT TOP 50 cs-uri-stem as Url, COUNT(*) As Hits INTO MaxHits.csv FROM C:\WINDOWS\system32\LogFiles\W3SVC1\* GROUP BY cs-uri-stem ORDER By Hits DESC" -o:CSV


Query to get user count of SharePoint Intranet sites with their Hit counts:

@path=C:\Program Files (x86)\Log Parser 2.2\

LogParser -i:W3C "SELECT TO_LOWERCASE(cs-username) As UserName, count(*) as [Total Hits] INTO PortalUsersList.csv FROM C:\WINDOWS\system32\LogFiles\W3SVC2133324272\*, \\WFE02\c$\WINDOWS\system32\LogFiles\W3SVC2133324272\*, \\WFE03\c$\WINDOWS\system32\LogFiles\W3SVC2133324272\* WHERE date > '2010-12-31' AND cs-username Is Not Null group by TO_LOWERCASE(cs-username)" -o:CSV

Log Parser Query to get Users & Hits on a Sub-Site: /operations/partners/salesforce/
@path=C:\Program Files (x86)\Log Parser 2.2\

LogParser -i:W3C "SELECT cs-uri-stem, cs-username, count(*) as [Total Hits] INTO SubsiteHits.csv FROM \\WFE01\C$\inetpub\logs\LogFiles\W3SVC274624414\*, \\WFE02\C$\inetpub\logs\LogFiles\W3SVC274624414\* WHERE cs-uri-stem like '%%/operations/partners/salesforce%%' AND date > '2014-04-18' and cs-username <> 'Global\svcSPSearch' AND cs-username <> NULL group by cs-uri-stem, cs-username " -o:CSV

pause


Log parser is a command line tool, you can the Log Parser Lizard GUI tool: http://www.lizard-labs.net/

More info on using Log parser tool:
http://www.msexchange.org/tutorials/using-logparser-utility-analyze-exchangeiis-logs.html
http://blogs.technet.com/b/clinth/archive/2010/01/07/w3c-iis-log-analysis-using-log-parser.aspx
http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=85
http://mlichtenberg.wordpress.com/2011/02/03/log-parser-rocks-more-than-50-examples/

Log Parser 2.2 download URL: http://www.microsoft.com/downloads/en/details.aspx?familyid=890cd06b-abf8-4c25-91b2-f8d975cf8c07&displaylang=en

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


Wednesday, May 18, 2011

How to Disable Multiple File Upload in SharePoint

Had to disable Multiple File Upload in SharePoint to enforce the users to enter mandatory Meta-data. 

OK, How to Disable Multiple File Upload in SharePoint?how to disable multiple file upload in sharepoint
Well, If we want to disable Multiple file upload feature in all SharePoint sites, There are 2 options available for us:
  1. Disable client integration
  2. Edit the files are mentioned below. (Yes, Its not supported by Microsoft!)
  • Navigate to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES
  • Open the file: DefaultTemplates.ascx
  • Search for: <SharePoint:MenuItemTemplate and then delete the entire node, That is:
<SharePoint:MenuItemTemplate
    ID="MultipleUpload"
    Text="<%$Resources:wss,ToolBarMenuItemMuliUpload%>"
    Description="<%$Resources:wss,ToolBarMenuItemMuliUploadDescription%>"
    Sequence="200"
    ImageUrl="/_layouts/images/MenuUploadMultiple.gif"
    HiddenScript="!browseris.ie55up"
    UseShortId="true"
runat="server"/>

Now, We have to hide the link for multiple upload as in the below picture.
disable multiple file upload sharepoint
  • Navigate to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS and open the Upload.aspx (In SharePoint 2010, its: UploadEx.aspx)
  • Search for:
      <TD>
           <asp:HyperLink id="UploadMultipleLink" runat="server"  ACCESSKEY=U Text="<%$SPHtmlEncodedResources:wss,upload_document_upload_multiple%>" onclick="javascript:return !LaunchPictureLibraryApp();"/>
      </TD>

  • Now, we are going to Hide the link for Multiple upload. So add the highlighted text
<TD style="display:none">
                    <asp:HyperLink id="UploadMultipleLink" runat="server"  ACCESSKEY=U Text="<%$SPHtmlEncodedResources:wss,upload_document_upload_multiple%>" onclick="javascript:return !LaunchPictureLibraryApp();"/>

Don't forget to do the IIS Reset!   
how to disable multiple file upload in sharepoint

How about disabling for a Particular site? say: for a site "Sales"
Yes, You can do that as well with little Javascript. Edit the Upload.aspx, Place the below code just before </asp:content>

<SCRIPT Language="Javascript">

var CurrentURL = window.location.pathname;

if CurrentURL.indexOf('Sales/_layouts/Upload.aspx') >= 0)
{
          var MultipleUploadlink = document.getElementById('ctl00_PlaceHolderMain_ctl01_ctl02_UploadMultipleLink');
             if (MultipleUploadlink != null)
                                MultipleUploadlink.style.display = "none";
}
</script>


How to Disable Multiple File Upload in SharePoint in SharePoint 2010? 

For SharePoint 2010,  Set these elements to hidden either in your master page or wherever applicable!
#ctl00_PlaceHolderMain_UploadDocumentSection_ctl03_UploadMultipleLink
\.Documents\.New\.AddDocument\.Menu\.Upload\.UploadMultiple-Menu32
{
display: none
}

Want to disable ONLY to a particular document Library?
Just place a content editor web part and place this code buddy!

Updated: Edit the content editor webpart by clicking inside.
how to disable multiple file upload in sharepoint 2010

Under the tool bar, click on "Edit HTML Source" and then Place the below code in HTML Source window.
disable multiple file upload sharepoint 2010

<style type="text/css">
#Ribbon\.Documents\.New\.AddDocument\.Menu\.Upload\.UploadMultiple-Menu32
{
    DISPLAY: none;
}
</style>

Cool!

If you want to hide the Upload Button altogether:
<style type="text/css"> 
#Ribbon\.Documents\.New\.AddDocument-Large
{     
 display:none !important; 
} 
</style>

Using Toolbar Manager (http://features.codeplex.com/) from Codeplex is an another option!

Tail: If your Multiple upload option is disabled and you want to find a solution, try my post: Why "upload multiple documents" is Disabled? How to Resolve it?
If you want to hide SharePoint 2010 Ribbon's Tab/Group/Button/Menu with features, Refer: How to Hide SharePoint 2010 Ribbon Tab - Group - Button - Menu


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


How to Disable SharePoint Designer in SharePoint 2010, MOSS 2007

How to Disable/Block SharePoint Designer in SharePoint 2010:
SharePoint 2010 provides nice/easy feature to Disable the SharePoint Designer at web application level. Here is how:

Get into: Central Administration >> Application Management >> Manage Web Applications >>  Select the target web app >> Select "SharePoint Designer" from General settings drop down in Ribbon >> Uncheck the "Enable SharePoint Designer" check box. That's all!

You can access the same from: Central administration >> Configure Designer settings >> Configure SharePoint Designer Settings  also!
Disable SharePoint Designer in SharePoint 2010
This will stop using SharePoint Designer for every one including Site collection Administrator.

Disable SharePoint designer 2010 at Site Collection Level:
Don't want to disable SharePoint designer at web application level and for at site collection level? Sure.  Go to Site Actions >> Site settings at the site collection >> click on "SharePoint Designer Settings" under Site collection Administration.
disable sharepoint designer 2010 at site collection
 From here, you can enable/disable SharePoint designer at site collection level.
disable sharepoint designer 2010

Disable SharePoint designer at site collection level with PowerShell:
$SPSite.AllowDesigner =  <$True | $False>
Disabling SharePoint Designer at Site collection level will not control Site collection Administrators!

Once disabled, users receive the following message: "This web site has been configured to disallow editing with SharePoint Designer contact your web site administrator for more information."
This web site has been configured to disallow editing with SharePoint Designer contact your web site administrator for more information

 

How to Disable SharePoint Designer in MOSS 2007?

How to disable SharePoint designer in moss 2007? unfortunately out of the box, MOSS 2007 doesn't provide any such feature, So Lets look at the available options for us.

1. Use Codeplex utility:
 Block SPD -  allows us to give access people in the Specific AD Group.
 http://blockspdhttpmodule.codeplex.com/

2. Disable SharePoint designer by editing Onet.xml file as per the KB: http://support.microsoft.com/kb/940958

MSDN Link analyses the possible solutions: http://blogs.msdn.com/b/sharepointdesigner/archive/2008/11/25/locking-down-sharepoint-designer.aspx


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


ViewFormPagesLockDown - Restrict Application-Form Pages in SharePoint

ViewFormPagesLockDown is a SharePoint Feature (not in WSS) that helps us in:
  1. Allows anonymous users to only view the Publishing pages, not any of the form or view pages (DispForm.aspx, AllItems.aspx)
  2. Disallows anonymous access to pages in the _layouts directory that inherit from LayoutsPageBase.
By default all publishing sites have the feature called ‘ViewFormPagesLockdown’ activated, but not on the Collaboration Portal site or Team sites's definition. Without this Feature active on anonymous public sites, any users - including search engines like Google will be able to view (and crawl) SharePoint out-of-box pages which are tied to lists and webs that allow viewing by anonymous users.

Yes, These users might not have the ability to do anything, but you may not want anonymous users to view the form pages.

If you want to place your custom application pages inside the _layouts directory, which anonymous users must hit, there's the UnsecuredLayoutsPageBase class you can use as the base class of your page, and there's always just the Page class as in a standard ASP.Net application page.

To Activate the Feature :
stsadm -o activatefeature -url -filename ViewFormPagesLockDown\feature.xml

If you still get the Form pages visible for the end users, Try: With the ViewFormPagesLockDown feature Enabled, disable Anonymous Access in the site, then re-enable it.
MSDN Link: http://technet.microsoft.com/en-us/library/cc263468(office.12).aspx

Lock down Application Pages in SharePoint 2013:
SharePoint 2013 brought this feature in interface via site feature "Limited-access user permission lockdown mode feature".

Go to Site collection features, activate/deactivate "Limited-access user permission lockdown mode" feature to restrict/allow anonymous users to access application pages.
 Limited-access user permission lockdown mode



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


Dedicated WFE for Search Crawling

How to set your SharePoint index server to use a dedicated WFE server for crawling?

In our Farm, we are running with 3 WFEs. What I wanted to do is: Let the Search crawler hit and crawl the content from ONLY one WFE rather hitting and degrading the performance of all of the WFEs.

So, I went into "Central Administration > Operations > Services on Server > Office SharePoint Server Search" to get into the Search Service Settings. I chose "Use a dedicated web front end computer for crawling" option and chose a WFE from the list.

How simple it is...isn't it?

In case, If SharePoint does places the WRONG IP of the WFE in the HOST file of Index server, Revert the Search server setting to "Use all web front end computers for crawling" and get into the Index server, Manually place the desired WFE's IP which you wants to act as the dedicated crawl source.

Index server's HOST file can be found under: c:\WINDOWS\system32\drivers\etc
add a appropriate entry like:
199.63.0.1       Teamsites

MSDN Link: http://technet.microsoft.com/en-us/library/cc261810%28office.12%29.aspx

Update: For SharePoint 2010:
Unfortunately, There is no UI or Direct way to achieve this. Still PowerShell comes to rescue!
You can set the SiteDataServers Property to achieve the similar functionality.

More Info:
http://blogs.msdn.com/b/vijgang/archive/2010/04/26/how-to-configure-a-dedicated-web-front-end-for-crawling-in-sharepoint-2010.aspx
http://blogs.msdn.com/b/mimorr/archive/2010/08/05/set-the-crawl-component-to-use-a-dedicated-front-end-for-indexing.aspx

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


How to use PowerShell with MOSS 2007

Powershell has become more widely used platform to administer and automate common administrative tasks. Can we use PowerShell with SharePoint 2007? Because I was told PowerShell cmdlets (like Get-SPWeb, Get-SPSite, etc) are designed for SharePoint 2010.  Can we use PowerShell for SharePoint 2007?

Of course, You can! As PowerShell allows us to use .NET assemblies, we can use SharePoint objects, properties and their methods as we use object model in C# or any other .Net language. You can use PowerShell to manage SharePoint 2007, but not the cmdlets for SharePoint 2010, as SharePoint 2010 powershell snap-in or cmdlets are incompatible with SharePoint 2007. Getting started powershell in SharePoint 2007:
  1. Install PowerShell on SharePoint Servers
  2. Set Executing Policy
  3. Load necessary SharePoint Assemblies
  4. Write PowerShell Code using SharePoint Object Model
1. Install PowerShell on moss 2007 Servers
To run PowerShell on MOSS 2007, we must Install it first. If you are running SharePoint 2007 on Windows 2003, You have to download and install PowerShell. In Windows 2008, its natively supported. Just download and install PowerShell 2.0 from Windows 2003/2008 server from Microsoft site http://support.microsoft.com/kb/968930.You can refer my post : Install PowerShell in Windows 2003 for more step by step procedure.

2. Set Executing Policy to RemoteSigned (just one time) 
After installing PowerShell, the next step would be setting ExecutionPolicy. By default the policy is set to "restricted". Check it by running (Get-ExecutionPolicy)

Set-ExecutionPolicy RemoteSigned
It allows  all scripts running from servers locally are allowed.

3. Load SharePoint 2007 Assemblies:
To use PowerShell in SharePoint 2007, Fire the PowerShell console from Start > All Programs > Accessories > Windows PowerShell, simply load the SharePoint assemblies with the following command before you start scripting:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

we can't use Get-SpWeb or Get-SpSite cmd-lets, but we can create the objects from the SharePoint Assembly. Here is how:

4. Write PowerShell Code using SharePoint Object Model 
Lets write our PowerShell script in SharePoint 2007 to enumerate sites and list all sub-site titles,  URLs.
#SharePoint 2007  powershell examples

#Load SharePoint Assemblies
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") >null
 
 #Get Site Collection
 $Site=new-Object Microsoft.SharePoint.SPSite("http://sharepoint.company.com")
 
 #list all site collections
 foreach($SiteColl in $Site.WebApplication.Sites)
    {
    #Loop through all Sub Sites
       foreach($Web in $SiteColl.AllWebs)
       {
     #Output Site title and URL
  Write-Host $web.Title: $Web.Url
    }
   }

You can access the members of the $Site object by typing: $Site | Get-Member
use powershell sharepoint 2007
Its also possible to create your own functions/cmdlets, which does the similar thing as SharePoint 2010 Cmdlets. Powershell cmdlets for SharePoint 2007:

Get-SPWebApplication Cmdlet for SharePoint 2007:
#Get All Web Applications
Function global:Get-SPWebApplication($WebAppURL)
{  
 if($WebAppURL -eq $null)  #Get All Web Applications
    {
  #Sharepoint 2007 powershell spfarm
  $Farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
  $websvcs = $farm.Services | where -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]}
  $WebApps = @()
  foreach ($websvc in $websvcs) {
      foreach ($WebApp in $websvc.WebApplications) {
          $WebApps+ = $WebApp
      }
  }
  return $WebApps
 }
 else #Get Web Application for given URL
 {
  return [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup($WebAppURL)
 }
}

Get-SPSite Cmdlet for SharePoint 2007:
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") 

#Using Get-SPSite in MOSS 2007
function global:Get-SPSite($url)
 {
    return new-Object Microsoft.SharePoint.SPSite($url)
 }

#Get the Site Collection
$SiteColletion = Get-SPSite($SiteCollURL)

Get-SPWeb cmdlet for SharePoint 2007
Function global:Get-SPWeb($url)
{
  $site= New-Object Microsoft.SharePoint.SPSite($url)
        if($site -ne $null)
            {
               $web=$site.OpenWeb();
      
            }
    return $web
}
These powershell functions for SharePoint 2007 does the same thing as in SharePoint 2010. You can reuse them when writing powershell scripts for moss 2007.


SharePoint 2007 PowerShell Permissions:
Be sure you are running PowerShell on the SharePoint server as an administrator and your account has sysadmin permission in the SQL Database. Otherwise you may get: Access is denied. (Exception from HRESULT: 0×80070005 (E_ACCESSDENIED))


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


Event ID 6398 and 5586 in SharePoint - Resolution

In a SharePoint Implementation, after provisioning Search Service application, Event log gets filled by these two events every minute: 6398 and 5586.

Event ID: 5586.   
Unknown SQL Exception 2812 occurred. Additional error information from SQL Server is included below.
Could not find stored procedure ‘dbo.Search_GetRecentStats’.
solution for Event ID 5586 in Sharepoint

Event ID: 6398
The Execute method of job definition Microsoft.Office.Server.Search.Monitoring.HealthStatUpdateJobDefinition (ID 9cb6be54-0384-4c6e-abfc-c2f25621a3ed) threw an exception. More information is included below.
Could not find stored procedure ‘dbo.Search_GetRecentStats’.
Could not find stored procedure ‘dbo.Search_GetRecentStats’

This is because you have the Usage and Health Data Collection Service Application installed. Intern this service application creates a database for logging and Search Service will try to make entries in that database and it couldn’t :-)

The solution is:  Enable health data collection. go to "Central Administration >> Monitoring >> Configure usage and health data collection" and check "Enable health data collection" check box.
SharePoint 2010 Event ID 6398 and 5586 Resolution
Don't forget to Restart IIS and SharePoint Timer job!

If its enabled already and still these IDs are logged into event viewer, then disable that first. Restart IIS and SharePoint Timer service. Enable them and then Restart IIS and SharePoint Timer service again.

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


Saturday, May 14, 2011

Create - Edit - Find - Delete SharePoint Alerts using PowerShell

Welcome to another PowerShell walk-through. In this article I'm exploring Management of SharePoint Alerts using PowerShell!

Enable or disable alerts for Web application
## To enable alerts for Web application

$SPwebapp=Get-SPWebApplication "http://SharePointSite.com"
$SPwebapp.AlertsEnabled = $true
$SPwebapp.Update()

# To Disable alerts for a Web application
$SPwebapp.AlertsEnabled = $false
$SPwebapp.Update()


Create Alert in SharePoint using PowerShell
##### Create an New alert for an user #########

$SPsite = Get-SPSite "http://SharePointSite.com"
$SPweb=$SPsite.Rootweb
$SPlist=$SPweb.lists["Shared documents"]
$SPuser = $SPweb.EnsureUser('Domain\Salaudeen')
$SPnewAlert = $SPuser.Alerts.Add()
$SPnewAlert.Title = "My Custom Alert"
$SPnewAlert.AlertType=[Microsoft.SharePoint.SPAlertType]::List
$SPnewAlert.List = $SPlist
$SPnewAlert.DeliveryChannels = [Microsoft.SharePoint.SPAlertDeliveryChannels]::Email
$SPnewAlert.EventType = [Microsoft.SharePoint.SPEventType]::Add
$SPnewAlert.AlertFrequency = [Microsoft.SharePoint.SPAlertFrequency]::Immediate
$SPnewAlert.Update()
$SPweb.Dispose()
$SPSite.Dispose()

Get all Alerts for an user in SharePoint with PowerShell:
##### Display All alerts for a Particular List ########

$SPWeb = Get-SPWeb "http://SharePointSite.com" 
#Relative URL of list/document library. For lists "Lists/Tasks"
$SPListURL = "Shared Documents"  
foreach($alert in $SPWeb.Alerts)
{
    if($alert.ListUrl -eq $SPListUrl)
    {           
            "User Name    - " + $alert.User.Name
            "Title        - " + $alert.Title
            "Frequency    - " + $alert.AlertFrequency
            "Delivery Via - " + $alert.DeliveryChannels
            "Change Type  - " + $alert.eventtype
            Write-Host "=================================="
    }
}
$SPweb.Dispose()


Create Alerts for All users in a Group:
##### Set alerts for all users in the SharePoint Group ######

$SPweb = Get-SPWeb "http://SharePointSite.com"
$SPgroup = $SPweb.Groups["SharePoint Owners"]
$SPlist = $SPweb.Lists["Shared Documents"]
foreach ($SPuser in $SPgroup.Users){
     $alert = $SPuser.Alerts.Add()
     $alert.Title = "My Alert"
     $alert.AlertType = [Microsoft.SharePoint.SPAlertType]::List
     $alert.List = $SPlist
     $alert.DeliveryChannels = [Microsoft.SharePoint.SPAlertDeliveryChannels]::Email
     $alert.EventType = [Microsoft.SharePoint.SPEventType]::Add
     $alert.AlertFrequency = [Microsoft.SharePoint.SPAlertFrequency]::Immediate
     $alert.Update()
}
$SPweb.Dispose()

Update SharePoint Alerts using PowerShell
#####  Making Changes in Existing Alerts ########
$SPsite = Get-SPSite "http://SharePointSite.com"
$SPweb=$SPsite.RootWeb
$SPuser=$SPweb.EnsureUser('Domain\Salaudeen')
$SPalertCollection=$SPuser.Alerts
foreach($alert in $SPalertCollection)
{
  $alert.AlertFrequency = [Microsoft.SharePoint.SPAlertFrequency]::Daily
  $alert.Update()
}
    
Get Alerts for a Particular User

##### Get alerts for a particular user #########
$SPsite = Get-SPSite "http://SharePointSite.com"
$SPweb=$SPsite.RootWeb
$SPuser=$SPweb.EnsureUser('Domain\Salaudeen')
$SPalertCollection=$SPuser.Alerts
foreach($alert in $SPalertCollection)
{
 write-host -f Green $alert.Title
}

Find All Alerts of an User in Entire Site collection
##### Get the Alerts of Entire Site collection #####
$SPsiteCollection = Get-SPSite "http://SharePointSite.com"

# Iterate through all Webs in the Site Collection
foreach($SPweb in $SPsiteCollection.AllWebs) 
 {
   foreach($alert in $SPweb.Alerts)
    {
        Write-Host "Alerts List :" $alert.ListUrl
    Write-Host "Alerts Title :" $alert.title
    write-host "Subscribed User: " $alert.user
     }
 }

Delete All SharePoint alerts from a List using powershell 
##### Delete All alerts for a specific List #####

    $SPweb = Get-SPWeb "http://SharePointSite.com"
    $SPlist = $SPweb.lists["Shared Documents"]
    $IDS = ""
    foreach($alert in $spweb.alerts)
    {
        if($alert.ListID -eq $SPlist.ID)
        {
        $IDS += $alert.ID.tostring() + "|"
        }
        write-host -nonewline "*"
    }
    write-host "deleting..."
    foreach($s in $IDS.Split("|"))
    {
    write-host -nonewline "*"
    $spweb.alerts.delete([GUID]$s)
    }

Delete user alerts in SharePoint 2010 with PowerShell
##### Remove all alerts for specific user from a Web Application #####

$SPwebApp = Get-SPWebApplication "http://SharePointSite.com"
$SpecificUser = "Domain\Salaudeen"

    foreach ($SPsite in $SPwebApp.Sites)
    {
       # get the collection of webs
       foreach($SPweb in $SPsite.AllWebs) 
        {
           $alerts = $SPweb.Alerts

            # if 1 or more alerts for a particular user, Make a note of them by copying their ID to an Array
            if ($alerts.Count -gt 0)
            {
                $myalerts = @()
                foreach ($alert in $alerts)
                  {
                    if ($alert.User -like $SpecificUser)
                     {
                        $myalerts += $alert
                     }
                  }

               ### now we have alerts for this site, we can delete them
                foreach ($alertdel in $myalerts)
                {
                    $alerts.Delete($alertdel.ID)
            write-host $alertdel.ID
                }
            }
        }
    }


Finally, some minimized code:

To delete all alerts:
$SPweb.Alerts| foreach-object {$web.Alerts.Delete($_.Id)}

Filter the alerts for a single list:
#For for e.g. http://SharePoint.com/site/Assets"
$SPweb.Alerts| where-object {$_.ListUrl -like "Assets"} 

Find all the Alerts for a specific user across the web:
# ? is the alias for where-object cmdlet
$web.Alerts | ? {$_.UserId -like "Domain\Salaudeen"}

Get all the alerts for a user across the entire site collection:
$site.AllWebs | select -expand Alerts | ? {$_.UserId -like "Domain\Salaudeen"



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


Wednesday, May 11, 2011

'Feature {Guid} for list template 'template id' is not installed in this farm. The operation could not be completed'

We received the below Error in Site Manager page in SOME of the sites. Here is the RCA and resolution:
'Feature {Guid} for list template 'template id' is not installed in this farm. The operation could not be completed'
Root cause: We have installed some third party products, which internally created its Templates(List template, Document Library template, etc) ,we removed those third party products and the objects created with their template are broken now!

When we open the site manager it tries to get the custom list template, its icon, etc. and if its broken sitemanager.aspx throws the error.

Say for e.g. we have installed the Bamboo solutions video product, created some video libraries, and then uninstalled the product. Now ALL the video libraries are broken because: we’ve uninstalled the product, its wiped out along with its templates J.

Resolution:
So the solution Is: Either to delete the objects(We have to use either stsadm: stsadm -o forcedeletelist -url http://youdomain/yourListNameThatHasAPloblem/  or SPD to delete the broken objects.) created with custom template or use the utility: http://splistinstancefix.codeplex.com , again this tool has some limitation, we can’t simply re-associate the All the broken lists with other template.

I’ve tested the both the scenario’s. After deleting a broken object, sitemanager.aspx ran with out any error.

'Feature {Guid} for list template 'template id' is not installed in this farm.



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


Thursday, May 5, 2011

List Aggregation/Rollup in SharePoint - Third Party Products

There are many third party products are available to achieve List Aggregation or Roll-up in SharePoint. Here is the comparison table in my View: 

FeatureBamboo solutions SharePoint Boost
URL:https://store.bamboosolutions.com/http://www.boostsolutions.com/listcollection.html
Export to Excel/PDFNoNo
Across Sites and Site CollectionsYesNo. ONLY with in Site collection!
Cross Site collection/Sub-sitesYesYes
Filtering/SortingYesYes
SharePoint 2010 version YesYes
License$995 per WFE + $248 for Support per Year$ 799 per WFE + $400 Support - Per Year


 
FeatureLightening ToolsKwizcom
URL:http://lightningtools.com/pages/lightning-conductor-web-part.aspxhttp://www.kwizcom.com/sharepoint-add-ons/sharepoint-list-aggregator/overview/
Export to Excel/PDFNoYes
Across Sites and Site CollectionsYesYes
Cross Site collection/Sub-sitesYesYes
Filtering/SortingYesYes
SharePoint 2010 version YesYes
License$799 Per WFE$1320 ONE Time per WFE


and their screenshots:
List Aggregation Tools for SharePoint
Bamboo Content Rollup webpart
Tool to Merge Multiple Lists in SharePoint
 

List Rollup in SharePoint - Third Party Products
* Pricing information is gather at the time of publishing this article. It may differ by time!

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


Wednesday, May 4, 2011

Redirect Users to Thank You page from NewForm.aspx after form submission

Here is my requirement: I've a SharePoint request tracking system. When users create a new entry, what I want is to redirect them to "Thank you! We have received your request. We will get back to you on this soon!", typical acknowledgement page :-)

So, to redirect page after form submission in SharePoint, create a custom NewForm.aspx, hide the default "Ok" and "Cancel" buttons, and then insert the below code:

Redirect NewForm EditForm Submit button:
<input type="button" value="Submit" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={/sites/marketing/SitePages/thankyou.aspx}')}" />

Change SharePoint Cancel button Redirect:
<input name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent('__redirect={/sites/marketing/SitePages/Home.aspx}')}" type="button" value="Cancel">

Alternate approach: Using Source URL Parameter in SharePoint List Forms
If you want to send users to some other page (Doesn't matter whether the user press "Ok" or "Cancel"), SharePoint allows us to control OK and Cancel button behavior with the "source" parameter. Here is an example:  
http://sharepoint.crescent.com/sites/Operations/Lists/Tasks/NewForm.aspx?Source=/sites/operations/SitePages/Home.aspx

There is one issue when using Source parameter is: you will get Thank you page even when you click on "Cancel" button. Lets mitigate that by adding a jQuery: It binds a function with "Cancel" button's click event. (Edit the NewForm.aspx page and add a CEWP, just below NewForm Fields. Place this script in a text file, upload and point it from a CEWP)
sharepoint redirect page after form submission
SharePoint redirect cancel button
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>

<script type="text/javascript">
 $(document).ready(function()
  {
      $('input[value=Cancel]').click(function() { window.location.replace("http://sharepoint.crescent.com/sites/operations/SitePages/Home.aspx");});
  });
</script>

Related Post: SharePoint Survey Redirect to Thank You Page on Finish

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


SharePoint 2010 Service Accounts - Necessary Permissions and Naming Convention Best Practices

There are lot of naming conventions/patterns in naming service accounts for SharePoint. Here is mine:

Service Accounts Naming Pattern - Best Practice:
svc + environment (Such as Dev, Test, Prod) +  SP + account name (keep the service account names to less than 20 characters)

SharePoint 2010 Service Accounts List and required Permissions:

Account nameRoleLocal Server rights needed
svcPrdSPSetupSetup Account - Used to install SharePoint binaries. Local administrator on all SharePoint boxes (with Remote Login Enabled).  Needs Logon as a service right (GPO) rights. SQL: Explicit dbcreator and securityadmin SQL roles
svcPrdSPFarmFarm account. Used for Windows Timer Service, Central Admin and User Profile serveSharePoint Managed Account. Local Administrator on all SharePoint boxes. Needs Logon as a batch job rights (GPO), Log on as a service. DB Access will granted by SharePoint Config Wizard.
svcPrdSPAdminPoolApp pool account for Central Administration application PoolSharePoint Managed Account. Needs Logon as a batch job rights
svcPrdSPPortalPoolApp pool account for web app "Portal"SharePoint Managed Account. Needs Logon as a batch job rights
svcPrdSPPartnerPoolApp pool account for web app "Partner"SharePoint Managed Account. Needs Logon as a batch job rights
svcPrdSPMySitePoolApp pool account for my site web applicationSharePoint Managed Account. Needs Logon as a batch job rights
svcPrdSPServAppPoolService application's Application pool accountSharePoint Managed Account. Needs Logon as a batch job rights
svcPrdSPSearchAccount used to run search serviceSharePoint Managed Account.  Needs Log on as a service rights
svcPrdSPSearchCrawlAccount used to run search servicemust have read access to external or secure content sources that you want to crawl by using this account. Full Read on each web application. This account must not be a member of the farm administrators group. Must not be SharePoint Managed Account
svcPrdSPADCrawlAccount used by the User Profile services to access Active DirectoryMust have Replicating Change permissions to AD. Must be given in BOTH ADUC and ADSIEDIT. If domain is Windows 2003 or early, must also be a member of the "Pre-Windows 2000" built-in group. Must not SharePoint Managed Account
svcPrdSPSQLThe SQL Server service account is used to run SQL ServerLocal administrator in SQL Server. Member of SQL Admin Server Role.  Must not SharePoint Managed Account
Following services will be using the account
1. MSSQLSERVER
2. SQLSERVERAGENT
svcPrdSPSecStoreSharePoint User Account for Secure Store Service Application (If we incorporate LOB applications)Local Admin on WFE Servers


More Info:
http://technet.microsoft.com/en-us/library/cc678863.aspx
http://www.sharepointpromag.com/article/sharepoint/Least-Privilege-Service-Accounts-for-SharePoint-2010
http://www.ericharlan.com/sharepoint-service-accounts/
http://absolute-sharepoint.com/2013/01/sharepoint-2013-service-accounts-best-practices-explained.html


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...