Archive for the 'SharePoint' Category



Sites and lists not updating from the Content Type Hub

The Content Type Hub (CTH) brings fantastic new functionality to SharePoint 2010, functionality that anyone who has delivered or administered SharePoint 2007 will have been crying out for and no doubt welcomed with open arms.

The CTH can be a complex beast with settings located in lots of different places; Central Administration, Site Collections, sub-sites and the CTH itself.

Chances are, by the time you get to using content types from the CTH in document libraries way down in the basement of your SharePoint site structures it’s been a long time since you set up the Managed Metadata Service and the Hub – or perhaps you are an Information Manager and didn’t set it up in the first place.

So my question is: Where would you start to look if your content types in sub-sites and lists refuse to update properly?

Now I’m presuming here that you have correctly published the offending content type in the Hub, have run the 2 timer jobs in Central Administration and that the Site Collection you are trying to push the content type to is consuming the CTH.

In fact, I’m assuming you have one or more content type from the hub on your consuming Site Collection and have added them to document libraries – but now you’ve decided you need a new column on one of the content types.

You go through the same process described above (publishing the content type in the Hub, running the CA timer jobs etc.) but when you come to check the document library there is no new column.

To reassure yourself that you’ve done everything correctly, you look at the content type gallery in the consuming Site Collection and can see the new column. Very strange!

You’d be forgiven for thinking “this must be a setting in the document library”, or perhaps you forgot to tick the ‘Update all content types inheriting from this type?’ check box in the ‘Update Sites and Lists’ section of the content type in the Hub.

So you check and you check to no avail. You may even have tried running some PowerShell scripts to force the update. Nothing!

So what to do?

Turns out it’s simply the way the Managed Metadata Service Connection has been set up.

There are four useful little tick boxes, which you’re only likely to see at the point you create the service, two of which have a huge effect on how the Content Type Hub functions.

To get to them go to Central Administration > Application Management > Manage Service Applications > Highlight the ‘Metadata Service Application Proxy’ (click anywhere but the title) > Select ‘Properties’ on the ribbon (see screen shot below).

This should bring up the ‘Edit Managed Metadata Service Connection’ window.

Here you can see the four options I was talking about.

The first two are firmly aimed at the Term Store, but the last two have a huge impact on the CTH functionality as I mentioned. The last one is clearly what we’re after so let’s tick that box!

You should now see your document libraries and lists updating from the CTH without a problem.

As you can see, this can be a difficult problem to track down because the Site Collections are getting the content type updates as they should be, just not in the lists – but as ever, there’s just one more check box!

Back to PointBeyond web site

Finding Duplicate Documents in SharePoint using PowerShell

This script looks through all documents stored in a SharePoint site collection and finds duplicate files based on document contents rather than document names. This script has been written for SharePoint 2010 but should find duplicate documents in SharePoint 2007 as well with very little modification.

Over time, it is quite possible the same document will be uploaded to numerous SharePoint libraries. Keeping track of duplicate content spread across multi libraries can be practically impossible.

Building on the article here http://blog.codeassassin.com/2007/10/13/find-duplicate-files-with-powershell/ that details duplicate checking on fileshares, the following PowerShell script scans all your document libraries with a site collection for duplicate content by calculating an MD5 hash of the file contents. The script groups identical hashes and produces a list of all duplicated files, detailing the full url to item and the file name.

To run the script, copy the contents to notepad and save as a .ps1 file on one of your SharePoint servers. Then launch a PowerShell console and run the ps1 file.

Output to console showing duplicate files

PowerShell Console Output

The function returns the full path of all duplicated content.

This information could be piped back into SharePoint, or exported to Excel for analysis. You could even set this as a recurring job. In a future article, I will package this functionality into a timer job feature.

At present, the script stores all results in memory while it is running. If you are running this over a large site collection this may not scale very well. It may be worth streaming the results into a SQL table or similar. Also, at present this script will only evaluate content on a site collection basis but could be scoped to a web application or a whole farm if required.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

function Get-DuplicateFiles ($RootSiteUrl)

{

$spSite = Get-SPSite -Identity $RootSiteUrl

$Items = @()

foreach ($SPweb in $spSite.allwebs)

{

Write-Host “Checking ” $spWeb.Title ” for duplicate documents”

foreach ($list in $spWeb.Lists)

{

if($list.BaseType -eq “DocumentLibrary” -and $list.RootFolder.Url -notlike “_*” -and $list.RootFolder.Url -notlike “SitePages*”)

{

foreach($item in $list.Items)

{

$record = New-Object -TypeName System.Object

if($item.File.length -gt 0)

{

$fileArray = $item.File.OpenBinary()

$hash = Get-MD5($fileArray)

$record | Add-Member NoteProperty ContentHash ($hash)

$record | Add-Member NoteProperty FileName ($file.Name)

$record | Add-Member NoteProperty FullPath ($spWeb.Url + “/” + $item.Url)

$Items += $record

}

}

}

}

$spWeb.Dispose()

$duplicateHashes = $Items | Group-Object ContentHash | Where-Object {$_.Count -gt 1}

foreach($duplicatehash in $duplicateHashes)

{

$duplicateFiles += $Items | Where-Object{$_.contentHash -eq $duplicatehash.Name}

$duplicateFiles += “————————————————————”

}

}

return $duplicateFiles |Format-Table FullPath

}

function Get-MD5($file = $(throw ‘Usage:Get-MD5[System.IO.FileInfo]‘))

{

$stream = $null;

$cryptoServiceProvider = [System.Security.Cryptography.MD5CryptoServiceProvider];

$hasAlgorithm = New-Object $cryptoServiceProvider

$stream = $file;

$hashByteArray = $hasAlgorithm.ComputeHash($stream);

return [string]$hashByteArray;

}

Get-DuplicateFiles(<your sharepoint site>)

Back to PointBeyond Website

SharePoint Strategy – a Piece of Cake?

A light-hearted look at the reasons for defining a SharePoint strategy…

Imagine walking into a fabulous cake shop and being told you’ve £100 to spend. That’s going to buy you a whole lot of cake! But what do you do? It could be tempting to just get stuck in and start eating. The cakes are there and ready to eat. But how do you choose which ones to have? You may tuck into one that looks delicious, only to find it contains walnuts, and you don’t like walnuts. Or you may start eating a lemon cake, get half way through and before you can actually finish it you get so tempted by a chocolate cake that you move onto that one, then onto a strawberry one, and so on.

To start off with you’re going to feel pretty good, right? Pretty soon though, if you aren’t careful you will have blown your £100, you will have a mess of unfinished cakes, and you are going to be feeling pretty sick. Or at the other extreme you may have been so daunted by the choice, unsure of what to choose and whether or not you will like it, you may have decided not to bother at all, and then you have missed out on something good!

So cake can be a good thing, but in order to get the most from it wouldn’t it be better to think first about…

  • Why do we want the cake? Are we celebrating some special occasion or are we just eating it because it is there?
  • What type of cake do we want, and how much?
  • Who else do I want to share my cake with?
  • Is an off the shelf cake that is right for us or do I need a special one made?
  • When are we going to eat the cake?
  • Can we afford the cake that we desire?
  • Are we being sold a cake with decorations that we don’t actually like or need?
  • Will we like the way our behaviour changes as a result of the cake (all that sugar)?
  • Will the cake keep well and how will we store it?
  • Are we sure it is cake that we want? No matter how much we demand it, a cake shop owner can’t provide fish and chips.

I hope you can see the analogies with SharePoint. SharePoint has a huge amount of functionality, it looks pretty tempting and pretty easy to get started, and has great potential benefits, but unless you have a clear strategy and stay in control then you risk ending up feeling less good than you anticipated.

As a consultant, a common scenario I face is clients who really aren’t too sure about how to get started with SharePoint. It’s all to easy look at all the functionality and dip in and out of what you fancy, with no clear structure or vision of what it is you actually need.

When thinking about SharePoint strategy with my customers, I reassure them that it doesn’t have to be complicated, but you do need to think about things such as:

  • What business objectives am I trying to achieve with SharePoint? This is the most important question to answer clearly at the outset.
  • What is the vision?
  • What is the business case?
  • What are the benefits?
  • What will make SharePoint a success and how will I deliver it?
  • What capabilities will I deliver and in what order (what is the roadmap)?
  • How will I control the use of SharePoint (governance)
  • How will we support and help staff through the process?
  • How will we communicate our plans?
  • What won’t we do?

Enjoy!

Ian

Back to PointBeyond web site

White Paper – Organisations Leverage SharePoint to Build and Manage Critical Business Applications

Given our focus on delivering business applications using SharePoint, we are particularly excited to see this latest whitepaper from Microsoft:

http://www.microsoft.com/download/en/details.aspx?id=18768

An independent study by Mainstay Partners evaluated the implementation of the Microsoft SharePoint platform at three companies with the goal of understanding how they use the SharePoint technology to build and manage critical business applications.

This white paper explores how the three organizations deployed SharePoint capabilities to develop and manage essential business applications. While the deployments involved unique applications and content, each sought to achieve similar business goals – namely, to simplify and streamline IT environments, to increase business and IT flexibility and scalability, and add new capabilities to improve service levels and control costs.

PointBeyond have also created a new Linkedin Group – SharePoint Business Applications –  to encourage discussion and knowledge sharing on this subject. Please click here to join.

Back to PointBeyond web site

PowerShell to create SharePoint groups

The PowerShell code below creates 3 SharePoint groups within a subsite using the examples of the standard SharePoint Owners, Members, and Visitors groups and assigns the relevant permissions level to each. It will also configure the groups to allow any member to edit the membership and show how to add users into the newly created groups. In this example we will ensure that the subsite has unique permissions and will contain only the 3 groups stated above.

Using the SharePoint Management Shell enter the following…

###### Get the web object that requires the new groups

$web = Get-SPWeb http://site/subsite

###### If the web object is currently inheriting permission then break the inheritance

if ($web.HasUniquePerm -eq $false)
{
$web.BreakRoleInheritance($true, $true)
}

###### Remove unnecessary groups/users from the site permissions
for ($i = $web.RoleAssignments.Count – 1; $i -ge 0; $i–)
{
$web.RoleAssignments.Remove($i)
}

###### Create the new groups

# Owner Group
$web.SiteGroups.Add(“$web Owners”, $web.Site.Owner, $web.Site.Owner, “Use this group to grant people full control permissions to the $web site”)
$ownerGroup = $web.SiteGroups["$web Owners"]
$ownerGroup.AllowMembersEditMembership = $true
$ownerGroup.Update()

# Members Group
$web.SiteGroups.Add(“$web Members”, $web.Site.Owner, $web.Site.Owner, “Use this group to grant people contribute permissions to the $web site”)
$membersGroup = $web.SiteGroups["$web Members"]
$membersGroup.AllowMembersEditMembership = $true
$membersGroup.Update()

# Visitors Group
$web.SiteGroups.Add(“$web Visitors”, $web.Site.Owner, $web.Site.Owner, “Use this group to grant people read permissions to the $web site”)
$visitorsGroup = $web.SiteGroups["$web Visitors"]
$visitorsGroup.AllowMembersEditMembership = $true
$visitorsGroup.Update()

###### Add users to group as required

$user1 = $web.Site.RootWeb.EnsureUser(“domain\ownerusername”)
$ownerGroup.AddUser($user1)

$user2 = $web.Site.RootWeb.EnsureUser(“domain\memberusername”)
$membersGroup.AddUser($user2)

$user3 = $web.Site.RootWeb.EnsureUser(“domain\visitorusername”)
$visitorsGroup.AddUser($user3)

###### Create a new assignment (group and permission level pair) which will be added to the web object

$ownerGroupAssignment = new-object Microsoft.SharePoint.SPRoleAssignment($ownerGroup)
$membersGroupAssignment = new-object Microsoft.SharePoint.SPRoleAssignment($membersGroup)
$visitorsGroupAssignment = new-object Microsoft.SharePoint.SPRoleAssignment($visitorsGroup)

###### Get the permission levels to apply to the new groups

$ownerRoleDefinition = $web.Site.RootWeb.RoleDefinitions["Full Control"]
$membersRoleDefinition = $web.Site.RootWeb.RoleDefinitions["Contribute"]
$visitorsRoleDefinition = $web.Site.RootWeb.RoleDefinitions["Read"]

###### Assign the groups the appropriate permission level

$ownerGroupAssignment.RoleDefinitionBindings.Add($ownerRoleDefinition)
$membersGroupAssignment.RoleDefinitionBindings.Add($membersRoleDefinition)
$visitorsGroupAssignment.RoleDefinitionBindings.Add($visitorsRoleDefinition)

###### Add the groups with the permission level to the site

$web.RoleAssignments.Add($ownerGroupAssignment)
$web.RoleAssignments.Add($membersGroupAssignment)
$web.RoleAssignments.Add($visitorsGroupAssignment)

$web.Update()
$web.Dispose()

 

Back to PointBeyond web site

Integrating CRM 2011 with SharePoint 2010 for Document Storage

You can now configure Dynamics CRM 2011 to store documents in SharePoint. The integration is fairly simplistic, using an IFrame under the bonnet, but it is nevertheless effective. These instructions show you how to set it up technically, but the configuration that is correct for you will depend on your situation.

For the instructions below I used a locally hosted instance of SharePoint Server 2010, and an instance of CRM 2011 online.

Installing the Dynamics CRM 2011 List Component

Download the component from

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=23c0f351-8694-4d92-9ddf-34a949aec6a7&displayLang=en

In SharePoint 2010 Central Administration, go to Manage Web Applications, select the web application you wish to use and click on “General Settings”. Set Browser file handling to permissive for the web application:

Navigate to the folder where you downloaded CRM2011-SharePointList-ENU-amd64.exe, and double-click it.

In the Open File – Security Warning dialog box, click Run.

To accept the license agreement, click Yes.

Select a folder to store the extracted files, and click OK.

The following files are extracted:

AllowHtcExtn.ps1

crmlistcomponent.wsp

Open your browser.

In the address bar, type the URL of the site collection on which you want to install the Microsoft Dynamics CRM List component.

Click Site Actions, and then click Site Settings.

Under Galleries, click Solutions.

On the Solutions tab, in the New group, click Upload Solution.

Click Browse, locate the crmlistcomponent.wsp file, and then click OK.

Click close.

Make sure that the Sandboxed Code Service is running:

On the Solutions tab, in the Commands group, click Activate.

This did not work for me. To get the solution to activate the following procedure was needed (from http://blogs.msdn.com/b/sharepointdev/archive/2011/02/08/error-the-sandboxed-code-execution-request-was-refused-because-the-sandboxed-code-host-service-was-too-busy-to-handle-the-request.aspx)

On the server, click Start | Administrative Tools | Services.

On the Services dialog, scroll to SharePoint 2010 User Code Host.

Note the full user name in the Log On As column. You will need this information later.

Open SharePoint Management Shell.

Enter the following at the command prompt, including all punctuation.

(Get-SPManagedAccount –Identity “username”).Sid.Value

Replace username with the name you obtained above. E.g., CorpDomain\ServiceAccount

This will return the user’s SID (Security ID), which you will use in a later step.

Open the registry editor and navigate to:

HKEY_USERS\SID you obtained earlier\Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing

Be sure the State key value is set to 0x00023e00.

Restart the sandboxed host service on all servers on which it is to run. It cannot hurt to do an iisreset as well.

Another known cause is that SharePoint is trying to check for certificate revocations at crl.microsoft.com. You can redirect these attempts by adding the following line to the end of the hosts file located at C:\Windows\System32\drivers\etc:

127.0.0.1 crl.microsoft.com

This must be done on all servers running the sandboxed host service. Then restart the service on all these servers. It cannot hurt to do an iisreset as well.

Add .htc extension to the list of the allowed file types

The steps mentioned here are required only if you are using Microsoft SharePoint Server 2010 (On-Premises).

You must be a SharePoint administrator or a farm administrator to be able to do the following steps:

Copy the AllowHtcExtn.ps1 script file to Microsoft SharePoint Server 2010.

In the Windows PowerShell window or in the SharePoint Management Console, run the command: AllowHtcExtn.ps1 <Web Application URL>

Example: AllowHtcExtn.ps1 http://mywebapplication

Configuring the connection

You can now go into CRM in Outlook (or the browser based version) and click on “Settings” then “System”, then “Document Management”.

From here you can set up the mapping between SharePoint in one of two ways. The easy way (shown below) creates a folder hierarchy for you, based on CRM entity types and names.

If you wish to though, you can set explicit mappings for each CRM entity through to a specific SharePoint location.

Which of these is correct for you will depend on how you intend to use SharePoint and the amount of documentation that you anticipate storing.

Now when you go to an entity in CRM you can click on documents in the left panel and interact with your documents in a SharePoint library, all from within CRM.

Note: To get Outlook integration to work it may be necessary to add the CRM web site to “Trusted Sites” in Internet Explorer.

Back to PointBeyond web site

SharePoint European Best Practices Conference

It’s great to have been invited to speak again at the European Best Practices Conference in April. Last year’s presentation on Records Management seemed to go down well, and this year I am going to be talking about the approach and lessons learned when migrating corporate intranets to SharePoint. It’s going to be fairly business focused, and I’ll be walking through the approach and process from start to finish. I’ll include making the business case, success criteria, SharePoint version decisions, content (re)organisation, managing user adoption and cultural change, governance, content migration, and training. See you there!

Ian

 

 

Back to PointBeyond web site

SharePoint Saturday Slides: Extranet on SharePoint 2010 Foundation

Really enjoyed speaking at SharePoint Saturday EMEA on 22 Jan. It was great to get feedback from so many people through email and twitter, and seeing the attendee count increasing during the session was rather nice too!

Here are the session slides:

Ian

Back to PointBeyond web site.

Index of SharePoint 2010 Issues and Resolutions

Thought I would consolidate the posts I have made over the last few months into a single index. The topics are quite varied as they comprise issues I have encountered while working on real world projects.

InfoPath web form not loading in SharePoint 2010

Error viewing reports in Access Services

Unable to open the file for an unknown reason in Excel Services

Document IDs and the managed metadata service

Unable to find the content type publishing link in site administration, or to use managed metadata columns

No content types have been subscribed error message

 

 

Back to PointBeyond web site

SharePoint Saturday: Access Services Slides

Well what a great day the first UK SharePoint Saturday was on 2nd October! Great sessions and enthusiasm from everyone attending, and credit to the organisers! This is the kind of event that makes you really appreciate being part of the SharePoint community!

I was very pleased to be presenting Access Services: Better than Marmite? The session looked at the traditional problems of using Access in an enterprise environment, and how Access Services could help to address them. I also built a full Access Services based solution for tracking Freedom of Information Requests in a SharePoint site, from scratch, using Access Services.

My session slides can be downloaded from here.

http://pointbeyond.files.wordpress.com/2010/10/access-services.pptx

Hope you find them useful!

Back to PointBeyond web site.

« Previous PageNext Page »



Follow

Get every new post delivered to your Inbox.

Join 279 other followers