Microsoft Collaboration, CTO viewpoint, and New York

The blog for Office 365, Power Apps, Flow, SharePoint, cloud, ….. plus a little NYC

You are currently browsing the Technology category.

Add Trusted site in Google Chrome

  1. Click the 3 horizontal lines icon on the far right of the Address bar.
  2. Click on Settings, scroll to the bottom and click the Show Advanced Settings link.
  3. Click on Change proxy settings.
  4. Click the Security tab > Trusted Sites icon, then click Sites.
  5. Enter the URL of your Trusted Site, then click Add.

Bit of Powershell to upload photos to users profile

Firstly-  Need to run as an Admin user. Or if it’s your own account, add SP Shell Admin  using:  Add-SPShellAdmin -UserName Domain\user

It takes a bit of time to proper gate.

Instructions to run the upload profile photos Power Shell script

1. Login as sp.admin user or any other farm administratoruserto any of the SharePoint Server and copy and paste the script files to any folder on the server. The script files are already uploaded to  server at location “c:\scripts”

2. Open SharePoint Management Shell (run as administrator)

3. Copy the path of the folder where script resides

<#
.SYNOPSIS
   Upload-ProfilePhotos
.DESCRIPTION
   Bulk upload of profile pictures for SharePoint 2013. The script do not require property mapping and do not rewrites the PictureURL.
   Supports BMP, GIF, JPEG, PNG, TIFF, and WMF picture formats. Script should run in elevated process under the farm account! A nice feature is that if the pictures are uploaded with this script the profile picture of the user will be with the largest thumbnail possible so you will have better picture resolution compared to the AD import.
   First you will need to run the script with GenerateCSV parameter. A CSV file will be generated where you can fill the path to the picture for the specific profile(using Excel or your editor of choice).
   Paths to the photos can be local or network. 
   After you fill all the photo paths that you want. Run the script with UpdatePhotos parameter. The script will upload the photos and will run the native command Update-SPProfilePhotoStore to generate thumbnails and update the PictureURL.
   The script do not support multiple User Profile Service applications in single farm or partitioned User Profile Service application!

   If you are running the script in a fresh SharePoint installation, make sure that User Photos library exist in your My Sites host and also that there is a folder in it called Profile Pictures. If no user has a profile picture most probably the folder is missing. You can create it manually or by uploading a profile picture for some account and the folder will be created.
   If you are using SharePoint installation with language different than English.Please edit the Upload-ToUserPhotos according, there you will find the name of the library, the folder and the upload method.

   v1.1 - Parameter typo fixed, enhanced error handling. Supported doble quoted picture path(Example "C:\SomePic") You will see the actual exception message in order to find what is wrong. Thanks to jlai79

   Author: Ivan Yankulov [ SharePoint Administrator @ BulPros Consulting]
   Contact: http://spyankulov.blogspot.com
   About this script: http://spyankulov.blogspot.com/2014/08/bulk-upload-and-update-user-profile.html

.PARAMETER GenerateCSV
   Use this switch to generate CSV
.PARAMETER UpdatePhotos
   Use this switch to Upload and Update the photos
.PARAMETER CSVPath
   Path to the CSV file that contains the account data
.PARAMETER MySiteHost
   My Site host for your User Profile Service Application
.EXAMPLE
   .\Upload-ProfilePhotos.ps1 -GenerateCSV -MySiteHost http://mysite.auto.l:8080/

 Description
 -----------
 This will generate CSV file UserPhotoCSV.csv in the script execution directory
 .EXAMPLE
    .\Upload-ProfilePhotos.ps1 -UpdatePhotos -MySiteHost http://mysite.auto.l:8080/

 Description
 -----------
 This will use the default CSV file UserPhotoCSV.csv to upload and update the profile photos
.EXAMPLE
   .\Upload-ProfilePhotos.ps1 -GenerateCSV -CSVPath C:\ProfilePhotos.csv -MySiteHost http://mysite.auto.l:8080/

 Description
 -----------
 This will generate CSV file in custom location C:\ProfilePhotos.csv
 .EXAMPLE
    .\Upload-ProfilePhotos.ps1 -UpdatePhotos -CSVPath C:\ProfilePhotos.csv -MySiteHost http://mysite.auto.l:8080/

 Description
 -----------
 This will use CSV file in custom location C:\ProfilePhotos.csv to upload and update the profile photos
.LINK
http://spyankulov.blogspot.com
http://spyankulov.blogspot.com/2014/08/bulk-upload-and-update-user-profile.html

#>

[CmdletBinding(DefaultParameterSetName="GenerateCSV")]
Param(
    [parameter(ParameterSetName="GenerateCSV")]
    [switch]$GenerateCSV =$false,
    [parameter(ParameterSetName="UpdatePhotos")]
    [switch]$UpdatePhotos =$false,
    [parameter(Mandatory=$false)]
    [string]$CSVPath = ($PSScriptRoot + "\UserPhotoCSV.csv"),
    [parameter(Mandatory=$true)]
    [string]$MySiteHost
)
PROCESS{
Add-PSSnapin Microsoft.SharePoint.PowerShell
### Function region
Function Generate-CSV{
[CmdletBinding()]
param(
 [parameter(Mandatory=$true)]
    [string]$URL,
    [parameter(Mandatory=$true)]
    [string]$Path
)
Process{
    $Site = Get-SPSite -Identity $URL
    $context = Get-SPServiceContext -Site $site
    Try{
        $upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context) -ErrorAction Stop
    }Catch [System.Exception]{
        Write-Host "Unable to get the User Profiles !!! Folowing exception occurred: $($_.Exception.Message)" -ForegroundColor Red
        Break
    }
    $AllProfiles = $upm.GetEnumerator()
    $accounts = @()
    Clear-Content -Path $Path -ErrorAction SilentlyContinue
    Try{
        Add-Content -Value "RecordID,LoginName,PhotoPath" -Force -Path $Path -ErrorAction Stop
    }Catch [System.Exception]{
        Write-Host "Unable to generate CSV file to Path: `"$Path`", folowing exception occurred: $($_.Exception.Message)" -ForegroundColor Red
        Break
    }
    ForEach($profile in $AllProfiles)
    {
        Add-Content -Path $Path -Value "$($profile.RecordId.ToString()),$($profile.AccountName.ToString())"
    }
    Write-Host "A CSV file with Profile Information was generated: `"$Path`"" -ForegroundColor Green
    Write-Host "Fill the 'PhotoPath' column with the path to the users photo and run again the script with 'UpdatePhotos' parameter. " -ForegroundColor Green
}
}
Function Upload-ToUserPhotos{
 [CmdletBinding()]
 Param(
     [parameter(Mandatory=$true)]
    [string]$URL,
    [parameter(Mandatory=$true)]
    [string]$Path,
    [parameter(Mandatory=$true)]
    [string]$ID
 )
 Process{
    $docLibraryName = "User Photos"
    $docLibraryUrlName = "Profile%20Pictures"
    $web = Get-SPWeb $URL
    $docLibrary = $web.Lists[$docLibraryName]
    $file = Get-Item $Path
    #Open file
    $fileStream = ([System.IO.FileInfo] (Get-Item $file.FullName)).OpenRead()
    #Add file
    $folder =  $web.GetFolder($docLibraryUrlName)
    $spFile = $folder.Files.Add("/" + "User%20Photos" + "/" + $folder.Url + "/" + "0c37852b-34d0-418e-91c6-2ac25af4be5b_" + $ID + ".jpg", [System.IO.Stream]$fileStream, $true)
    #Close file stream
    $fileStream.Close();
    }
}
Function Update-Photos{
 [CmdletBinding()]
 Param(
     [parameter(Mandatory=$true)]
    [string]$URL,
    [parameter(Mandatory=$true)]
    [string]$Path
 )
Process{
    Try{
        $accountData = Import-Csv $Path -ErrorAction Stop
    }Catch [System.Exception]{
        Write-Host "Unable to load the CSV file from path: `"$Path`", folowing exception occurred: $($_.Exception.Message)" -ForegroundColor Red
        Break
    }
    ForEach ($acc in ($accountData | Where {$_.PhotoPath.Length -ge 2} ))
    {
        $photoPath = $acc.PhotoPath.Replace('"', "")
        If(Test-Path $photoPath -ErrorAction SilentlyContinue)
        {
            If((Get-Item -Path $photoPath).Extension -eq ".jpg")
            {    
                Copy-Item -Path $photoPath -Destination ($PSScriptRoot + "\tempPicture.jpg")
                Try{
                    Upload-ToUserPhotos -ID $acc.RecordID -Path ($PSScriptRoot + "\tempPicture.jpg") -URL $URL -ErrorAction Stop
                    Write-Host "Uploading picture for account: `"$($acc.LoginName)`"" -ForegroundColor Green
                }Catch [System.Exception]{
                    Write-Host "Unable to upload the picture for account: `"$($acc.LoginName)`", folowing exception occurred: $($_.Exception.Message)" -ForegroundColor Red
                }
                Remove-Item -LiteralPath ($PSScriptRoot + "\tempPicture.jpg") -ErrorAction SilentlyContinue
            }
            Else
            {
                Copy-Item -Path $photoPath -Destination ($PSScriptRoot + "\tempPicture.jpg")
                $convertedFile = ($PSScriptRoot + "\convertedPicture.jpg")
                Add-Type -AssemblyName system.drawing
                $image = [drawing.image]::FromFile(($PSScriptRoot + "\tempPicture.jpg"))
                $image.Save($convertedFile, [System.Drawing.Imaging.ImageFormat]::jpeg)
                $image.Dispose()
                Try{
                    Write-Host "Uploading picture for account: `"$($acc.LoginName)`"" -ForegroundColor Green
                    Upload-ToUserPhotos -ID $acc.RecordID -Path $convertedFile -URL $URL -ErrorAction Stop
                }Catch [System.Exception]{
                    Write-Host "Unable to upload the picture for account: `"$($acc.LoginName)`", folowing exception occurred: $($_.Exception.Message)" -ForegroundColor Red
                }
                Remove-Item $convertedFile -Force -ErrorAction SilentlyContinue
                Remove-Item -LiteralPath ($PSScriptRoot + "\tempPicture.jpg") -ErrorAction SilentlyContinue
            }
        }
        Else{
            Write-Host "Unable to get the picture for Account: $($acc.LoginName)" -ForegroundColor Red
        }
    }
        Try{
            Write-Host "Updating Profile Photo Store...." -ForegroundColor Green
            Update-SPProfilePhotoStore -MySiteHostLocation $URL -CreateThumbnailsForImportedPhotos:$true -ErrorAction Stop
        }Catch [System.Exception]{
            Write-Host "Unable to updating Profile Photo Store ! Folowing exception occurred: $($_.Exception.Message)"
        }
}
}

### Function region
switch ($PsCmdlet.ParameterSetName) 
{
    "GenerateCSV" { Generate-CSV -URL $MySiteHost -Path $CSVPath} 
    "UpdatePhotos" { Update-Photos -URL $MySiteHost -Path $CSVPath} 
}
}

Run following command to generate the CSV file:.\Upload-ProfilePhotos.ps1 -GenerateCSV -MySiteHost http://my.site:80/Following message should be displayed after running this command

A CSV file should have been generate at the location where the script file resides. Fill  PhotoPath column with the path to the users photo

Run following command to upload the photos.\Upload-ProfilePhotos.ps1 -UpdatePhotos -MySiteHost http://my.site.com:80/

8.Let the script complete, it should show message like above screen shot for the users for whom PhotoPath column is filled with correct location of the profile photo.

Microsoft SharePoint 2013 Disaster Recovery Guide

The name of the game in of this SharePoint book is SharePoint Disaster Recovery (DR), which also falls into the category of business continuity or high availability. The depth and breadth of the SharePoint DR can be quite daunting because often the reader is new to SharePoint and does not quite know how the pieces of the puzzle all fit together and is facing the challenge of determining how to implement a DR within their organization.

This book is structured to fill in the SharePoint knowledge gaps of how to apply a SharePoint DR approach that is documented, easy to understand and is executable.

By applying knowledge from each chapter, this book will demystify the DR process and you will learn how to identify risk and appropriate DR approaches, and out of the box SharePoint tools for your DR plans.

Windows 8 VPN issues

Often with SharePoint environment’s you have to VPN client’s boxes.

There seem to be quite a few people having issues with VPN and Windows 8.

Click here

It’s not Kaspersky   but Service pack update


 

I did a Restore System State

http://blogs.msdn.com/b/zxue/archive/2012/03/09/windows-8-how-to-29-restore-system-to-a-previous-state-using-restore-point.aspx

And everything works.

Steps to redirect of URLs

 

Steps

 

  1. Open Central administration SharePoint web site

 

  1. In the manage web application

 

  1. Select the web application that you want to extend or create Alternate access mapping

 

 

  1. Create new IIS web site and name it to identify unique

In this document preparation I named the Alternate access mapping as Sharepoint-Custom80.

  1. Select the appropriate port, as my SharePoint -80 web application listening on 80. This has been changed to 80.

 

 

 

  1. Type a host header along with FQDN.
  2. Select the authentication provider, commonly it is NTLM and allow anonymous access, select as you want, in this case it is “No” and choose the public url, in this demonstration I typed as follows

 

  1. Click ok and our new cloned web application created.
  2. Open Internet Information server and see the new web application created in it.

  1. Open DNS MMC snap-in and add a CNAME record for new cloned site.

 

b.Fill-out the CNAME record properties and click OK.

 

 

Now browse newly created cloned website http://newsite.local

 

You should be set up go.

Filtering People Picker

The people picker, allows users to assign tasks to users in AD. This is a useful, but what do you do if you have multiple clients or user groups who shouldn’t see each other.

 

Enter the Filtering People Picker for the entire collection. 

 

People Picker Filters: http://technet.microsoft.com/en-us/library/gg602075.aspx

People Picker is configured at the zone level for a farm by using the Stsadm setproperty operation. By configuring the settings for the control, you can filter and restrict the results that are displayed when a user searches for a user, group, or claim. Those settings will apply to every site within the site collection.


Restrict users to pick from a specific OU: stsadm -o setsiteuseraccountdirectorypath -path<Valid OU name>–url<Web application URL>

Restrict users to pick from only users within the collection: stsadm -o setproperty –pn peoplepicker-onlysearchwithinsitecollection –pv yes –url<Web application URL>

                ** this is ideal either you have access to the collection our you don’t. 

 

To meet the requirement of limiting users to only co workers would need be its one collection.  While this approach introduces many collections (one for each client/ instance) it’s not an untenable situation nor will it reach any limits. 

 

SharePoint Boundaries: http://sdrv.ms/S9ive2

 

Web site

250,000 per site collection

Supported

You can create a very large total number of Web sites by nesting the subsites, For example: a shallow hierarchy with 100 sites, each with 1,000 subsites, is a total 100,000 Web sites, or a deep hierarchy with 100 sites, each 10 levels deep also containing a total of 100,000 Web sites.

The maximum recommended number of sites and subsites is 250,000 sites. Note that Web deletion can have significant impact on the Site’s availability, access to the site and subsites will be limited during the time of Web deletion. Also high concurrency of subsite creation might fail beyond a certain pace

Site Collection Size

100 GB per site collection

Supported

A site collection should not exceed 100 GB unless it is the only site collection in the database.

Certain site collection actions, such as site collection backup/restore or Move-SPSite, cause large Microsoft SQL Server® operations which can have performance impact or fail if other Site collections are active in the same database.

Content database

300 per Web application

Supported

With 300 content databases per Web application, end user operations such as navigating to the site or site collections are not affected. But admin operations such as creating a new site collection will experience performance degradation. It is also suggested to user PowerShell to manage the Web application when a significant number of Content databases is present


 

Funny 404 error from fpweb

Wild Card searches in 2007

Well it can’t be done.

Need to use a 3rd party product like:

http://spwildcardsearch.codeplex.com/

Takes a bit of time to figure out, but works a treat..

Content Types- little inside tip

We all know how cool content types are.  Once of the challenges that I had was that if you have multiple content types in a list, which are similar is that that is no content type name on it, which can confuse an end user.
This is a good post by Laura Rogers on how to get round this issue.

Link

However, with this approach is you’ll need to create separate Editform.aspx and Disform.aspx pages for each content type.   So it could get a bit time consuming.

A quicker approach to this, is to have a calculated field that equals the content type.  And display this field at the top of the form.
Another good post by Laura is:
Link

cool site to test your connection speed

Link

I know there’s plenty of other sites out there.   but this one seems cool