Saturday, August 8, 2015

Create AD Security Group/Distribution List from All SharePoint Users of the Farm

Have you ever had to send out an E-mail to all SharePoint users of your SharePoint Farm? Ever wanted to create a global AD security group which comprises of all SharePoint users? Well, I'm sure, You will at some point of time. E.g. during scheduled maintenance, Grant access to a global site, etc. Your SharePoint farm may have multiple web applications with lot of users accessing it. We can't keep a AD group or distribution list in sync up to date with all SharePoint users, isn't it? But we can create a AD security group or distribution list on-demand which includes all users from the entire SharePoint farm. By this way, it will be more accurate and update.

The idea is: Loop through each web application-site-collection-site in SharePoint farm to retrieve and add members to a security group or distribution list in AD.

PowerShell script to Add All SharePoint Users to an AD Security Group:
Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue
Import-Module ActiveDirectory

#Variables
$ADGroup="SP13 Authors" #Existing AD Security Group
$ReportPath="D:\SP13_Users.csv"

#Get all Webs from Entire FARM
$WebsCollection = Get-SPWebApplication | Get-SPSite -Limit All | Get-SPWeb -Limit All

#Array to hold user data
$UserDataCollection = @() 

foreach($Web in $WebsCollection)
{
    #Get all users from web programmatically 
    $UsersColl = $Web.AllUsers  
 
    #Get all users E-mails
    foreach ($User in $UsersColl) 
    {
        if( ($User.IsDomainGroup -eq $false) -and ($user.Email.ToString() -ne ""))
            {
                $UserData = New-Object PSObject               
                $UserData | Add-Member -type NoteProperty -name "EmailID" -value $user.Email.ToString() 
                $UserDataCollection += $UserData
            }
    }
}
    #Remove duplicates
    $UserDataCollection = $UserDataCollection | sort-object -Property  {$_.EmailID } -Unique

    Write-host "Total Number of Unique Users found:"$UserDataCollection.Length
 
    #Export to CSV
    $UserDataCollection | Export-Csv -LiteralPath $ReportPath  -NoTypeInformation

 #Add each user to AD Group
 $UserDataCollection | ForEach-Object {
 #Get the user from Email id
 $UserEmail = $_.EmailID 
 $ADuser = Get-ADUser -filter { EmailAddress -eq $UserEmail }
 
 #Ignore Orphans
 if($ADuser -ne $null)
 {
                #Add User to AD Aroup 
  Add-ADGroupMember -Identity $ADGroup -Members $ADuser
 }
} 
Run this script once. It will fetch and add all SharePoint users to the given AD group. To make it distribution list, Head on to AD, Find and locate the AD Group, Go to its properties, Assign an Email and change the Group type to "Distribution" if you need DL instead of Security group.


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


Saturday, August 1, 2015

SharePoint Online: Add Site Collection Administrator using PowerShell

SharePoint site collection administrators have Full access rights to manage all sites under a site collection. When creating a site collection, Global Administrator or SharePoint Online Administrator will automatically become the primary site collection admin. A SharePoint online site collection can have several administrators, but only one primary administrator, unlike SharePoint on-premises.

Its possible to add multiple site collection admins for any SharePoint site collection. To add additional site collection administrator in SharePoint online, you must be either Global Administrator or SharePoint online Site Collection Administrator of the particular site collection.

SharePoint online add site collection administrator
  • Navigate to your SharePoint Online administration center (E.g. https://crescent-admin.sharepoint.com/_layouts/15/online/SiteCollections.aspx )
  • Select the site collection, Click on "Owners" button from the ribbon and then click on "Manage Administrators" menu item.
  • This brings "Manage Administrators" page where you can add multiple site collection administrators. Also provides the option to change primary site collection administrator.
  • Now you can add new admins into the Site Collection Administrators box.
  • Once you have added the new user press OK to save the changes and any new Site Collection Administrator will have full rights to every site and sub-site within that Site Collection
Alternatively, Once the site collection is created, You can also navigate to Site Settings >> Site collection administrators link to add additional site collection administrators.

Quite easy, isn't it? Well, Its easy for one single site collection. However there is a problem when you have large number of site collections. Say, you have 100's of SharePoint online site collections, You can't simply select all of your site collections and add a site collection administrator to all of them at one shot!

In SharePoint Online, site collection administrators to be added on a site collection by site collection basis, as there is no web application level users policies can be set from Central Administration as we do in SharePoint on-premises.

So, the solution is: Using PowerShell to add site collection administrator in SharePoint online!

PowerShell Script to Add Site Collection Administrator in SharePoint Online:
#Variables for processing
$AdminURL = "https://crescent-admin.sharepoint.com/"
$AdminName = "salaudeen@crescent.onmicrosoft.com"
$SiteCollURL = "https://crescent.sharepoint.com/sites/Sales/"
$SiteCollectionAdmin = "mark@crescent.onmicrosoft.com"

#User Names Password to connect 
#$SecurePWD = read-host -assecurestring "Enter Password for $AdminName" 
$SecurePWD = ConvertTo-SecureString "Password1" –asplaintext –force  
$Credential = new-object -typename System.Management.Automation.PSCredential -argumentlist $AdminName, $SecurePWD
 
#Connect to SharePoint Online
Connect-SPOService -url $AdminURL -credential $Credential

#Add Site collection Admin
Set-SPOUser -site $SiteCollURL -LoginName $SiteCollectionAdmin -IsSiteCollectionAdmin $True

To Add Site collection Admin to All SharePoint Online Sites, use:
#Get All Sites collections
$Sites = Get-SPOSite
Foreach ($Site in $Sites)
{
    Write-host "Adding Site Collection Admin for:"$Site.URL
    Set-SPOUser -site $SiteCollURL -LoginName $SiteCollectionAdmin -IsSiteCollectionAdmin $True
}
Change Primary Site Collection Administrator using PowerShell:
#Variables for processing
$AdminURL = "https://crescent-admin.sharepoint.com/"
$AdminName = "salaudeen@crescent.onmicrosoft.com"
$SiteCollURL = "https://crescent.sharepoint.com/sites/Sales"
$NewSiteAdmin = "mark@crescent.onmicrosoft.com"

#User Names Password to connect 
$SecurePWD = ConvertTo-SecureString "Password1" –asplaintext –force  
$Credential = new-object -typename System.Management.Automation.PSCredential -argumentlist $AdminName, $SecurePWD
 
#Connect to SharePoint Online
Connect-SPOService -url $AdminURL -credential $Credential

#Change Site Collection Primary Admin
Set-SPOSite -Identity $SiteCollURL -Owner $NewSiteAdmin -NoWait

Related Articles:


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


Thursday, July 30, 2015

How to convert Word documents to PDF by a SharePoint workflow using HarePoint Workflow Extensions.

Introduction
One of the main purposes of SharePoint is collaboration: a group of people can conveniently work with shared documents, making teamwork especially efficient. Usually, text documents are created and edited using Microsoft Word, but when the work is complete, it is convenient to convert the resulting document to PDF. This gives two advantages:
  • No further changes to a document are possible, so it can be safely shared
  • The PDF document can be easily viewed on any device
A Word document can be saved manually as a PDF file right from Microsoft Word’s Save As… menu, but if we talk about tens or even hundreds of documents per week, it would obviously be preferable to have this conversion running automatically. Another thing is that if we browse the short list of workflow actions in SharePoint Designer, we won't find anything related to document conversion. This is where HarePoint Workflow Extensions can help.

Scenario
In this article, we will follow this scenario:
  1. While the team actively works with a document in the document library Active Docs, it has the status "Work in progress". As soon as the job is done the status is set to Completed.
  2. The workflow triggers and converts this Word document to PDF.
  3. When the PDF file has been created, the workflow moves the original Word document to Document Sources library. Only selected team members (such as managers, etc) have access to this document library.
  4. As a result, only the PDF file remains in the original document library, so everyone can view and share this document. This way, the document can be opened easily (also on any mobile device), and at the same time no deliberate or inadvertent changes can be made.
As was mentioned in Introduction, we’re going to use HarePoint Workflow Extensions to perform this automated Word to PDF conversion. So we have the product installed (detailed information about HarePoint Workflow Extensions and its deployment is available on the product homepage: https://www.harepoint.com/Products/HarePointWorkflowExtensions/ and we are ready to go.

Creating a workflow
We can start creating a workflow. This is performed with SharePoint Designer, like we are used to. On the ribbon click New List Workflow for Active Docs list:
A dialog window for creation of a new list workflow will be displayed. Enter a workflow name and optionally a description.  
Important: select the SharePoint 2010 Workflow Platform Type in the drop-down menu, since HarePoint Workflow Extensions uses the 2010 platform type.
Since in our scenario the workflow will be launched every time the document is changed (but not when created), the first action we need to check is whether the document has the Status set to Completed (otherwise no action should be taken).

Add condition If any value equals value:
In the first parameter select Current Item:Status using the lookup:
The second parameter remains equals.

In the third parameter, select Completed:
Now we can add what should be done when this condition is met.

Add a Convert Document action from the HarePoint Activities – Document Conversion category:
In first parameter, select Current Item. Other parameters can be left as default:
The document conversion is not an immediate process, so in order to find out when the conversion has completed, we need to use the Wait Conversion Job action from HarePoint Activities – Document Conversion category:
In the parameter, select Variable:ConversionJobId (it’s the variable that is used in the previous workflow action) using the lookup:   
The workflow will stay on this action until the conversion is completed.
Finally, we will move the original document to Document Sources library that is accessible only for selected team members.

Add action Copy or Move Document from HarePoint Activities – Document Library:
Switch the action from Copy to Move.

In the second parameter (document URL) specify Current Item: Encoded Absolute URL using the lookup:
In the third parameter specify the full URL of the target library:
(typically that looks like http://servername/sitename/subsitename/.../documentlibraryname/)
 Here’s what we have in SharePoint Designer:
Save the workflow. Modify the workflow Start Options in SharePoint Designer to make it run every time the document is changed, but not when created:
Save and Publish the workflow.

Testing a workflow
Now we can make a test. Add a Word document to Active Docs library.

The document will have an empty status field by default (this is how the Status field is set up).
When the work on this document begins, team members edit the document and set the status to Work In Progress:
The workflow triggers, but completes with no actions taken, just as expected.

Now, change the status of the document to Completed:
 First, we notice the workflow status is now In Progress:
 After some time, all the Word document is gone and only the converted PDF remains in Active Docs:
Then, if we take a look at the Document Sources folder (where only selected team members have access), we see the original Word document:
Conclusion
In this article we have reviewed an example of rather simple but efficient workflow for a Team working with shared documents, and have seen how quickly and easily the solution can be achieved by using HarePoint Workflow Extensions – just a couple of actions in SharePoint Designer and no code at all.

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


Tuesday, July 28, 2015

Product Review: Virto SharePoint Calendar Web Part

Introduction:

Virto SharePoint Calendar Web Part enables users to view all of their events from multiple data sources such as SharePoint Lists, Exchange Calendar, Google Calendar, SalesForce Calendar, SQL Tables or XML and have different views for your easy navigation and reference in one single calendar/or Microsoft Exchange calendars and even from SalesForce Calendars.

Virto SharePoint Calendar replaces the existing SharePoint calendar view's functionality by allowing users to specify the list or view, color code the displayed items by category of events such as internal or external, view day, week, month, year, and Gantt view.

 

Roll up Multiple calendars from different data sources into one Single calendar

The main added value of the SharePoint Calendar web part is the opportunity to have all the events from different data sources displayed in a single SharePoint calendar view, sparing the necessity to switch between multiple views. You can also combine all events from different SharePoint Sites into one calendar! It can show all your events from different SharePoint 2013, 2010 or 2007 lists too.  So you can manage events from different data sources in one calendar.
 
You don't have to synchronize all your calendars from SharePoint, Google, Microsoft Exchange, SalesForce and etc. Install Virto SharePoint Calendar web part and show all the events from multiple data sources in a single place. Use as SharePoint Calendar data sources SharePoint lists from different site collections, SQL tables, Google calendar, XML source, SharePoint lists from other farm, Exchange calendar, SalesForce calendar. This is in comparison to most other SharePoint calendars that can only use one data source, and be displayed in only one view. To distinguish events from different sources in Virto SharePoint Calendar Web Part, one can use multi-level color coding.


 

Different calendar views (Day, Week, Work Week, Month, Year, Task)

Use appropriate timescale for showing your calendar events. Task view allows to control the status of tasks in your SharePoint Calendar web part. If you need to change the duration of the event, modify the size of the cell to the required direction and length. To change the date, simply select the appropriate date in the mini calendar. All of these features will help you save time and complete your calendar tasks with the greatest convenience. 
 
Virto provides editing features that will make working with SharePoint easy and pleasant. If you need to change the date of the event, simply drag and drop it to the appropriate calendar cell. To change the event in time frame in SharePoint Calendar, simply expand the event to incorporate the correct duration of the event.

Color coded data sources

You can visualize the events from your calendars. Customize calendar with special colors for each of data sources and your events will not join anymore! This feature is especially essential when you have more than 2 data sources in one calendar. Use any combination of RGB for coloring events according to their category.

Using Virto SharePoint Calendar Web Part
Virto Calendar implemented in a modern style. The component is fully ready for Windows 8 and SharePoint 2013. Installation is simple and only requires a small amount of time. Currently, Virto supports English, German, Spanish, French, Russian and Chinese Simplified languages. It provides color coding feature that displays items in their SharePoint Calendar web part by category of events (such as internal or external, view day, week, month, year, and Gantt view).

You can contact Virto, If you'd like to add another one language to support SharePoint Calendar Web Part!

 

Key Features & Advantages of Virto Calendar Web Part:

Virto SharePoint Web Part Calendar can be used instead of built-in SharePoint Calendar. It provides you with powerful capabilities for more convenient events calendaring, e.g.:
  • Integrate events from different data sources into one single calendar (from SharePoint Lists, SQL Tables and Microsoft Exchange 2013,  2010 and 2007 Calendars)
  • Add, delete and edit events with drag & drop feature 
  • Multi-level color coding - You can add color legend to remember which colors refer to your events. Event coloring according to event data source, according to event type,
  • Day, Year, Month, Week, Work Week, Task (Days), Task (Hours) views
  • Audience Targeting Support 
  • Advanced filtering, displaying only items satisfied to the specific criteria 
  • Print any Calendar View 
  • Adding Event with a single click
  • Event Coloring according to List Type
  • Date Picker for quick and easy navigation
  • Event duration editing with a simple resizing action
  • Event date changing with a just drag and drop
  • Single aggregated view of all your events from different SharePoint Lists not only single SharePoint Site
  • Resizing to accommodate your web page design

System requirements

Virto SharePoint Calendar web part is available in SharePoint versions 2013, 2010 and 2007. Both in Microsoft SharePoint Foundation 2013 and Microsoft SharePoint Server 2013 (or Windows SharePoint Services v3 SP2 or Microsoft Office SharePoint Server 2007) . 

Conclusion:

Virto SharePoint Calendar enables SharePoint users to plan their activities in a fastest way. The functionality and features of the calendar helps to save the time for real business instead of dying under events and other activities.

Virto SharePoint Calendar Web Part is user friendly and has a simple interface, allowing users to easily create new calendar events with a single click! Included with Virto are editing features that will make working with SharePoint easy and pleasant. You can download it a free 30-days trial at: Virto SharePoint Calendar Web Part

Also, VirtoSoftware releases in the next month a new SharePoint Calendar app for Office 365. Useful options and great quality on the new platform! Find the latest news on www.virtosoftware.com


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


Wednesday, July 15, 2015

Disable Alerts on SharePoint 2013 List using PowerShell

Requirement: Temporarily disable Alert Emails on a SharePoint list.

Solution:
SharePoint Alert objects have "Status" property which can be turned ON or OFF. As there is no UI to disable or enable alerts in SharePoint directly from the browser, we can do it programmatically with PowerShell. Here is my PowerShell script to disable alerts on SharePoint 2010/2013 list or library.

PowerShell script to Disable alerts on SharePoint list
Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue

#Function to Disable All Active Alerts on a Given List
Function Disable-ListAlerts($WebURL, $ListName)
{
    #Get the Web and List objects
    $Web = Get-SPWeb $WebURL
    $List = $web.Lists.TryGetList($ListName)

    #Get All Alerts created in the list - Which are Active
    $ListAlerts = $Web.Alerts | Where-Object {($_.List.Title -eq $List.Title) -and ($_.Status -eq "ON")}

    Write-host "Total Number of Active Alerts Found in the list: $($ListAlerts.Count)" 
    
    #Iterate through each alert and turn it OFF
    foreach($Alert in $ListAlerts)
        {
            $Alert.Status="OFF"
            $Alert.Update()
            write-host "Disabled the Alert' $($Alert.Title)' Created for User '$($Alert.User.Name)'"
        }
         
    #Dispose web object
    $Web.Dispose()
}

#Function to Enable all Disable Alerts on a Given List
Function Enable-ListAlerts($WebURL, $ListName)
{
    #Get the Web and List objects
    $Web = Get-SPWeb $WebURL
    $List = $web.Lists.TryGetList($ListName)

    #Get All Alerts created in the list - Which are in Disabled State
    $ListAlerts = $Web.Alerts | Where-Object { ($_.List.Title -eq $List.Title) -and ($_.Status -eq "OFF")}

    Write-host "Total Number of Disabled Alerts Found in the list: $($ListAlerts.Count)" 
    
    #Iterate through each alert and turn it OFF
    foreach($Alert in $ListAlerts)
        {
            $Alert.Status="ON"
            $Alert.Update()
            write-host "Enabled the Alert' $($Alert.Title)' Created for User '$($Alert.User.Name)'"
        }
         
    #Dispose web object
    $Web.Dispose()
}

#Variables
$WebURL = "http://operations.crescent.com/"
$ListName="Proposal Documents"

#Call the function Appropriately to Disable or Enable Alerts 
Disable-ListAlerts $WebURL $ListName

#To Enable it back
#Enable-ListAlerts $WebURL $ListName

Related Posts:


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