Friday 23 May 2014

Add Alternative Languages using PowerShell / Add Supported Languages using Powershell



Below is the script to Add Alternative Language to all SiteCollections in a WebApplication.

We have set English as Supported/ Alternative language if the site was created in other Language.

Site Locale code of en-us is 1033

cls

$webapp=Get-SPWebApplication   "http://sedwdevrtm:22222"

$sitecollection= $webapp.Sites.url


foreach($sites in $sitecollection)
{

$web =Get-SPWeb -Identity $sites

$webCul=$web.UICulture

try
{
    if($webCul.LCID -eq "1033")
    {

       Write-Host " English is Set as default Language so no need to change"
       
    }
    elseif ($webCul.LCID -ne "1033" -and $web.IsMultilingual -eq $false)
    {
        $web.IsMultilingual=$true
        $web.AddSupportedUICulture(1033)
        $web.Update()
        Write-Host $web "Alternative Language added Succesfully "
   
    }
   

    elseif($web.IsMultilingual -eq $true -and  !($web.SupportedUICultures.Contains(1033)) )
    
       {
          $web.AddSupportedUICulture(1033);
          $web.Update();
          Write-Host $web "Alternative Language added Succesfully "
        }
     
    
     $web.Dispose()
 }
catch
{
     $ErrorMessage = $_.Exception.Message

     Write-Host $web.Title "Not executed" $ErrorMessage

}

}


Monday 19 May 2014

Access requests and invitations Link Missing in SharePoint 2013


"Access Requests and Invitations" May not be visible of because of 3 Reasons.



  1. "Access Requests and Invitations" link under 'Users and Permissions' will not appear until someone actually sends the requests to join the site
http://devsite.com/sites/SP2013/Access%20Requests/pendingreq.asx

try to append /Access%20Requests/pendingreq.asx to your site and check if you are getting page not found error.

If so then send Access request to the site, then it will fix the issue.

All the Access requests and invitations are stored in a hidden list called "Access Requests" and 
has three views 
  1. Guest user invitations (Access Requests/pendinginv.aspx)
  2. History (Access Requests/oldreq.aspx)
  3. Pending Requests (Access Requests/pendingreq.aspx

  2 .  Allow Access Requests is not enabled





  Site Actions -> Site Settings->Site Permissions ->Access Request Settings

Enable - Allow Access Requests and type mail id to receive the access requests and click on Ok .






  3.   Outgoing email Settings are not configured in Central Administration



Tuesday 13 May 2014

UnLock the site collection using powershell or Readonly Sitecollection using PowerShell


Site Locks in SharePoint using PowerShell 


Set-SPSite -Identity "<SiteCollection>" -LockState "<State>"

  • <SiteCollection> is the URL of the site collection that you want to lock or unlock.
  • <State> is one of the following values:
    • Unlock to unlock the site collection and make it available to users.
    • NoAdditions to prevent users from adding new content to the site collection. Updates and deletions are still allowed.
    • ReadOnly to prevent users from adding, updating, or deleting content.
    • NoAccess to prevent users from accessing the site collection and its content. Users who attempt to access the site receive an error message.

  1. In Central Administration, on the Application Management page, in the Site Collections section, click Configure quotas and locks.
  2. If the site collection you want is not already selected, in the Site Collection section, on the Site Collection menu, click Change Site Collection. Use the Select Site Collection page to select a site collection.
  1. On the Site Collection Quotas and Locks page, in the Site Lock Information section, select one of the following options:
    • Not locked to unlock the site collection and make it available to users.
    • Adding content prevented to prevent users from adding new content to the site collection. Updates and deletions are still allowed.
    • Read-only (blocks additions, updates, and deletions) to prevent users from adding, updating, or deleting content. Choose whether you want this to be farm administrator controlled or site collection administrator controlled.
    • No access to prevent users from accessing the site collection and its content. Users who attempt to access the site receive an error message.
  2. If you select Adding content preventedRead-only (blocks additions, updates, and deletions), or No access, type a reason for the lock in the Additional lock information box.
  3. Click OK.


Monday 5 May 2014

Powershell Script to Display List of all Workflows or Export all the workflows names to CSV

  List all Workflows in a SiteCollection     

 We had business requirement to display a list of all workflows in a Site collection.There are different approaches to view list of workflows in a sitecollection for a list or document library.

Go to the document library or list under Library Settings/List Settings user can view   with
  •  Sharepoint UI ,
  • Powershell


If you have a collection with few document librarys or lists you can manually navigate to each document library or list and check for workflows in SharePoint UI 

Library Settings/List Settings -> Workflow Settings ->




You can see in the above there are no workflows associated with the list.


Using PowerShell, to  Export all the workflow in a site collection to  CSV



PowerShell script to find out list of all workflows in a site collection is the best way to find.

SharePoint has  a class  called "WorkflowAssociation : "  

contains members that return custom information about that 

workflow's a 's association with the specific list or content 

type.



Cls

Add-PSSnapin "Microsoft.Sharepoint.Powershell"

$site= Get-SPSite -Identity  "http://test.devsites/sites/wfs"


function DisplayWorkflows()
{
   foreach($subwebs in $site.AllWebs )
   {

     $ls= $subwebs.Lists;

    foreach($lists in $ls )
    {

    $workflows= $lists.WorkflowAssociations;

    foreach($wf in $workflows)
    {

    if($wf.Name -notlike "*Previous Version*")
        {

        $output = @{"[URL]"=$web.Url;"[ListName]"=$lists.Title;"[Workflow Title]"=$wf.Name }

        New-Object PSObject -Property $output | Sort-Object;

         }
     }

    }
    }
  }

    DisplayWorkflows | Export-Csv  C:\ListofWorkflows.csv