Saturday, April 30, 2016

Create Enterprise Search Center in SharePoint using PowerShell

How to Create Search Center Site Collection?
Creating search center is quite straight forward. Key it: Select "Enterprise Search Center" template while creating site collection / subsite to create search center in sharepoint 2013.
sharepoint 2013 how to create search center

SharePoint 2013: create enterprise search center using PowerShell:
This PowerShell script creates new web application and enterprise search center site collection.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Define Variables for Web Application Creation
$WebAppName = "Crescent Search Center"
$HostHeader = "search.crescent.com"
$WebAppURL = "http://" + $HostHeader
$WebAppPort = "80"
$ContentDBName = "Crescent_Search_Content"
$AppPoolName = "Crescent Search Web Application App Pool"
$AppPoolAccount = "Crescent\SP16_Pool"
$FarmAdminAccount = "Crescent\SP16_Farm"

#Authentication Provider
$AuthProvider = New-SPAuthenticationProvider

#Check if Managed account is registered already
Write-Host -ForegroundColor Yellow "Checking if the Managed Accounts already exists"
$AppPoolAccount = Get-SPManagedAccount -Identity $AppPoolAccount -ErrorAction SilentlyContinue
if ($AppPoolAccount -eq $null)
{
    Write-Host "Please Enter the password for the Service Account..."
    $AppPoolCredentials = Get-Credential $AppPoolAccount
    $AppPoolAccount = New-SPManagedAccount -Credential $AppPoolCredentials
}

#Create new Web Application
New-SPWebApplication -name $WebAppName -port $WebAppPort -hostheader $HostHeader -URL $WebAppURL -ApplicationPool $AppPoolName -ApplicationPoolAccount (Get-SPManagedAccount $AppPoolAccount) -AuthenticationMethod NTLM -AuthenticationProvider $AuthProvider -DatabaseName $ContentDBName

#Create Enterprise Search Center site collection
New-SPSite -Name $WebAppName -Url $WebAppURL -Template "SRCHCEN#0" -OwnerAlias $FarmAdminAccount -ContentDatabase $ContentDBName

Tags: sharepoint 2013 create search center site, create a search center sharepoint 2013, sharepoint 2013 create search center powershell, sharepoint powershell create enterprise search center, sharepoint 2013 create enterprise search center powershell

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


Friday, April 29, 2016

SharePoint Online: Add User to Group using PowerShell-CSOM

How to add people to existing groups in SharePoint online:
  • Login to SharePoint online site >> Click on Site Settings >> Under Site Settings page, in the Users And Permissions section, click on "Site Permissions" link.
  • On the Permissions page, click on "Grant Permissions" button in the ribbon from Permissions tab.
    SharePoint Online PowerShell to Add User to Group
  • In the Share dialog box, enter name / email addresses
  • Click on "Hide Options" link button. In the Select A Group Or Permission Level list box, select the appropriate group name such as "Members"
    sharepoint online add user to group powershell
  • Click Share button.

SharePoint Online PowerShell to Add User to Group
Here is how we can add user to group using PowerShell in SharePoint Online.
#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/Sites/Sales"
$UserAccount = "Salaudeen@crescent.com"
$GroupName="Sales Members"

#Setup Credentials to connect
$Cred = Get-Credential
$Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)

Try {
    #Setup the context
    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    $Ctx.Credentials = $Cred
    
    #Get the Web and Group
    $Web = $Ctx.Web
    $Group= $Web.SiteGroups.GetByName($GroupName)

    #Resolve the User
    $User=$web.EnsureUser($UserAccount)

    #Add user to the group
    $Result = $Group.Users.AddUser($User)
    $Ctx.Load($Result)
    $Ctx.ExecuteQuery()

    write-host  -f Green "User '$UserAccount' has been added to '$GroupName'"
}
Catch {
    write-host -f Red "Error Adding user to Group!" $_.Exception.Message
}
You can also use Add-SPOUser using SharePoint online management shell : SharePoint Online: PowerShell to Add Users to Group

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


Saturday, April 23, 2016

Site Owners with Full Control Could not Access or Edit SharePoint Group

Problem: Site Owners with full control couldn't access or edit member of a group.

Root cause: By default, only SharePoint group owners can add/remove members of the group, even though you have full control access rights to the site - This is by design!

Solution: Change the group owner! You can either Add a person to "Group Owner" or set group owner to "Site Owners" group (recommended), so that any member of site owners group can add-remove members to the group.
site owner could not view or change sharepoint group

Alternatively, You can change group settings to allow members of the group to change group membership.  (but not recommended!). Under the group settings, set "Who can edit the membership of the group?"  to "Group Members".

You do not have permission to view the membership of the group
In some cases, users may encounter "You do not have permission to view the membership of the group." message on trying to access the group. To fix this issue, under group settings, set "Who can view the membership of the group?" to "Everyone"
You do not have permission to view the membership of the group


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


How to Change SharePoint Group Owner using PowerShell

Change group owner in sharepoint site:
Follow these steps to update sharepoint group owner in SharePoint.
  • Go to Site Settings >>  People and Groups
  • Pick the group you want from the Left navigation
  • From the group page, Click on Settings >> Group Settings >> Set the new group owner in "Group Owner" field. Hit OK to save your changes. This changes owner of the group.
how to change sharepoint group owner powershell
Changing the group owner from SharePoint web user interface is quite simple. But At times, you may have to replace an existing group owner with a new user across multiple site collections. Ideally, we have to leverage PowerShell for these kind of admin tasks.

How to change SharePoint Group owner using PowerShell?
Here is the SharePoint PowerShell to update group owner.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Parameters
$SiteURL="http://intranet.crescent.com/Sites/Operations"
$GroupName="Operations Site Owners"
$GroupOwner="Crescent\Salaudeen"

Try {
    #Get the Site and Group
    $Web = Get-SPWeb $SiteURL
    $Group = $web.SiteGroups[$GroupName]

    if ($Group -ne $null)
    {  
        #Get the User 
        $Owner = $web.EnsureUser($GroupOwner)

        #change group owner
        $Group.Owner = $Owner

        #Update the Group
        $Group.Update()
        Write-host -f Green "Group Owner updated successfully!"
    }
    else
    { 
        Write-host -f Yellow "Group Doesn't Exists!" 
    }
}
Catch {
    write-host -f Red "Error Changing Group Owner!" $_.Exception.Message
}
This PowerShell script changes group owner programmatically for the given group name. By default, you can specify only one user as a Group owner, So its a good idea to set group owner to Farm Admin account or use SharePoint group as Group owner!

Update sharepoint group owners for all groups using PowerShell:
While the above script changes the group owner for given group name, Lets change group owners for all groups in the entire site collection. Here is the PowerShell script to set group owner for all groups in the site collection.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Parameters
$SiteURL="http://intranet.crescent.com/Sites/Sales"
$GroupOwner="Crescent\Salaudeen"

Try {
    #Get all sites under given Site Collection
    $WebsCollection =  Get-SPSite $SiteURL | Get-SPWeb -Limit ALL
    
    #Loop through each web
    Foreach ($Web in $WebsCollection) 
    {
        Write-Host -f Yellow "Processing Web:"$Web.URL
        
        #Process the sites with unique permissions
        If($Web.HasUniqueRoleAssignments)
        {
            #Get the Group Owner User
            $Owner = $Web.EnsureUser($GroupOwner)

            #Get all Groups and Iterate through
            Foreach ($Group in $Web.Groups)
            {
                #Update the group owner                    
                $Group.Owner = $Owner
                $Group.Update()
                Write-host -f Green "Group Owner Updated for "$Group.Name
            }
        }
    }
}
Catch {
    write-host -f Red "Error Changing Group Owner!" $_.Exception.Message
}
Although this script is written to change all group owners for given site collection, With slight changes to this script, You change the Group Owners of SharePoint Groups for any number of site collections. You can also change the script a bit to change owner of group for a entire web application or even all web applications in the farm. Just change $WebsCollection to:
$WebsCollection =  Get-SPWebApplication | Get-SPSite  -Limit ALL | Get-SPWeb -Limit ALL
Tips: You can also assign an existing SharePoint group as a group owner in SharePoint! Here is how:
$GroupOwner = $web.SiteGroups["Sales Site Owners"]

Tags: sharepoint group owner change, sharepoint change group owner powershell, sharepoint edit group owner, how to change sharepoint group owner, change sharepoint group owner via powershell, update sharepoint group owner powershell

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


SharePoint Group Owner Cannot Add User! Gets Acces Denied

Problem:  SharePoint group owner cannot add user! group owner gets access denied.

Root cause: Its a common misconception that group owners get access automatically as you made them owner of the group! Just because you made someone as "Group Owner" doesn't mean they get access to the site! They can't access the site, until unless you actually grant permission to that group owner user.

And its also true that group owner can't add/remove users unless they have "Manage Permissions" rights!
sharepoint group owner cannot add user access denied

Solution: So, the solution is grant permission to the user by adding them to appropriate SharePoint Group or to the Active directory group which has access to the site already! This gets them the access to the site. And to add other users to the group, the group owner should have permission level consists of permission "Manage Permission" (such as "Full Control").

Tags: sharepoint group owner cannot add user, sharepoint 2010 group owner access denied, sharepoint owners group no access

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


Sunday, April 17, 2016

How to Add User to SharePoint Group using PowerShell

Requirement: Add User to SharePoint group using PowerShell

Solution:
From SharePoint site, you can follow below steps to add an user to particular group.
  • Go to your SharePoint site and click on Site Settings gear icon >> Select "Site settings"
  • Click on "People and groups" link under "Users and Permissions"
  • Click on the SharePoint user group to which you want to add users, such as "Marketing Members"
  • Click on "New" button >> and select "Add Users".
    sharepoint group add user powershell
  • Enter the names of the users to add. Make sure all your entries are resolved.
  • Click on "Share" button to to complete add user to SharePoint group.
    sharepoint powershell add user to group
The users have entered are not added to the group!

Add User to SharePoint group with PowerShell
There are two cmdlets provided by SharePoint to add user to group using PowerShell.

New-SPUser New-SPUser cmdlet adds an existing active directory (or whatever authentication provider) to SharePoint to the appropriate group specified.
New-SPUser -UserAlias "domain\user" -Web "http://sharepoint.crescent.com/sites/marketing" -Group "Marketing Owners"
This will create a add a new User to SharePoint site to the particular group. If you execute this command for the next time, (without deleting the user from site collection) this command has no effect!

Set-SPUser:
Set-SPUser cmdlet adds an existing SharePoint user to an existing group in the given site.
Set-SPUser -Identity "domain\user" -Web "http://sharepoint.crescent.com/sites/marketing" -Group "Marketing Owners"
This will add existing SharePoint users account to the provided group, but will give error when you try add a new user to SharePoint site. (which is obvious! We can't set the user property, if the user doesn't exists in SharePoint site, isn't it?)

Add User to SharePoint Group using PowerShell Script
Other than New-SPUser and Set-SPUser cmdlets, lets use the native object model APIs to add user to group in SharePoint using PowerShell.
#Get the Web
$web=Get-SPWeb "http://sharepoint.crescent.com/sites/marketing"
#Get the SharePoint Group
$Group= $web.Groups["Marketing Owners"]
$userName = "domain\userName"

#Add User to the site collection
$user = $web.EnsureUser($UserName)

#Add User to the Group
$group.AddUser($user) 
web.group vs web.sitegroup - SPWeb.Group refers the groups which are used in the specified SPWeb object (If SPWeb uses unique permissions). Whereas SPWeb.SiteGroups refers to a collection of all groups in the site collection.


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


Saturday, April 16, 2016

How to Upload List Template in SharePoint 2013

Requirement: Upload a list template in SharePoint 2013! SharePoint 2013 offers many list templates such as Task List, contacts, calendar, etc to create clones. At times, You may have to import a custom list template obtained from other sites into your SharePoint.

How to upload a list template in SharePoint 2013:
SharePoint list templates are XML-based definition of list settings, such as List fields, List views and optionally list items. List templates are stored as.stp files. To upload a list template in SharePoint, follow these steps:
  • Navigate to your Site collection. Click on "Site Settings" gear icon >> Choose "Site Settings".
  • Click on List Templates link under Web Designer Galleries
    upload a list template sharepoint 2013
  • From List Templates library, Click on "Upload Document" button from Files Tab
    how to upload list template in sharepoint online
  • Browse and Select your List template STP File and Click "OK" to upload the list template to SharePoint
    import list template stp sharepoint 2013
  • Provide a Name and Title to the template, Optionally the description.Click "Save" to finish uploading the list template to SharePoint.
    upload list template to sharepoint 2013
  • That's all. Now, If you go to "Add an App" page, you'll find your list template listed!
    how to upload list template in sharepoint 2013
PowerShell to Upload list template in SharePoint 2013:
To upload SharePoint list template using PowerShell, refer this post: How to upload list template in SharePoint 2013 using PowerShell

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


Wednesday, April 13, 2016

SharePoint 2016 Installation Guide - Step by Step

SharePoint 2016 is in RTM finally with all new features. Lets walk-through SharePoint 2016 installation process step by step:

System Requirements: What's my Server Farm Configuration?
Here is my SharePoint 2016 farm's server configuration (Hardware/software).
  • Windows Server 2012 R2 Standard as Server Operating system and SQL Server 2014 Standard SP1 as my SQL Server instance. 
  • All my servers running with 24 GB of RAM (minimum requirement: 16 GB. For single server installation: 24 GB) and Quad core processors. (64 bit of course!) and 120 GB in system drive and 250 GB as secondary drive (Min: 80 GB for system drive and 100 GB for applications).
Service Accounts:
  • Crescent\SP16_Setup - Setup  account used for installation. You must manually assign Member of Local Administrator group on all SharePoint Servers and SQL server and SysAdmin role at SQL Server instance. (In fact, it just needs: DBcreator & SecurityAdmin server roles and DBO rights on each SharePoint Databases).
  • Crescent\SP16_Farm - Farm account / Database access account. Necessary rights will be automatically granted on the SQL Server instance when you run SharePoint products configuration wizard.
Whats new in SharePoint 2016 Installation?
Its pretty much same as SharePoint 2013 installation, except the "Server Role" selection page. MinRole is introduced newly in SharePoint 2016.

SharePoint 2016 Server installation steps at high level:
  1. Install SharePoint 2016 prerequisites
  2. Install SharePoint  Server 2016
  3. Run Products configuration wizard
    SharePoint 2016 Server Farm Topology:
    Here is my small server farm topology for SharePoint 2016 with three servers. All these servers joined to my domain: Crescent.com
    Where to start Installation? Start with your Application Server! Your Application server hosts SharePoint 2016 central administration site and other necessary service applications.

    Step 1: Install Prerequisites

    We need to install SharePoint 2016 prerequisites before installing SharePoint Server 2016. Login with Setup account and start your SharePoint Server 2016 installation by installing the prerequisites. Prerequisites installer will add all necessary server roles (Application Server Role, Web Server (IIS) Role) ,downloads and installs all necessary components for SharePoint 2016.
    • Mount the ISO on the drive, launch "default.hta" file (or prerequisiteinstaller.exe). You'll see the same old Splash screen! Click on "Install software prerequisites" link under "Install"
      sharepoint 2016 installation guide
    • Accept License agreement and click "Next" button
      sharepoint 2016 installation step by step
    • Wait for the installation to proceed
      sharepoint 2016 install instructions
    • Prerequisites installer takes some time and will prompt for restart. After restart, re-run the prerequisites again! Restart and resume back.
    • Wait for the installation completed message. Click on "Finish" button to complete prerequisites installation.
      sharepoint 2016 install standalone

    Step 2: SharePoint Server 2016 Installation

    • After completing prerequisites installation, run the splash.hta file again and click on "Install SharePoint Server". sharepoint 2016 installation steps
    • You'll be prompted to enter the product key. I've used the 180 day Trial key: NQGJR-63HC8-XCRQH-MYVCH-3J3QR
      how to install sharepoint 2016 step by step
    • Accept license agreement
      install sharepoint server 2016
    • Choose a file location: Choose a file location for SharePoint Server and Search server index. Make sure there is sufficient disk space on the selected drive. You can use your secondary drive to store search index files. Click on "Install Now" button to start the installation process.
    • Wait for installation to complete. The installation wizard takes few minutes to complete.
    • Once completed, You'll be taken to Run Configuration wizard page. Tick the "Run the SharePoint Products Configuration Wizard now" check box and click on Close.

    Step 3: Run SharePoint Products Configuration Wizard

    • You'll be presented with the "Welcome to SharePoint Products" wizard. Run SharePoint Products configuration wizard by clicking "Next" button.
    • Click Yes for products configuration wizard restart services confirmation
    • On Connect to a server farm, choose Create a new server farm. If you are already have an existing SharePoint farm created, you'll have to choose the option "connect to an existing server farm". We'll be selecting this when we run products configuration wizard on our WFE server.
    • Specify configuration database settings: Enter your Database server name and proposed SharePoint farm's configuration database names. Enter the Farm account which will be used for database access.
    • On Farm security settings page, enter the Passphrase. You'll need this when you need to join the new server to an existing SharePoint server farm.
    • Specify Server Role. There are six roles listed in this page. You can select whichever applicable to you. This is critical as in previous versions:  If you selected Single-Server Farm, then you can't scale out your SharePoint farm to Multi-Server environment! So if you plan to extend your farm to Multi-Server farm in future, make sure you have selected the Custom (MinRole) or Application server role. In my case, I've selected Application server role. Click on Next to proceed.
    • Enter the Port for SharePoint 2016 Central Administration site. Choose the authentication provider. Click Next to continue.
    • You'll see SharePoint products configuration wizard performing several tasks as in the below progress screen. Wait until all 10 installation tasks to complete.
    • Once completed, SharePoint products configuration wizard presents you the verify screen. You can click Back in case, you want to change any setting. Click Next to proceed.
    • Wait for the Configuration successful page. Click on "Finish" to complete SharePoint 2016 installation process.
    Once you click "Finish" button, you'll be taken to Initial Farm Configuration Wizard page in SharePoint 2016 Central Administration site.

    Repeat all these steps in your Web Front end Server. Choose "Front-End" Server role for Web Front end. Once done, you can proceed with creating web applications, Service applications and site collections.

    FAQ's and Known issues in SharePoint 2016 Installation:
    • Can I use a Single Server for SharePoint 2016 installation?
      Sure, You can use a single server. However, You need to have SQL Server 2014 installed on the server first! Unlike SharePoint 2013, SharePoint 2016 doesn't install SQL Server Express automatically as part of Single server mode.
    • Prerequisiteinstaller.exe: The system cannot find the drive specified
      This happens when you mount an ISO file and after server reboot, it doesn't get mounted automatically. Remedy is simple: Mount the ISO and run:Start "Launch SharePoint preparation tool" "E:\Prerequisiteinstaller.exe" /continue


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


    Monday, April 11, 2016

    InfoPath Form: Show Thank You Page on Submit

    Requirement:
    To deliver better user experience, wanted to show a neatly designed thank you page on submitting a customized SharePoint list form in InfoPath. Although we can customize the standard popup message shown on successfully submissions through "Submit Options" under Data tab, we wanted to customize the entire look and feel.

    Solution:
    The idea is: Create a new view for Thank you page and then change the view after submitting data. Here is how to implement thank you page for InfoPath forms.
    • Open your form template in InfoPath Form Designer
    • Click on "Page Design" tab and create new view.
    • Give a name to your view (say: ThankYou), and place image/text appropriately. Here is mine:
      infopath form thank you page
    • Create a button for "Submit". From the ribbon select "Manage Rules". In the "submit" button's Rules, Add >> and then Action.
      • Submit using Data connections
      • Switch to view: ThankYou
    infopath thank you page
    That's all! Now we let the end-user to know, form submitted successfully.

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


    Friday, April 8, 2016

    SharePoint Online: Hide Columns from List using PowerShell-CSOM

    Requirement: Hide columns from SharePoint online list. In a project request list, when user fills the form we wanted to hide the "Status" column by default and then have a workflow to populate status of the particular request. Similarly for Edit column as well, but show it only on View form.

    SharePoint Online Hide Column from list using PowerShell:
    Here is the PowerShell script to hide list columns from SharePoint online list.
    #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"
      
    #Config Parameters
    $SiteURL= "https://crescent.sharepoint.com/sites/prjects/"
    $ListName="ProjectRequest"
    $FieldName = "Status" #Display Name
    
    #Setup Credentials to connect
    $Cred = Get-Credential
    $Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)
    
    Try {
        #Setup the context
        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
        $Ctx.Credentials = $Cred
      
        #Get the web, List and Field objects
        $Web=$Ctx.Web
        $List=$web.Lists.GetByTitle($ListName)
        $Field = $List.Fields.GetByTitle($FieldName)
    
        #Hide the column from New & Edit forms
        $Field.SetShowInEditForm($False) 
        $Field.SetShowInNewForm($False) 
        $Field.UpdateAndPushChanges($True)
        $Ctx.ExecuteQuery()
         
        Write-host -f Green "List Field hidden Successfully!"
    }
    Catch {
        write-host -f Red "Error hiding List Column: " $_.Exception.Message
    }
    This hides the specific column from New form and Edit forms of the list!
    sharepoint online hide column


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


    Tuesday, April 5, 2016

    Enable "Link to Item" or "Edit Menu" on Any Column of the List in SharePoint

    Requirement:
    There is a list called "Projects" where the default title filed made hidden and now the problem is: User wants to have the link to View Item on "Project Name" Field.

    By default "Title" field of the list has link to item and edit menu options in it. If you want to change link to item or edit menu options on any other column of the list - There is no option!
    sharepoint change link to item field
    Solution: How to change link to item field in SharePoint?
    To enable link to item and/or edit menu options on any of the SharePoint list column, follow below steps:
    • Open your List view page in SharePoint Designer using "Edit File in Advanced Mode"
    • Search for <ViewFields> Tag. Pick the appropriate field to have link to item functionality
    • Add: LinkToItem="TRUE" to it. If you want to have Edit Menu, then add: ListItemMenu="TRUE" or you can add both.E.g.
    <FieldRef Name="ProjectName" LinkToItem="TRUE" ListItemMenu="TRUE" />
     sharepoint link to item with edit menu
    Save and close the page. Now, if you go back to your view, the "Project Name" field will have the link to DispForm.aspx page of the item!

    Set Link to Item or ECB Menu on a particular column in SharePoint 2016:
    While the above solution works on both SharePoint 2010 and in SharePoint 2016, found the same "LinkToItem" doesn't work on SharePoint 2016, but "linkToItem" works (case sensitive!)
    <FieldRef Name="ProjectName" linkToItem="TRUE" ListItemMenu="TRUE" />
    link to item with edit menu sharepoint change
    Here is the Result in action: link to item with edit menu in custom column!
    sharepoint change link to item field


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


    Sunday, April 3, 2016

    Get List Fields in SharePoint using PowerShell

    Requirement: Get all Fields from a SharePoint list using PowerShell.

    PowerShell Script to get all List Fields, Internal Name and Field types:
    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
    
    #Configuration Parameters
    $SiteURL="http://intranet.crescent.com/"
    $ListName= "Quick Links"
    
    #Get the List
    $List = (Get-SPWeb $SiteURL).Lists.TryGetList($ListName)
    
    Write-Host "Field Name | Internal Name | Type"
    Write-Host "------------------------------------"
    
    #Loop through each field in the list and get the Field Title, Internal Name and Type
    ForEach ($Field in $List.Fields)
    {
        Write-Host $Field.Title"|"$Field.internalName"|"$Field.Type
    }  
    This PowerShell script gets all column names, internal name and column types from the given SharePoint list!
    sharepoint powershell get list column


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


    Saturday, April 2, 2016

    SharePoint Online: How to Create Group using PowerShell CSOM

    A SharePoint group is a container of users who share similar set of permissions. SharePoint groups provides convenient way to manage security as a group centrally rather managing individual users. We can organize users into groups (up to5,000) and set permissions to the group at site level and then use it in any underlying objects like sub-sites, lists and list items.

    By default SharePoint creates three user groups upon site creation: Owners, Members and visitors and you need to be a site owner/site collection admin to grant permissions to the group.

    How to Create a group in SharePoint Online:
    • Navigate to your SharePoint online site, Click on Site Settings gear icon and then select Site Settings. From the Site settings page, click Site Permissions in the Users And Permissions section.
    • From the Permissions page, click on Create Group icon from the ribbon, under Permissions tab.
      SharePoint Online PowerShell to create group
    • On the Create Group page, provide the Name, optionally other settings such as description, owner to the group. Set group settings like who can view/edit group membership, Allow users to request membership,  leave the group. All requests will be sent to the specified E-mail.
    • In the "Give group permission to this site" section, select the appropriate check box to assign the permission level to your new group.
      SharePoint online Create Group using PowerShell
    • Click Create.

    Once the group is created, you can rename it, change permissions of the group in one place and add/remove people to it.
     
    SharePoint Online PowerShell to create group
    Lets create a new user group in SharePoint online using PowerShell.
    #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://Abraaj.sharepoint.com/Sites/Sales"
    $GroupName="Sales Managers90"
    
    #Setup Credentials to connect
    $Cred = Get-Credential
    $Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)
    
    #Setup the context
    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    $Ctx.Credentials = $Cred
    
    #Create new Group
    $GroupInfo = New-Object Microsoft.SharePoint.Client.GroupCreationInformation
    $GroupInfo.Title = $GroupName      
    $Group = $Ctx.web.SiteGroups.Add($GroupInfo)
    $Ctx.ExecuteQuery()
    Plain and simple, huh.. Lets add some error handling code and assign permissions to the created group.

    SharePoint online Create Group using PowerShell
    Here is the PowerShell CSOM script to create SharePoint group.
    #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/Sites/Sales"
    $GroupName="Sales Managers"
    $PermissionLevel="Edit"
    
    #Setup Credentials to connect
    $Cred = Get-Credential
    $Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)
    
    Try {
        #Setup the context
        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
        $Ctx.Credentials = $Cred
    
        #Get all existing groups of the site
        $Groups = $Ctx.Web.SiteGroups
        $Ctx.load($Groups)
        $Ctx.ExecuteQuery()
        
        #Get Group Names
        $GroupNames =  $Groups | Select -ExpandProperty Title
        
        #Check if the given group doesn't exist already
        If($GroupNames -notcontains $GroupName)
        {
            #Create new Group
            $GroupInfo = New-Object Microsoft.SharePoint.Client.GroupCreationInformation
            $GroupInfo.Title = $GroupName      
            $Group = $Ctx.web.SiteGroups.Add($GroupInfo)
            $Ctx.ExecuteQuery()
    
            #Assign permission to the group
            $RoleDef = $Ctx.web.RoleDefinitions.GetByName($PermissionLevel)
            $RoleDefBind = New-Object Microsoft.SharePoint.Client.RoleDefinitionBindingCollection($Ctx)
            $RoleDefBind.Add($RoleDef)
            $Ctx.Load($Ctx.Web.RoleAssignments.Add($Group,$RoleDefBind))
            $Ctx.ExecuteQuery()
    
            write-host  -f Green "User Group has been added Successfully!"
        }
        else
        {
            Write-host -f Yellow "Group Exists already!"
        }
    }
    Catch {
        write-host -f Red "Error Creating New user Group!" $_.Exception.Message
    }
    This script creates new SharePoint online group and assigns permission to the group.

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