Thursday, 11 July 2013

SharePoint 2010 - People Picker that is showing the wrong user profile information

Hi again,

introduction to this issue:  Someone has updated information on their MySite but their details have not propagated through to the People Picker, or any list that shows User Information in it.

Why:  This is due to the User Information List, which is used to supply User Information to all the SharePoint functions that use it.  The User Information List only seems to get updated when a user is first introduced to a Site Collection.  Not even a full Profile Sync will fix it. (You can find the User Information List here: http://[rootsite]/_layouts/people.aspx?MembershipGroupId=0).  This issue has been documented before and done very nicely on Gary's blog here:

The difference is between Gary's blog post and mine, is that his shows how to get a script to iterate through every Web Application and update specific fields.  Where as I will be showing how to look for a specific field & update it manually.


First get the User ID of the person who is having the issue:

$user = Get-SPUser -Identity 'domain\username' -Web http://sharepointserver

Then you need to navigate to the Users details in the User Information List using their user ID you just found.  This code will list all the fields for that user appearing in the User Information List

$web = Get-SPWeb http://SharePointServer
$list = $web.Lists["User Information List"]
$item = $list.GetItemById($
$list.fields | % {Write-Host "$($_.InternalName) = $($item[$_.InternalName])"}

Now you should have found the field causing the issue, so you can update it like this:

$item["FieldName"] = "  "

Done!  Because this is a manual way of searching for the right fields to update, you will need to do this for every Web Application.

Tuesday, 9 July 2013

Making a jQuery banner from scratch

Woah, hang on a minute...  You mean you want me to build my own jQuery solution from scratch!?  Why would I do that when there are so many pre-packaged jQuery solutions out there?

Good question, if you are only making something very simple, maybe you'd like to optimise the amount of code the browser has to execute, and the pre-packaged solution may have many more features than you need...  Ok, I'll admit that's a bit far fetched for me to use as my own excuse.  I had some spare time, and wanted to see how easy it was.

The answer, as always, is it depends.

I was migrating a website from the early 2000's to a SharePoint site and I just wanted to replace a simple flash banner that faded in/out images & animated text.  Great little project I thought.

Here's how:
First I made a simple HTML page with a div for every image and sentence I wanted to fade in and out.  and an id against every div, so that I could reference them in the jQuery.

<script src="" />
<div id="background">
<div id="sydney"><div id="busy">Busy Joint</div></div>
<div id="melbourne"><div id="cold">Cold Joint</div></div>
<div id="brisbane"><div id="small">Small Joint</div></div>
<div id="perth"><div id="exxy">Exxy Joint</div></div>

I used CSS to hide all div's by default using 'display: none'.  and of course, used CSS to set all the other look/feel goodies.

Now to start Querying the J (jQuerying... ahem.):

A few pointers.

  • All jQuery needs to be inside <script> tags
  • Anything inside the Document Ready Function will run when the page loads
  • If you wish to cycle your animation indefinitely, my favourite way is to put the animation inside it's own function, which calls itself on the last line of the function.
  • Whenever you want to do something to an item, you call it like this: $("#[css id]").[dosomething]()   So the jQuery Syntax is: $(selector).action() 

Here's the beginning of my jQuery, fading in my 'sydney' and 'busy' divs, then animating the 'busy' words and then fading them out again:

    $("#busy").animate({left:"150px"}, 700, function(){     


Notice on the animate step, I've called a function which runs the FadeOut steps.  This is because although jQuery runs step by step, it doesn't wait until one step is finished to run the next step unless you tell it to.  So what I'm saying here is, don't fade the suckers out until the animation has completed.

So I wanted to make the banner do this four times with different DIV's.  All you need to do is rinse and repeat really!  Yes I probably could have optimised the code even further, but this is a simplistic version in order to teach a beginner how it works:



function startAnimation(){    
    $("#busy").animate({left:"150px"}, 700, function(){     

    $("#cold").animate({right:"150px"}, 700, function(){     

    $("#small").animate({left:"150px"}, 700, function(){     

    $("#exxy").animate({right:"150px"}, 700, function(){     

I added a little bit extra there..
  • Used the Delay Action to make the steps wait 1 second.
  • Inserted a function to run all the animations, so that I could get the function to call itself and run forever.
  • The animate settings is telling the CSS to move the div right and left.
Hopefully that's not too much info.  Comment if you have any questions.

Monday, 1 July 2013

Entertainment book - Melbourne CBD - 2012-2013

Go to 2 expensive restaurants that do 2-for-1 and you've already made back the money you paid for the book.

Oh wow, now you have 700 other tickets of varied usefulness that can save you cash.

I personally prefer just to use all the restaurant ones as they give you the most value for money and force me to go to new restaurants!