Tag Archives: SharePoint

SharePoint 2013 Make the document icon in a document library work

We have a customer who is using Colligo Engage for Outlook, uploading emails to SharePoint Online and tagging them with some additional metadata for other departments to keep track of what is occurring.

All of that is well and good but the name column was just too long to display along with all the other columns in the library view. This is a pretty common problem with long file names and one you can usually solve with users who are uploading traditional files but with this process they didn’t modify the file name Colligo automatically generated.

Continue reading SharePoint 2013 Make the document icon in a document library work

Free SharePoint 2010 Foundation add-ons everyone should have

a-motor-cycle-with-a-side-car-machine-gun

We have several customers who use SharePoint 2010 Foundation and are constantly trying to get the most out of the product, envious of what SharePoint standard and enterprise can do, frustrated by Foundations limitations but liking its price tag.

I’ve compiled a list of useful add-on’s here but I’ll come back and keep adding to it as we find more that are note worthy.

Continue reading Free SharePoint 2010 Foundation add-ons everyone should have

Hide SharePoint calculated columns from display form with PowerShell

HidingWhile creating a column which hyperlinked through to another list I’d created a few calculated columns which were showing up in the display form of items.

You can’t hide calculated columns in the same way as with regular columns, some of these pains are mentioned in the reference sites.

Below is the PowerShell I used in the SharePoint 2010 Management Shell to hide them.

I’ve commented out two options since they are quite useful to retain in most circumstances.

Continue reading Hide SharePoint calculated columns from display form with PowerShell

Mount-SPContentDatabase and Test-SPContentDatabase fail with either Invalid object name ‘Sites’ or ‘Webs’

homer-doh

While trying to restore some SharePoint 2010 “content” databases I kept on getting errors about invalid objects… Found some links talking about incorrect SharePoint versions but as it turned out that all it was because the databases were service application database backups with slightly ambiguous names, not content databases.

Continue reading Mount-SPContentDatabase and Test-SPContentDatabase fail with either Invalid object name ‘Sites’ or ‘Webs’

Edition downgrade for SharePoint Search Server Express 2010 from SQL 2008 R2 Enterprise to SQL 2012 Express

DowngradeThis is just a quick post to highlight issues with two SharePoint Search Server Express 2010 databases when downgrading from SQL 2008 R2 Enterprise to SQL 2012 Express (although applies to any Express version, 2008 R2 or higher).

The customer needed to swap out an Enterprise trial version of SQL and replace it with Express since the investment for Enterprise wasn’t forthcoming and neither was the investment for further immediate work in SharePoint.

They were however getting great value from Search within Search Server Express 2010 so didn’t want that to go anywhere, it was the entire companies home page!

Continue reading Edition downgrade for SharePoint Search Server Express 2010 from SQL 2008 R2 Enterprise to SQL 2012 Express

Create a SharePoint group with permissions and add an AD group to it

group_add

Requirement

  • Create a SharePoint group in a site collection
  • Assign that group an existing permission for Site Permissions list
  • Add an Active Directory group to that SharePoint group
  • Read the values from a CSV file
  • Repeat for 1000 groups spread across multiple site collections
  • The Site Collection Admin will run the script and be added as owner automatically

 

Solution

function global:New-SPGroup {
#Parameters that the script offers out to use,
# e.g. New-SPGroup -SiteCollection “
http://intranet/sitecollection” -ADGroupName “domain\ADgroup” -SPGroupName “SharePoint Group 1” -SPGroupDescription “Group Description” -SPGroupPermission “Permission”
[CmdletBinding()]
Param(
[Microsoft.SharePoint.PowerShell.SPWebPipeBind]
[string]$SiteCollection,
[string]$ADGroupName,
[string]$SPGroupName,
[string]$SPGroupDescription,
[string]$SPGroupPermission
)

#Required variabales for dev or single item runs, remove # and highlight from here down to above CSV section in Powershell ISE
#$SiteCollection = “
http://site/sitecollection”
#$ADGroupName = “domain\adgroup”
#$SPGroupName = “My Test Group A1”
#$SPGroupDescription = “Test Group A1’s Description” #Note: do not use” – ” in description, i.e. space hyphen space
#$SPGroupPermission = “Read”

#Start of script
$site = Get-SPWeb $SiteCollection

#Check if the group already exists
if ($site.SiteGroups[“SPGroupName”] -eq $null)
{

#Ensure Group/User is part of site collection users beforehand and add them if needed
$site.EnsureUser(“$ADGroupName”)

# Get the AD Group/User in a format that PowerShell can use otherwise there will be a string error
$ADGroupSPFriendly = $site | Get-SPUser $ADGroupName

#Create the SharePoint Group – Group Name, Group Owner, Group Member, Group Description. Can’t add AD group yet…
$NewSPGroup = $site.SiteGroups.Add($SPGroupName, $site.CurrentUser, $site.CurrentUser, $SPGroupDescription)
$site.AssociatedGroups.Add($site.SiteGroups[“$SPGroupName”]);
$NewSPAccount = $site.SiteGroups[“$SPGroupName”]

#Assign the Group permission
$GroupAssignment = New-Object Microsoft.SharePoint.SPRoleAssignment($NewSPAccount)
$GroupRole = $site.RoleDefinitions[“$SPGroupPermission”]
$GroupAssignment.RoleDefinitionBindings.Add($GroupRole)
$site.RoleAssignments.Add($GroupAssignment)

#Add the AD Group/User to the group, can’t be done during group creation when using Powershell otherwise errors so is done now.
Set-SPUser -Identity $ADGroupSPFriendly -Web $SiteCollection -Group $SPGroupName
}
$site.Dispose()
}

#Read from the CSV input file
#CSV file must have header row – SiteColl, AdSecGroup, SPSecGroupName, SPGroupDesc, SPGroupPerm
#No “” around any items in the CSV file are needed
$csv = Import-csv -path D:\DEVGroupNameCSVFile2.csv
if ($csv -ne $null) {
foreach($line in $csv)
{
[string]$SiteCollection = $line.SiteColl;
[string]$ADGroupName = $line.AdSecGroup;
[string]$SPGroupName = $line.SPSecGroupName;
[string]$SPGroupDescription = $line.SPGroupDesc;
[string]$SPGroupPermission = $line.SPGroupPerm

New-SPGroup -Site $SiteCollection -ADGroupName $ADGroupName -SPGroupName $SPGroupName -SPGroupDescription $SPGroupDescription -SPGroupPermission $SPGroupPermission;
}
}

 

I hope someone else finds this script useful since all I found on the web were partial answers at best, and with a few solutions that didn’t match the requirement.

Errors encountered along the way and running the script

“You cannot add a domain group to a group.” – You can however add your AD group to the SharePoint group after is it created, just not while you are creating it. Resolved by the last part of the function.

Exception calling “Add” with “4” argument(s): “The specified name is already in use. Please try again with a new name.” – As it implies, this is a duplicate item in your CSV file.

References

Basis for script –

http://sharepointryan.com/2011/07/20/create-sharepoint-groups-using-powershell/

http://addictedtosharepoint.com/2011/07/23/adding-a-security-group-to-a-sharepoint-site-via-powershell/

http://www.iotap.com/Blog/tabid/673/entryid/154/Powershell-script-for-Adding-Active-Directory-Users-to-Sharepoint-2010-Groups.aspx

http://get-spscripts.com/2011/02/add-sharepoint-or-ad-groupuser-to-all.html

http://stackoverflow.com/questions/4512548/how-to-add-ad-group-to-sharepoint-2010-spgroup-programmatically

http://shpstuff.blogspot.co.uk/2012/05/create-groups-in-site-collection-using.html

http://stackoverflow.com/questions/3713497/how-to-get-spuser-object-using-user-id-domain-name-userid

Additional information that you might find useful –

http://sharepoint.stackexchange.com/questions/20739/add-users-to-sp-group

http://social.msdn.microsoft.com/Forums/eu/sharepointdevelopment/thread/2df1f82b-ba04-4378-9df8-6fb0bf8eeaa3

http://www.learningsharepoint.com/forum/sharepoint-2010-programming/add-user-with-powershell-in-sharepoint-2010-site/

http://social.technet.microsoft.com/forums/en-GB/sharepointadminprevious/thread/c9e11537-6b1a-46f6-b030-395f8ed1fbf7

http://social.technet.microsoft.com/forums/en-ZA/sharepointgeneralprevious/thread/0632b071-617f-4e93-bd06-ed85ab7ef4a6

[aboutme username=”ashley.lawrence”]

 

Stop Excel documents opening in the browser on SharePoint

image

I had to spend a little time today stopping Excel documents opening in the browser. Following the advice on the web didn’t really help and I was sure I had done the steps required. I was starting to doubt my sanity…

The error message

The client doesn’t want or need Excel Calculation Services (certainly not right now away) so it isn’t setup or configured but documents were still trying to open in the browser for all site collections on a single web application, yielding this error message:

image“Unable to process the request. Wait a few minutes and try performing this operation again.”

Clearly this was never going to work in a few minutes…

 

 

Two levels of settings are always mentioned for this issue – the site collection level and, if necessary, at the document library level.

Neither of these resolved the issue for me.

The Fix

1. Go to Central Administration. Click on Site Actions > Site Settings. Under Site Collection administration, click on Site Collection Features and activate “Open Documents in Client Applications by Default”. (mentioned here, and yes… it doesn’t make sense as to why this should be the case)

image

2. Go to the Site Collection in question, Click on Site Actions > Site Settings. Under Site Collection administration, click on Site Collection Features and activate “Open Documents in Client Applications by Default”. (covered here in detail)

3. Go to the Document Library in question, Click on Library Settings, Advanced Settings and select either “Use the server default” or “Open in client application”.

imageFrom here on, Chrome will download the file and IE will prompt to open it – Read Only or Edit.